View Full Version : color
Hi
every thing in my scene appears to have be the same color as the floor - I'm not using texture mapping - how can I sort this out?
cheers
Platinum
11-17-2001, 02:08 PM
Try to have a look at
glColor3f()
it changes the color for all vertices drawn after this call
so for example to draw a nice rainbow triangle
glColor3f(1.0f, 0.0f, 0.0f)
glVertex2f(1.0f, 0.0f)
glColor3f(0.0f, 1.0f, 0.0f)
glVertex2f(-1.0f, 0.0f)
glColor3f(0.0f, 0.0f, 1.0f)
glVertex2f(0.0f, 1.0f)
Platinum
11-17-2001, 02:10 PM
I forgot to say that for that rainbow triangle, you should have smooth shading enabled(flat shading uses the color of the first or third vertex - sorry, not sure about that - for the whole triangle)
[This message has been edited by Platinum (edited 12-06-2001).]
I actually use glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, SurfaceColour);
lost hope
11-18-2001, 01:01 PM
If you are using material properties, such as you specified, then make sure that you have properly enabled lighting.
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.