mirror of
https://github.com/CrispyPin/sinpin-vr.git
synced 2024-11-22 18:10:26 +01:00
cleanup
This commit is contained in:
parent
6aef8f92d7
commit
3f1670809c
1 changed files with 8 additions and 13 deletions
21
src/main.cpp
21
src/main.cpp
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "openvr/openvr.h"
|
#include "openvr/openvr.h"
|
||||||
|
|
||||||
static vr::ETrackingUniverseOrigin TRACKING_UNIVERSE = vr::ETrackingUniverseOrigin::TrackingUniverseStanding;
|
auto TRACKING_UNIVERSE = vr::ETrackingUniverseOrigin::TrackingUniverseStanding;
|
||||||
|
|
||||||
#define FRAMERATE 30
|
#define FRAMERATE 30
|
||||||
|
|
||||||
|
@ -81,15 +81,6 @@ void init_overlay()
|
||||||
assert(err == 0);
|
assert(err == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup()
|
|
||||||
{
|
|
||||||
printf("\nShutting down\n");
|
|
||||||
vr::VR_Shutdown();
|
|
||||||
glfwDestroyWindow(gl_window);
|
|
||||||
glfwTerminate();
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void render_desktop()
|
void render_desktop()
|
||||||
{
|
{
|
||||||
auto frame = XGetImage(xdisplay, root_window, 0, 0, width, height, AllPlanes, ZPixmap);
|
auto frame = XGetImage(xdisplay, root_window, 0, 0, width, height, AllPlanes, ZPixmap);
|
||||||
|
@ -127,13 +118,13 @@ void interrupted(int _sig)
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
signal(SIGINT, interrupted);
|
||||||
|
|
||||||
init_x11();
|
init_x11();
|
||||||
init_glfw();
|
init_glfw();
|
||||||
init_vr();
|
init_vr();
|
||||||
init_overlay();
|
init_overlay();
|
||||||
|
|
||||||
signal(SIGINT, interrupted);
|
|
||||||
|
|
||||||
while (!should_exit)
|
while (!should_exit)
|
||||||
{
|
{
|
||||||
render_desktop();
|
render_desktop();
|
||||||
|
@ -142,6 +133,10 @@ int main()
|
||||||
glfwSwapBuffers(gl_window);
|
glfwSwapBuffers(gl_window);
|
||||||
usleep(1000000 / FRAMERATE);
|
usleep(1000000 / FRAMERATE);
|
||||||
}
|
}
|
||||||
cleanup();
|
|
||||||
|
printf("\nShutting down\n");
|
||||||
|
vr::VR_Shutdown();
|
||||||
|
glfwDestroyWindow(gl_window);
|
||||||
|
glfwTerminate();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue