NVidia GeForce2/4/FX flickering

Hi everyone,

I was wondering if anyone would have some idea about the following problem :

I’ve got a bunch of objects, some of which use vertex colors, some of the don’t. On ATI Radeon 9700 everything is fine. When testing on GeForce2/4/FX, I’ve got weird color flickering happening on some of the objects that do not use vertex colors.

I’ve checked everything I could think of :

  • when I disable completely the use of vertex colors, the flickering goes away.

  • when I force the current color (using glColor3f), just before pushing the triangles of the non-VC objects (the real color setup is done many cycle before, it is part of a complex shader setup), the flickering goes away and the color is the constant color given.

  • when I disable texturing, the flickering is still here…

The ‘patch’ I managed to find out, is to call the following code just before pushing the triangles to the card :

float color[4];
glGetFloatv(GL_CURRENT_COLOR, color);
glColor4fv(color);

That fixes the flickering of all GeForce boards… I can’t see any logical explanation of this to work, as, virtually, he preceding code should result as a logical NOP…

Did anyone encounter this situation, or have an explanation ?

BTW, I’m using 45.23 drivers, I’ve checked with older drivers, the same problem happened…

Thanks,
Nicolas.

I don´t really understand what you are doing.
Either you have vertex-colors enabled, than you have to specify a color (and white, if you don´t want it to be colored), or you have vertex-colors disabled.

If you have vertex-colors enabled, but don´t specify a color for every vertex, then the last specified color gets used. So, if you are sorting your objects differently each frame, this “last” color can change and you get flickering.

But certainly you know that.

So, what do you mean exactly, when you say you have colors enabled, but some objects don´t use them?

Jan.

Hmm, I thought that my explanation may be confusing…

My scene contains two sets of objects, in one set (SET1), all objects have vertex colors (VC), in the other set (SET2), objects don’t have VC, they have fixed flat colors.

I only mention the two sets as if I only keep one of them in the scene, everything works fine. The rendered objects are not sorted according to their VC state. I mean I can render 2 objects having VC, then 1 not having VC, then 1 having VC, etc.

The SET1 of objects with VC enabled works fine (no flickering).

In the SET2 of objects without VC, some (not all) objects do not get their constant color right. These objects have some color that changes according to the camera position & orientation(*).

My rendering code for objects of SET2 looks like this :

glColor3fv( niceColorToUse )

/* complex OpenGL setup that never calls glColor (I’ve triple checked) again, and that never enables VCarray which is really disabled /
/
… */

glDrawElements(…)

With this code, some objects flicker.

When I change the code to have :

glColor3fv( niceColorToUse )

/* complex OpenGL setup that never calls glColor (I’ve triple checked) again, and that never enables VCarray which is really disabled /
/
… */

glColor3f(1,0,0)
glDrawElements(…)

The objects flicker no more, and are all red, like expected.

So I’ve got the nasty idea of trying :

glColor3fv( niceColorToUse )

/* complex OpenGL setup that never calls glColor (I’ve triple checked) again, and that never enables VCarray which is really disabled /
/
… */

float color[4];
glGetFloatv(GL_CURRENT_COLOR, color);
/* the ‘color’ returned is always equal to ‘niceColorToUse’ */
glColor4fv(color);

glDrawElements(…)

And this fixes all my problems…

(*) I suppose that my flickering is due to some rendering state setup by a previously rendered object - which would explain the camera position dependant flickering… but all this sounds like a driver bug to me !

Hope I’ve managed to make myself more clear !?

Nicolas.

Now it´s clearer to me.
However, i cannot think of anything, that could cause this.
The only thing i would do in your position, would be to put the glColor3f (niceColor) directly before the glDrawElements call, to see, if it then uses the right color.
If yes, it has to be something in the “complex OpenGL setup” code :wink:

You said, that if you put the glColor3f (1,0,0) call directly before the glDrawElements call, then everything gets red, so i really think it´s a bug in the code you triple checked. I mean, everyone sometimes looks through a piece of code hundred times, but does not find the error.

Good luck.
Jan.

Yep, I very much agree with you …

That’s what I thought myself before thinking about calling ‘glGetFloatv(GL_CURRENT_COLOR, …)’ which always gives my back the value of ‘niceColorToUse’… Ain’t that a proof that noone elsewhere is calling glColorXXX ?

anyway…

The only thing i could still imagine would be, that you have texturing enabled, and that the texture which is bound changes every frame.

This is what happened to me just 5 minutes ago. I wanted simple colored objects, without textures. When i set the color to be white, i got blue objects. When i set it to red, i got black objects. Then i discovered, that my skybox texture (which was mainly blue) was still enabled.

Could it be that?

Jan.

Thanks, I thought about it too - but I disabled every textures and the flickering was still there !.. Though I did not triple-check this one, I’m pretty confident that this is not my case ! I’ve been abused by this kinda bug too often … :stuck_out_tongue: