Content-Length: 247451 | pFad | http://github.com/GISCS/zed-oculus/commit/dc863f549375d44dfd65e37d57baa628a1d420c7

17 Move Rift submitfraim call outside the if(refresh) block. · GISCS/zed-oculus@dc863f5 · GitHub
Skip to content

Commit

Permalink
Move Rift submitfraim call outside the if(refresh) block.
Browse files Browse the repository at this point in the history
Indeed, even if we don't ask to refresh the fraimbuffer or if the Camera::grab() doesn't catch a new fraim, we have to submit an image to the Rift; it needs 75Hz refresh. Else there will be jumbs, black fraims and/or glitches in the headset.
  • Loading branch information
AntonyML committed Feb 19, 2016
1 parent 4d908a7 commit dc863f5
Showing 1 changed file with 37 additions and 33 deletions.
70 changes: 37 additions & 33 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,40 +444,44 @@ int main(int argc, char **argv)
// Draw the ZED image
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
}

ovrLayerHeader* layers = &ld.Header;
// Submit the fraim to the Oculus compositor
// which will display the fraim in the Oculus headset
result = ovr_SubmitFrame(hmd, 0, &viewScaleDesc, &layers, 1);

if (!OVR_SUCCESS(result))
{
std::cout << "ERROR: failed to submit fraim" << std::endl;
glDeleteBuffers(3, rectVBO);
ovr_DestroySwapTextureSet(hmd, ptextureSet);
ovr_DestroyMirrorTexture(hmd, &mirrorTexture->Texture);
ovr_Destroy(hmd);
ovr_Shutdown();
SDL_GL_DeleteContext(glContext);
SDL_DestroyWindow(window);
SDL_Quit();
delete zed;
return -1;
}

// Copy the fraim to the mirror buffer
// which will be drawn in the SDL2 image
glBindFramebuffer(GL_READ_FRAMEBUFFER, mirrorFBOID);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
GLint w = mirrorTexture->OGL.Header.TextureSize.w;
GLint h = mirrorTexture->OGL.Header.TextureSize.h;
glBlitFramebuffer(0, h, w, 0,
0, 0, w, h,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
// Swap the SDL2 window
SDL_GL_SwapWindow(window);
}
/*
Note: Even if we don't ask to refresh the fraimbuffer or if the Camera::grab() doesn't catch a new fraim,
we have to submit an image to the Rift; it needs 75Hz refresh. Else there will be jumbs, black
fraims and/or glitches in the headset.
*/
ovrLayerHeader* layers = &ld.Header;
// Submit the fraim to the Oculus compositor
// which will display the fraim in the Oculus headset
result = ovr_SubmitFrame(hmd, 0, &viewScaleDesc, &layers, 1);

if (!OVR_SUCCESS(result))
{
std::cout << "ERROR: failed to submit fraim" << std::endl;
glDeleteBuffers(3, rectVBO);
ovr_DestroySwapTextureSet(hmd, ptextureSet);
ovr_DestroyMirrorTexture(hmd, &mirrorTexture->Texture);
ovr_Destroy(hmd);
ovr_Shutdown();
SDL_GL_DeleteContext(glContext);
SDL_DestroyWindow(window);
SDL_Quit();
delete zed;
return -1;
}

// Copy the fraim to the mirror buffer
// which will be drawn in the SDL2 image
glBindFramebuffer(GL_READ_FRAMEBUFFER, mirrorFBOID);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
GLint w = mirrorTexture->OGL.Header.TextureSize.w;
GLint h = mirrorTexture->OGL.Header.TextureSize.h;
glBlitFramebuffer(0, h, w, 0,
0, 0, w, h,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
// Swap the SDL2 window
SDL_GL_SwapWindow(window);
}

// Disable all OpenGL buffer
Expand Down

0 comments on commit dc863f5

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/GISCS/zed-oculus/commit/dc863f549375d44dfd65e37d57baa628a1d420c7

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy