PDA

View Full Version : creting 3d cube with custom vertexes

johnny_XP
07-21-2003, 02:35 AM
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....

GlutterFly
07-21-2003, 08:26 AM
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/

satan
07-21-2003, 03:41 PM
Originally posted by GlutterFly:
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

Just a note that the order is rgb.