glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, /* any old texture */);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
GLfloat color[4] = /* different each frame */;
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_CONSTANT)
The constant color seems to be cached the first time it it used, and ignores all GL_TEXTURE_ENV_COLOR calls after. I’ve tested this on someone else’s computer with older drivers and it works as expected (different color each frame), but I thought I’d ask here as a sanity check or to see if there are any work arounds.
It seems that this is a (new?) bug for GeForce FX level hardware only (at least with current 56.72 driver; tested on GeForce FX 5600 and GeForce FX 5900XT). Same program works on a GeForce4 MX with 56.72 driver and on a GeForce4 GO with older 45.23 driver…
Originally posted by Hampel:
[b]I am having the same problem.
It seems that this is a (new?) bug for GeForce FX level hardware only (at least with current 56.72 driver; tested on GeForce FX 5600 and GeForce FX 5900XT). Same program works on a GeForce4 MX with 56.72 driver and on a GeForce4 GO with older 45.23 driver…[/b]
It’s probably due to the way GeForce FX uses constants. If you look at the NVIDIA hardware Siggraph 2002 presentation by Bill Mark, it says:
512 constants or uniform parameters
Each constant counts as one instruction
So constants are immediates embedded or inlined in the fragment program.
They probably forgot to regenerate the fragment program used for the fixed function pipeline (or patch the instruction holding the constant) every time you change the GL_CONSTANT.
If you change the state in such a way that you force the program to be regenerated, it should work around your problem.
Rather than use a texture, it’s possible to avoid the problem by using register combiners. I was going to make a path for combiners anyway (for bump mapping), so it’s not that bad.
RATS! Does anyone know why this bug has slipped through the last 2 releases? I mean, hey, the constant color is fundamental to fixed function operation.