colouring triangles

im trying to learn how to light up a triangle strip on a polygon mesh, and i cant seem to get it to work. im using the following…

void faceStrip (CGPolyMesh *m, int faceIndex, int edgeIndex)

int i;
CGFaceVertex *f;
RGBAColor *cptr;

// setup vertex array
glVertexPointer(3, GL_FLOAT, 0, m->V);


for (f=m->Fv, i=0 ; i<m->noofFaces ; i++, f++)cptr = m->C + i; // i’th face colour in colour array
glColor3f(cptr->r, cptr->g, cptr->b);

		glColor3f(1.0, 1.0, 0.0);
		glColor3f(1.0, 1.0, 0.0);
		glColor3f(1.0, 1.0, 0.0);





does any one know where im going wrong?



where i say light i mean colour in red for example

If you’ve got lighting enabled, glColor does nothing, you must manipulate the colour of the object by changing its material properties.
However, you can still use glColor by using colormaterial:-


This will make OpenGL change the ambient and diffuse attributes of the current material whenever you use glColor or equivalent.

i dont mean light up i mean colour in red a triangle stip polygon

Why do you call glColor3f(1.0, 1.0, 0.0) between your vertices? You would get only yellow polygons this way, because AFAIK with flat shading the color of the last vertex determines the color of the whole polygon. Or you might get color interpolation between your color and yellow if you activate smooth shading.

You need to post your question as an OpenGL question ONCE and you should stick to the beginners forum for now.

If you don’t get a reply in one thread don’t post another two.

Moving thread to beginners forum.