Skip to content

Instantly share code, notes, and snippets.

@jherico
Last active August 29, 2015 13:57
Show Gist options
  • Save jherico/9769116 to your computer and use it in GitHub Desktop.
Save jherico/9769116 to your computer and use it in GitHub Desktop.
void renderScene() {
// do all your normal rendering here
...
// Render the latency test color if required
renderLatencyTestSquare();
}
void renderLatencyTestSquare() {
OVR::Color colorToDisplay;
// If this returns a non-0 value, we're performing a latency
// test and must render a colored square underneath the tester
// (On the lens axis)
if (ovrLatencyTest.DisplayScreenColor(colorToDisplay)) {
latencyTestProgram->use();
latencyTestProgram->setUniform("Color", Rift::fromOvr(colorToDisplay));
gl::MatrixStack & mv = gl::Stacks::modelview();
glDisable(GL_DEPTH_TEST);
mv.with_push([&]{
mv.identity().translate(glm::vec3(0, 0, -0.1f)).scale(0.005f);
GlUtils::renderGeometry(latencyTestQuad, latencyTestProgram);
});
glEnable(GL_DEPTH_TEST);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment