mirror of
https://github.com/CrispyPin/sinpin-vr.git
synced 2024-11-22 18:10:26 +01:00
flip texture instead of overlay transform
This commit is contained in:
parent
766c3e2056
commit
3c3ed783e4
1 changed files with 5 additions and 2 deletions
|
@ -9,7 +9,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
auto TRACKING_UNIVERSE = vr::ETrackingUniverseOrigin::TrackingUniverseStanding;
|
auto TRACKING_UNIVERSE = vr::ETrackingUniverseOrigin::TrackingUniverseStanding;
|
||||||
const vr::HmdMatrix34_t DEFAULT_POSE = {{{1, 0, 0, 0}, {0, -1, 0, 1}, {0, 0, 1, 0}}};
|
const vr::HmdMatrix34_t DEFAULT_POSE = {{{1, 0, 0, 0}, {0, 1, 0, 1}, {0, 0, 1, 0}}};
|
||||||
|
|
||||||
#define FRAMERATE 30
|
#define FRAMERATE 30
|
||||||
|
|
||||||
|
@ -88,6 +88,9 @@ void init_overlay()
|
||||||
ovr_overlay->SetOverlayRaw(main_overlay, &col, 1, 1, 4);
|
ovr_overlay->SetOverlayRaw(main_overlay, &col, 1, 1, 4);
|
||||||
printf("Created overlay instance\n");
|
printf("Created overlay instance\n");
|
||||||
|
|
||||||
|
vr::VRTextureBounds_t bounds{0, 1, 1, 0}; // (flipping uv on y axis because opengl and xorg are opposite)
|
||||||
|
ovr_overlay->SetOverlayTextureBounds(main_overlay, &bounds);
|
||||||
|
|
||||||
ovr_overlay->SetOverlayTransformAbsolute(main_overlay, TRACKING_UNIVERSE, &DEFAULT_POSE);
|
ovr_overlay->SetOverlayTransformAbsolute(main_overlay, TRACKING_UNIVERSE, &DEFAULT_POSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +119,7 @@ void update_cursor()
|
||||||
float ratio = (float)height / (float)width;
|
float ratio = (float)height / (float)width;
|
||||||
float top_edge = 0.5f - ratio / 2.0f;
|
float top_edge = 0.5f - ratio / 2.0f;
|
||||||
float x = pix_x / (float)width;
|
float x = pix_x / (float)width;
|
||||||
float y = pix_y / (float)width + top_edge;
|
float y = 1.0f - (pix_y / (float)width + top_edge);
|
||||||
auto pos = vr::HmdVector2_t{x, y};
|
auto pos = vr::HmdVector2_t{x, y};
|
||||||
ovr_overlay->SetOverlayCursorPositionOverride(main_overlay, &pos);
|
ovr_overlay->SetOverlayCursorPositionOverride(main_overlay, &pos);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue