I’m having this trouble and I’ve spent several days trying to figure it out.
I have a Framebuffer Object, and I have extensively tested it for a wide variety of issues, however I cannot find any information on my issue and so I am posting here.
In advance, yes the FBOs are tested as “complete”, the textures are RGBA8 (though I tested them with RGBA16 for a while, not sure how widely supported it is), and I used http://www.opengl.org/wiki/GL_EXT_framebuffer_object among others to figure all of that out, including reading the specs.
Facts about this situation:
-
I have successfully created 2 FBOs using the same exact class, with no sub-classes or modifications to the parameters.
-
FBO 1 and 2 are both attached to a pair of mutually exclusive attachments, a) RBO Depth b) ColorMap Texture (0)
-
Both are built at the requested size of 1024x1024
-
When I use glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT) after setting the color to orange, it does write to them without any glErrors, but in one case (FBO 1) it writes only to a 512x384 subsection, always in the same place, and in the other case (FBO 2) it only clears a region that is 1/4th the size, anchored at the middle of the texture (in fact, both are…)
Here is the code I use to put a “Test pattern” on the FBO:
[b]
// Renders a test pattern on the fBO
void RenderTestSceneOnFBO() {
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
GL_Assert("Framebuffer::RenderTestSceneOnFBO() Pre" );
glReportError( glGetError() );
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
GL_Assert("Framebuffer::RenderTestSceneOnFBO() glViewport" );
glReportError( glGetError() );
glClearColor((GLclampf) 1.0f,(GLclampf) 0.6f,(GLclampf) 0.4f,(GLclampf) 1.0f);
GL_Assert("Framebuffer::RenderTestSceneOnFBO() glClearColor" );
glReportError( glGetError() );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GL_Assert("Framebuffer::RenderTestSceneOnFBO() glClear" );
glReportError( glGetError() );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
[/b]
- See this image from gDebugger:
Any help would be greatly appreciated.
Dev Platform: NVIDIA 570 1280GB GDDR3, Windows 7 Ultimate, Microsoft Visual C++ 2010 Express, 3.3GHZ Intel Sandybridge
The issue:
(FBO 1 Color Attachment 0 above)
(FBO 2 Color Attachment 1 above)
Code used to create the attachments follows the tutorial above. We are attempting “render to texture”