-
OGL ignores glColor4f
Hello,
I tried to put the line :
glColor4f(1.0,0.0,0.0,0.9);
just after:
glBegin(GL_QUADS);
But still the quades are white.. WHY????
Should I glEnable something?
I would be happy to get any ideas
Cheers,
Libby
-
Super Moderator
OpenGL Guru
Re: OGL ignores glColor4f
Do you have texturing enabled?
Bad texture is rendered white.
Do you have lighting enabled, this may be undermining your efforts.
-
Re: OGL ignores glColor4f
Thanks a lot,
But......
Now I comment out the line:
glEnable(GL_LIGHTING);
And it does display the colors, but it doesn't display any light.
How can I have color AND light?
Libby
-
Re: OGL ignores glColor4f
Hi Libby,
Enable GL_COLOR_MATERIAL, this uses your calls of glColor to set the material properties. Otherwise you will need to set up materials using glMaterial. For example:
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT, GL_DIFFUSE);
glColor4f(1, 0, 0, 1);
is the same as:
float diff[] = {1, 0, 0, 1};
glEnable(GL_LIGHTING);
glMaterialfv(GL_FRONT, GL_DIFFUSE, diff);
jimmi
-
Member
Regular Contributor
Re: OGL ignores glColor4f
Once you enable lighting you have two options to ensure your colour shows properly.
1) Use glMaterial*() to specify colours.
2) Use glEnable(GL_COLOR_MATERIAL) and glColorMaterial*(). Then your glColor*() calls will work.
-
Re: OGL ignores glColor4f
Thanks Jimmie, You're a genious! You made my day, now I can go home!
-
Re: OGL ignores glColor4f
And thanks also to Furrage!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules