| 721 | } |
| 722 | |
| 723 | void Graphics::BlitDepthBuffer() { |
| 724 | Shaders::Instance()->setProgram(Shaders::Instance()->returnProgram(shader)); |
| 725 | GLState state; |
| 726 | state.depth_test = true; |
| 727 | state.depth_write = true; |
| 728 | state.blend = false; |
| 729 | state.cull_face = false; |
| 730 | setGLState(state); |
| 731 | // The above code is here to fix a mysterious problem |
| 732 | GLint depth_attachment_object_type[2]; |
| 733 | GLint depth_attachment_object_name[2]; |
| 734 | bindFramebuffer(multisample_framebuffer); |
| 735 | glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &depth_attachment_object_type[0]); |
| 736 | glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &depth_attachment_object_name[0]); |
| 737 | bindFramebuffer(framebuffer); |
| 738 | glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &depth_attachment_object_type[1]); |
| 739 | glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &depth_attachment_object_name[1]); |
| 740 | CHECK_FBO_ERROR(); |
| 741 | CHECK_GL_ERROR(); |
| 742 | glBindFramebuffer(GL_READ_FRAMEBUFFER, multisample_framebuffer); |
| 743 | CHECK_FBO_ERROR(); |
| 744 | CHECK_GL_ERROR(); |
| 745 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer); |
| 746 | CHECK_FBO_ERROR(); |
| 747 | CHECK_GL_ERROR(); |
| 748 | glBlitFramebuffer(0, 0, render_dims[0], render_dims[1], 0, 0, render_dims[0], render_dims[1], GL_DEPTH_BUFFER_BIT, GL_NEAREST); |
| 749 | CHECK_FBO_ERROR(); |
| 750 | CHECK_GL_ERROR(); |
| 751 | glBindFramebuffer(GL_FRAMEBUFFER, curr_framebuffer); |
| 752 | CHECK_FBO_ERROR(); |
| 753 | CHECK_GL_ERROR(); |
| 754 | } |
| 755 | |
| 756 | static void ApplyVsync(bool val) { |
| 757 | // Set VSync |
no test coverage detected