mirror of
https://github.com/CrispyPin/sinpin-vr.git
synced 2024-11-25 19:40:26 +01:00
increase update rate
This commit is contained in:
parent
e73e9b12f8
commit
895bec3bd5
3 changed files with 10 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
|||
App::App()
|
||||
{
|
||||
_tracking_origin = vr::TrackingUniverseStanding;
|
||||
_frames_since_framebuffer = 999;
|
||||
|
||||
InitOVR();
|
||||
InitX11();
|
||||
|
@ -152,6 +153,7 @@ void App::Update()
|
|||
panel.Update();
|
||||
}
|
||||
}
|
||||
_frames_since_framebuffer += 1;
|
||||
}
|
||||
|
||||
void App::UpdateInput()
|
||||
|
@ -185,6 +187,11 @@ void App::UpdateInput()
|
|||
|
||||
void App::UpdateFramebuffer()
|
||||
{
|
||||
if (_frames_since_framebuffer < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_frames_since_framebuffer = 0;
|
||||
auto frame = XGetImage(
|
||||
_xdisplay,
|
||||
_root_window,
|
||||
|
|
|
@ -50,6 +50,7 @@ class App
|
|||
Window _root_window;
|
||||
GLFWwindow *_gl_window;
|
||||
GLuint _gl_frame;
|
||||
int _frames_since_framebuffer;
|
||||
|
||||
int _root_width;
|
||||
int _root_height;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "app.h"
|
||||
#include <signal.h>
|
||||
|
||||
#define FRAMERATE 30
|
||||
#define UPDATE_RATE 60
|
||||
|
||||
bool should_exit = false;
|
||||
|
||||
|
@ -19,7 +19,7 @@ int main()
|
|||
while (!should_exit)
|
||||
{
|
||||
app.Update();
|
||||
usleep(1000000 / FRAMERATE);
|
||||
usleep(1000000 / UPDATE_RATE);
|
||||
}
|
||||
printf("\nShutting down\n");
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue