Skip to content

Instantly share code, notes, and snippets.

View jherico's full-sized avatar
🖖
Peace and long life

Bradley Austin Davis jherico

🖖
Peace and long life
View GitHub Profile
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));
// In your class
OVR::Ptr<OVR::LatencyTestDevice> ovrLatencyTester;
OVR::Util::LatencyTest ovrLatencyTest;
// In your constructor
ovrLatencyTester = *ovrManager->EnumerateDevices<OVR::LatencyTestDevice>().CreateDevice();
if (ovrLatencyTester) {
ovrLatencyTest.SetDevice(ovrLatencyTester);
}
// In your class
OVR::Quatf currentOrientation;
OVR::SensorFusion sensorFusion;
// In my per-frame update code
...
currentOrientation = sensorFusion.GetPredictedOrientation();
ovrLatencyTest.ProcessInputs();
...
void renderScene() {
// do all your normal rendering here
...
// Render the latency test color if required
renderLatencyTestSquare();
}
void renderLatencyTestSquare() {
template <typename Function>
void for_each_eye(Function f){
for (Eye eye = LEFT; eye <= RIGHT; eye = static_cast<Eye>(eye + 1)) {
f(eye);
}
}
...
#include <OVR.h>
#undef new
#undef min
#undef max
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/noise.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/gtx/norm.hpp>
import gov.nasa.worldwind.Model;
import gov.nasa.worldwind.WorldWind;
import gov.nasa.worldwind.WorldWindow;
import gov.nasa.worldwind.avlist.AVKey;
import gov.nasa.worldwind.awt.WorldWindowGLCanvas;
import gov.nasa.worldwind.geom.BilinearInterpolator;
import gov.nasa.worldwind.geom.LatLon;
import gov.nasa.worldwind.geom.Sector;
import gov.nasa.worldwind.geom.Vec4;
import gov.nasa.worldwind.globes.Globe;
package org.saintandreas.vr;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL20.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/************************************************************************************
Authors : Bradley Austin Davis <bdavis@saintandreas.org>
Copyright : Copyright Brad Davis. All Rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
1>------ Build started: Project: Example_2_4_HelloRift, Configuration: Debug Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(388,5): warning MSB8028: The intermediate directory (Example_2_4_HelloRift.dir\Debug\) contains files shared from another project (Example_2_4_HelloRift.vcxproj, Example_2_4_HelloRift.vcxproj). This can lead to incorrect clean and rebuild behavior.
1> Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> cl /c /IC:\Users\bdavis\Git\OculusRiftExamples\build32\examples\cpp /IC:\Users\bdavis\Git\OculusRiftExamples\examples\cpp /I"C:\dev\opencv-2.4.9\build\include" /I"C:\dev\opencv-2.4.9\build\include\opencv" /Ic:\Qt\Qt5.4.0\5.4\msvc2013_opengl\include /Ic:\Qt\Qt5.4.0\5.4\msvc2013_opengl\include\QtCore /I"c:\Qt\Qt5.4.0\5.4\msvc2013_opengl\mkspecs\win32-msvc2013" /Ic:\Qt\Qt5.4.0\5.4\msvc2013_opengl\include\QtWidgets /Ic:\Qt\Qt5.4.0\5.4\msvc2013_opengl\inclu