View Full Version : Color issues when drawing to FBO attached texture

04-19-2010, 05:42 AM
I am writing an app that each frame needs to draw over the content of the previous frame. The fastest and easiest way I have found to do this is to use FBO and render to a texture, then display the texture on a quad.

The problem is that if I change the current glColor, then the entire content drawn on the texture in previous frames blends it's color with the new glColor.
For example if I draw a quad with glColor3f(1.f, 0.f, 0.f) and several frames after that I change to glColor3f(0.f, 0.f, 1.f) to draw a triangle, the quad suddenly changes it's color to some middle value, while the triangle is drawn in solid blue.

Blending is enabled, but disabling it does not change this behaviour, neither does drawing with glColor4f(r,g,b,1.f).

Mac OS X 10.6.3, GF9400m

04-19-2010, 10:02 AM
You should always put a glcolor4f(1,1,1,1); right before "display the texture on a quad" to keep the original color. Or use a different texturing mode, avoiding the default GL_MODULATE to instead use a GL_REPLACE glTexEnv mode.