Forgive my newbie posting in the Advanced Forum, but it could be an advanced question…
I am writing a GPU-accelerated renderer inside Softimage XSI, and have a repeatable but inexplicable problem. The renderer does multiple passes (depth, screen-space ambient occlusion, environment maps, shadow maps, off-screen beauty pass to FBO with CSAA, final quad render to screen with gamma and motion blur).
Everything works fine when rendering directly to the screen. When batch rendering, there is an additional FBO wrapped around the whole process, and in that case the first render from cold, or from any interactive work inside the application, always throws an error and renders black.
The error is a GL_INVALID_OPERATION thrown by the very final glPopAttrib() call in the rendering sequence. I am checking this with a macro which loops while glError() != GL_ERROR_NONE which is placed after every single GL or GL-related call in the code, so it’s definitely this function and this function alone.
If I immediately hit the RENDER button again without having done any interactive manipulation in the app to cause other GL stuff to happen, it renders fine. Similarly an off-screen batch render results in one black frame (and error) and the rest just fine.
The docs, of course, say that the only way that glPopAttrib() can throw a GL_INVALID_OPERATION is if called between glBegin/End, which is certainly not the case (I have traced the code paths in great detail).
If anyone has any idea why this is happening, or suggest any tools which might allow me to work it out myself, please advise.
The system is as follows:
Dell Precision M6300 laptop with Quadro FX1600M
Windows Vista Ultimate (32-bit)
nVidia ForceWare 156.20 drivers
Cg 188.8.131.52 for shading
Softimage XSI 6.5
Visual Studio 2005 SP1
Many thanks in advance.