mirror of
https://github.com/CrispyPin/sinpin-vr.git
synced 2024-11-10 04:20:25 +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()
|
App::App()
|
||||||
{
|
{
|
||||||
_tracking_origin = vr::TrackingUniverseStanding;
|
_tracking_origin = vr::TrackingUniverseStanding;
|
||||||
|
_frames_since_framebuffer = 999;
|
||||||
|
|
||||||
InitOVR();
|
InitOVR();
|
||||||
InitX11();
|
InitX11();
|
||||||
|
@ -152,6 +153,7 @@ void App::Update()
|
||||||
panel.Update();
|
panel.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_frames_since_framebuffer += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::UpdateInput()
|
void App::UpdateInput()
|
||||||
|
@ -185,6 +187,11 @@ void App::UpdateInput()
|
||||||
|
|
||||||
void App::UpdateFramebuffer()
|
void App::UpdateFramebuffer()
|
||||||
{
|
{
|
||||||
|
if (_frames_since_framebuffer < 2)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_frames_since_framebuffer = 0;
|
||||||
auto frame = XGetImage(
|
auto frame = XGetImage(
|
||||||
_xdisplay,
|
_xdisplay,
|
||||||
_root_window,
|
_root_window,
|
||||||
|
|
|
@ -50,6 +50,7 @@ class App
|
||||||
Window _root_window;
|
Window _root_window;
|
||||||
GLFWwindow *_gl_window;
|
GLFWwindow *_gl_window;
|
||||||
GLuint _gl_frame;
|
GLuint _gl_frame;
|
||||||
|
int _frames_since_framebuffer;
|
||||||
|
|
||||||
int _root_width;
|
int _root_width;
|
||||||
int _root_height;
|
int _root_height;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#define FRAMERATE 30
|
#define UPDATE_RATE 60
|
||||||
|
|
||||||
bool should_exit = false;
|
bool should_exit = false;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ int main()
|
||||||
while (!should_exit)
|
while (!should_exit)
|
||||||
{
|
{
|
||||||
app.Update();
|
app.Update();
|
||||||
usleep(1000000 / FRAMERATE);
|
usleep(1000000 / UPDATE_RATE);
|
||||||
}
|
}
|
||||||
printf("\nShutting down\n");
|
printf("\nShutting down\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue