Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Wrong faces displaying gDebugger(FBO/CubeMap)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 shwasasin   Members   -  Reputation: 482

Like
0Likes
Like

Posted 11 January 2013 - 10:15 PM

Hey Folks,

For the last few weeks I've been working on omni-directional shadow-mapping for my game. I've noticed that gDebugger is showing all six faces of my FBO CubeMap as the exact same texture data, even though I have verified that each camera direction is set up correctly and working normally. I use FBO's (2d) throughout my game for lighting, cartoon edging, as well as post-fx so I'm fairly confident it's implemented okay (though there could be something wrong), no framebuffer status errors have occurred and gDebugger hasn't tripped with any errors so I'm at a loss. I've even tried attaching each face as a separate color attachment then using glDrawBuffer to activate each one as I run through my 6 rendering passes and that has produced the same results.

 

I am targeting OpenGL 2.0, so I cannot use FBO Layering/GeoShaders, so I was wondering if anyone has any pointers on the subject? Is there any settings that if (not)set will copy/render the scene to all 6 faces? I'm more than happy to post some code (specifics would be appreciated only because the code is scattered through numerous files). I have to admit it's pretty much the same as every post I've seen on gd.net about fbo's/cube maps (although I seem to be missing the special sauce and cannot see it). I've tested this with an Intel HD Graphics 4000, NVidia 660M (Optimus technology) both of which produce this issue so it's definitely something I'm (not)doing.

 

Any suggestions are appreciated. Thanks!



Sponsor:

#2 shwasasin   Members   -  Reputation: 482

Like
0Likes
Like

Posted 12 January 2013 - 07:10 PM

Well after spending all day looking at this issue and drinking wwaayy too much coffee, I solved the issue and wanted to share. As I added FBO CubeMap support to my game, I reduced the number of glBindFramebufferEXT calls by removing the call to 0 after completing each FBO render. So in the case of CubeMaps, I instead attached the CubeMap side, then rendered again. While I admit I haven't read the OGL Spec thoroughly enough with regards to FBO's, this makes a difference and the call to 0 somehow is the sauce making each side render correctly.

 

I wrote a quick example of my problem and solution in the hopes this helps others. Have a good one!

 

Bad:

 

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID );
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texDesc.nameID, 0);
// Render Scene Here
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, texDesc.nameID, 0);
// Render Scene Here
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 
Good:
// Face 0
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID );
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texDesc.nameID, 0);
// Render Scene Here
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 
// Face 1
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID );
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, texDesc.nameID, 0);
// Render Scene Here
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS