Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OSX snippet for using GL to transfer full-frame video (without head-tracking) to Oculus Rift via libovr
uint8_t* EyeBuffer[2]; // raw per-eye data;
void onIdle() {
HmdFrameTiming = ovrHmd_BeginFrame(Hmd, 0);
// ...normal frame management from OculusWorldDemoApp::OnIdle goes here..
// ...and then immediately before you EndFrame:
// just transfer directly onto the eye textures
// The texture we're going to render to.
GLuint texId;
for (int i = 0; i < 2; i++) {
texId = ((ovrGLTextureData&)(EyeTexture[i])).TexId;
glBindTexture(GL_TEXTURE_2D, texId);
// Upload the current texture from EyeBuffer
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
EyeTexture[i].Header.TextureSize.w,
EyeTexture[i].Header.TextureSize.h,
0, GL_RGBA, GL_UNSIGNED_BYTE, EyeBuffer[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
ovrHmd_EndFrame(Hmd, EyeRenderPose, EyeTexture);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment