PDA

View Full Version : Color shading



09-11-2001, 04:19 AM
Hello All,

I am new to Opengl.

If i specify different color for each vertex of a polygon having 4 vertices and my shade model is GL_SMOOTH i would be getting a smooth color transformation effect.

To be more precise,

glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex2f(-150.0f,-150.0f);
glColor3f(0.0f,0.0f,0.0f);
glVertex2f(150.0f,-150.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex2f(150.0f,150.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex2f(-150.0f,150.0f);
glEnd();

I would get a Polygon of the above said area starting from the bottom with the color Black and smoothly progressing towards Blue color when it reaches the top.

Can i get this effect for a quadric(disk,cylinder...)object if so how can i do that ? Without lighting ?

Please help me to get this.

Thanks in Advance !

cyclone
09-11-2001, 06:36 AM
I don't think that is possible with gluQuadric funcs http://www.opengl.org/discussion_boards/ubb/frown.gif

But on another side, you can easily construct yourself various simples quadrics forms such as sphere or disk ...


@+
Cyclone