PDA

View Full Version : use of vertex array need an exe¨mple!!!!!



defiopeon
04-11-2003, 04:14 AM
plz help me i don't found any sources showing how to use vertex array !!!!
i need your help:
a link,line codes r anythuing that can explain clearly how to use this fonction

LordOfTheUniverse
04-11-2003, 04:37 AM
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, Verts);
glNormalPointer(GL_FLOAT, 0, Normals);
glTexCoordPointer(2, GL_FLOAT, 0, Coords);
glColor4f ( 1,1,1,1 );
glLockArraysEXT(0, (GLsizei)VertsNUM *3);
glDrawElements(GL_TRIANGLES, FacesNUM*3, GL_UNSIGNED_INT, Faces);
glUnlockArraysEXT();

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

Verts is a pointer to an array of float[3], as well is Normals, Coords to float[2] and faces defines an array of int[3], defines triangles as entries in Verts; VertsNUM is a number of vertices, but remember that it is three times more entries than verices.