void OculusHud::Render() { if(show) { // If render function defined, use it to render left / right images // to framebuffer if(this->extern_draw_function) { framebuffer.Bind(); glClearColor(1,1,1,0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); for(int i=0; i<2; ++i) { eyeview[i].Activate(); default_cam.ApplyNView(i); this->extern_draw_function(*this); } framebuffer.Unbind(); } if(common.IsShown() && common.NumChildren()) { framebuffer.Bind(); RenderChildren(); for(int i=0; i<2; ++i) { Viewport v = eyeview[i].v; v.l += 160 -i*120; v.w -= 160; v.h -= 220; common.Resize(v); common.Render(); } framebuffer.Unbind(); } RenderFramebuffer(); } }
/// Swap buffers (render frame) void RendererOpenGL::SwapBuffers() { render_window->MakeCurrent(); // EFB->XFB copy // TODO(bunnei): This is a hack and does not belong here. The copy should be triggered by some // register write. // // TODO(princesspeachum): (related to above^) this should only be called when there's new data, not every frame. // Currently this uploads data that shouldn't have changed. common::Rect framebuffer_size(0, 0, resolution_width, resolution_height); RenderXFB(framebuffer_size, framebuffer_size); // XFB->Window copy RenderFramebuffer(); // Swap buffers render_window->PollEvents(); render_window->SwapBuffers(); }
/// Swap buffers (render frame) void RendererOpenGL::SwapBuffers() { m_render_window->MakeCurrent(); // EFB->XFB copy // TODO(bunnei): This is a hack and does not belong here. The copy should be triggered by some // register write We're also treating both framebuffers as a single one in OpenGL. Rect framebuffer_size(0, 0, m_resolution_width, m_resolution_height); RenderXFB(framebuffer_size, framebuffer_size); // XFB->Window copy RenderFramebuffer(); // Swap buffers m_render_window->PollEvents(); m_render_window->SwapBuffers(); // Switch back to EFB and clear glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo[kFramebuffer_EFB]); }