// Texture IDs used by the app
GLuint m_uiTextureToRenderTo;
+ GLuint m_uiDepthToRenderTo;
// Handle for our FBO and the depth buffer that it requires
GLuint m_uiFBO;
m_uiSceneFragShader(0),
m_i32OriginalFbo(0),
m_uiTextureToRenderTo(0),
+ m_uiDepthToRenderTo(0),
m_uiFBO(0),
m_uiFBOMultisampled(0),
m_uiDepthBufferMultisampled(0),
// Attach the texture to the FBO
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_uiTextureToRenderTo, 0);
+ if(!m_bMultisampledSupported)
+ {
+ glGenTextures(1, &m_uiDepthToRenderTo);
+ glBindTexture(GL_TEXTURE_2D, m_uiDepthToRenderTo);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\r
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, PVRShellGet(prefWidth), PVRShellGet(prefHeight), 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_uiDepthToRenderTo, 0);
+ }
// Check that our FBO creation was successful
GLuint uStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
glDeleteTextures(1, &m_uiBackgroundTexture);
glDeleteTextures(eLast, m_uiLUTs);
glDeleteTextures(1, &m_uiTextureToRenderTo);
+ glDeleteTextures(1, &m_uiDepthToRenderTo);
// Release Vertex buffer object.
glDeleteBuffers(1, &m_ui32FullScreenRectVBO);