Click to See Complete Forum and Search --> : colour triangle


joeybird
February 27th, 2005, 03:13 PM
im trying to learn how to light up/colour in 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
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, m->V);

glBegin(GL_TRIANGLES);

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);

glArrayElement(f->v1);
glColor3f(1.0, 1.0, 0.0);
glArrayElement(f->v2);
glColor3f(1.0, 1.0, 0.0);
glArrayElement(f->v3);
glColor3f(1.0, 1.0, 0.0);





}

glEnd();

glEnableClientState(GL_VERTEX_ARRAY);

does any one know where im going wrong?

thanx
joeybird

Elementer
February 28th, 2005, 05:09 AM
Hi,
why you enable two times GL_VERTEX_ARRAY ? What you see ? What's the problem you get ? "Don't work" is insufficient, you must speficy more details, we aren't wizard. :D

Cheers :)