No more blue :(

When I use glColor4f(), I find I can set a vertexes color to have any levels of red or green, but I can’t set the level of blue or the alpha level. If I try to use color3f, I still can’t set the level of blue - an all-blue vertex gets rendered as black.

I’m not scaling the blue components down at all, so I wonder why I can’t set them?

Oddly enough, if I stop loading texture data for the other geometry (ie. remove calls to glTexImage2D), I’m able to make blue polygons again… I can’t for the life of me figure out what binding textures has to do with setting vertex colors…

[This message has been edited by Plato (edited 11-25-2002).]

My guess is that the textures are modulating with the colors.
That means that whenever you paint a color it is MIXED with the color of the last painted texture. (I seemed to have the same problem some time ago).
So, when your texture has an RGB of 255,255,0 it will MIX the color with bleu (0,0,255). The result is black ((2550),(2550),(0*255)) (This was not the modulating formula, this can be found here: http://www.3dlabs.com/support/developer/GLmanpages/gltexenv.htm )
The following line should solve the problem:
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);

What it does is tell the texture/color engine to REPLACE every newly painted texture/color INSTEAD of modulating it.

Also make sure you have DISABLED the textures before you start painting colors:
glDisable(GL_TEXTURE_2D);
Else it will try to map the texture on your pretty polygon, while you don’t want that.

Hope this helps, as I’m a n00bie myself and I’ve learned these things only last week.

yeah… i too think the same… i guess he is not disabling the texture before starting paint function. I guess that should help…

vijay.

Yup, both of those were required for the solution… I need to find a really good resource on state information. I’m programming out of the OpenGL superbible and I’ve found they don’t always explain the underlying state you leave openGL in when you make certain calls… The result is I have to go out and find posts by other people who have had the same problem, or advice on tutorial sites.