creting 3d cube with custom vertexes

Hi guys… I’m a beginer and need your help.
I want to draw a 3d cube. The color in each vertexe will be a color depending for a variable that i’m reading from a file. Don’t bother about this, just suppose that a want to set each vertex to a random color. How i can do that? I used e nested for loops for x,y and z codrinate and used the glVertex3f(x, y, z) in each (x,y,z) but that produces no result…
Thanks for any answers…

I get to field an easy one!

try glColor3f(float,float,float)

I think the order is:
(red channel, blue channel, green channel)
your float should be between 0.0f and 1.0f
glColor3f(0.0f,0.0f,0.0f) will yeild black as the color.
glColor3f(1.0f,1.0f,1.0f)will be white
and glColor3f(0.5f,0.5f,0.5f)will yeild a gray. good luck with that

for more help, visit tutorial two at http://nehe.gamedev.net/

Originally posted by GlutterFly:
[b]I get to field an easy one!

try glColor3f(float,float,float)

I think the order is:
(red channel, blue channel, green channel)
your float should be between 0.0f and 1.0f
[/b]

Just a note that the order is rgb.