FBO issue: glViewport set, only draws one part

Note: this message is cross-posted in OpenGL coding: Advanced. [b]Please help, it’s a 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.

You have a bug in your code. Whittle your code down to a Short, Self Contained, Correct (Compilable), Example. Otherwise there’s not much that can be done.

I’m sorry but no test case adequately reproduces the problem. Sometimes you cannot use that method, though it applies a majority of the time.

That’s where you should start: find out why sizes other than 512x512 don’t work for your FBOs. There is a mistake in your implementation behind it. Even if it doesn’t sovle your current issue, it would make the investigation easier.

Intel graphics card ? If you use FBO’s on them you’ll find they are hopelessly broken.