glClear() and GL_AUX0

I’m writing an image to buffer GL_AUX0 and want it to stay there for the duration of my program. Whenever I call ‘glClear(GL_COLOR_BUFFER_BIT)’, however, I clear GL_AUX0, even when I preceed the glClear() call with ‘glDrawBuffer(GL_FRONT|GL_BACK)’ (have also tried ‘glDrawBuffer(~GL_AUX0)’). – Help!

glDrawBuffer doesn’t take a bitfield. It takes an enum.

GL_FRONT | GL_BACK doesn’t do what you think it will do. (At least I don’t think so, but I haven’t checked the enum values). “~GL_AUX0” also doesn’t do what you think it will do. Both may be errors, which would leave your old draw buffer state around.

If you call glDrawBuffer(GL_BACK), that should stop writing to AUX0.

And if you get weird behavior like this, please call glGetError(). We put this checking code into OpenGL for a reason.