FBO depth and color to texture

Started by
12 comments, last by V-man 12 years, 9 months ago
Hey bluntman,

I'm trying to run gDEBugger - but this tool is new to me. It took me an hour just to deduce that the two versions 5.8 and 6.0 are vastly different. Each present their own challenges. The 5.8 version has trouble finding my source code files when I run it on my debug build. Not surprising I suppose as it doesn't know where to look.

The other version integrates directly into Vs2010 which is great (and terrible), except for the fact that AMD has had its mits on it and kernel mode is disabled for non-amd gpu's. I'm hazy on the details but I think I can live without kernel debugging, but to complicate matters just a little further, this version does not feature any break-on-error. I have no idea why not. Probably because some new features supersede the functionality, but reading through their manual has brought me no closer to figuring out how to work the damn thing. One of the errors detected by the 5.8 gdebugger is a bind texture error. Not surprising as the bind call has a texture id of several thousand.

Tracking this in the 6.0 version sends me to some source that cannot be opened. When I instead step through every line I see that after unbinding the FBO when setting it up for the first time, I end up in code I cannot see and there at least one improper bind occurs...

I have to figure this out... Thanks for the continued help thou bluntman... Be blunt ;)

Gazoo
Advertisement
I haven't used the integrated version of gDEbugger, but I am surprised you are having problems with the stand alone, all I remember having to do was point at my EXE and set the working directory and all features (including code browsing) just worked. You don't have a non standard output directories or any other non-standard project set up do you? Even then, all it should need is the pdb and you should get code browsing..
Ok - After creating an individual project and messing about a bit with the FBO I've become a little more wise. I'm not sure if any of the stuff I'm about to say hasn't been mentioned in other FBO tutorials, but I've missed them so I'm sure it cannot hurt to cover again:

  • If no depth attachment is made - seems to be regardless of whether to renderbuffer or otherwise (glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, glsl_tex_depthbuffer, 0);) then the resulting render to the FBO will not produce a depth-tested image. Even if GL_DEPTH_TEST is enabled. It also doesn't seem to matter whether or not you actually attach the depth extention through drawbuffers... O_o go figure. Perhaps OpenGL just always renders depth if it's extension is attached?
  • glDrawBuffers only likes color attachments, such as GL_COLOR_ATTACHMENT0_EXT, and not GL_DEPTH_ATTACHMENT_EXT...
  • Detaching mid-render (glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)) causes OpenGL errors... Best to set up each individual scene. Modelview and projection can propogate across multiple renders.

Especially the last bullet point seemed to be what was causing me grief. When I had various things glEnabled, then detaching the FBO seemed to make OpenGL grumpy. But irregardless, it seemed that setting up isolated renders fixed the issue I was having... There are still a few things i am wondering about.

I keep reading that it's faster to attach and detach textures rather than switching between different FBO's. But what about switching between color attachment points, and de/re -attaching to the same color attachment? I am rendering two passes and into two separate color textures.

Just thought I'd ask if someone had any experience with this kind of thing...
"If no depth attachment is made - seems to be regardless of whether to renderbuffer ......."
If no depth buffer is present, what did you expect to happen?

"glDrawBuffers only likes color attachments, such as GL_COLOR_ATTACHMENT0_EXT, and not GL_DEPTH_ATTACHMENT_EXT..."
Yup, look at http://www.opengl.org/sdk/docs/man4/
and go to DrawBuffers

"Detaching mid-render (glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)) causes OpenGL errors... Best to set up each individual scene. Modelview and projection can propogate across multiple renders."

Did you attach a color buffer to ATTACHMENT 0? Did you call glDrawBuffers to let GL there was a change in configuration?
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement