PDA

View Full Version : FBO issue: glViewport set, only draws one part



OpenGL Developer
04-21-2012, 12:44 AM
Note: this message is cross-posted in OpenGL coding: Advanced. Please help, it's a [B]stumper

I have only ever been able to get FBOs working when they are 512x512 or display WxH, mainly because other sized FBOs have unpredictable coordinate systems or unpredictably "clipped" results. Using just the two sizes I mentioned, everything has been working just fine until recently I hit another wall:

I am using a variety of FBOs in an application, and I reach a point in the rendering pipeline where FBOs start breaking down, where four particular FBOs end up clipped showing only the lower right quarter (it's not exactly a quarter). Or, it will draw only the bottom half. While it tastes like undefined behavior, it has some predictability to which quadrant, for instance. It's all the same FBO, but there are four operations on this same fbo in succession, and they all seem meshed together, like someone shuffled parts of them.

Attempted solutions:

- I tried solving this with glFinish() added to the end of each of the four successive calls, but this made no difference.

- Someone said "hey, your glViewport must be messed up" but that's not possible because the same code and FBOs are used elsewhere on the screen at the same time with no issue. I used glViewport(0,0,fbo->w,fbo->h), which are 512x512 or screen WxH.

The same rendering code that is between the fbo bind/unbind is used elsewhere without issue.

- Switching the FBOs between various "flavors" (depth, depth stencil, depth color, color) does not affect it.
- Changing the uniqueness does not affect it (using a different FBO id that is used less frequently)...
- Changing FBO size only changes how much is drawn correctly, and in the opposite way you would think (bigger=more clipped).
- Turning off scissor test doesn't fix it.
- Clearing the depth buffer doesn't matter.
- Muffing with "near/far" values makes no difference.

ZbuffeR
04-21-2012, 12:56 AM
Do you reproduce the same problems on different GL implementations ?
Nvidia, AMD, Intel, ... ?

Alfonse Reinheart
04-21-2012, 01:20 AM
this message is cross-posted in OpenGL coding: Advanced

Why did you do that?

BionicBytes
04-21-2012, 07:32 AM
Are you using ES or desktop OGL?
Are your framebuffers using render buffers or texture attachments?

OpenGL Developer
04-21-2012, 08:56 AM
ZbuffeR: working on NVIDIA, I believe it also happens on my ATI but don't have time to test right now.

Alfonse Reinheart: Because I need help and it's not clear if this is a newb or not question.

BionicBytes: Desktop OGL 3.1 compat context. The framebuffers are "Color Depth" (Color texture attachment, Depth attachment) though I've also tried just "Color" (Color texture attachment) and "Depth Stencil" (Color0, Depthstencil) as I indicated.

The textures are mipmapped when I unbind. Like I said, it works in the same application elsewhere, just not in this one part of the render pipeline, though I can see no difference in the client settings between one and another, though there may be some subtle setting enabled or something, but I have no idea what it is..