Hi,
I am experience some weird performance troubles:
I create a FBO with both, color and depth being textures since I need them later in my shader. However, clearing the Depht-Buffer with
glClear(GL_DEPTH_BUFFER_BIT);
really kills the performance. It drops from 250fps when just clearing the color-texture to about 55fps when clearing the depth buffer as well.
The FBO is created like this:
glGenFramebuffersEXT(1, &m_frameBuffer);
glGenTextures(1, &m_depthBuffer);
glGenTextures(1, &m_colorBuffer);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_frameBuffer);
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, m_colorBuffer);
glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA8, _width, _height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
//glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_FLOAT_RGBA16_NV, _width, _height, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_EXT, m_colorBuffer, 0);
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, m_depthBuffer);
glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_DEPTH_COMPONENT32, _width, _height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_RECTANGLE_EXT, m_depthBuffer, 0);
Also, when changing the DEPTH_COMPONENT to DEPTH_COMPONENT16, the FBO can’t be created, only DEPTH_COMPONENT24 and DEPTH_COMPONENT32 work but show no difference in Performance.
Does anybody have any ideas?