i have a question regarding the use of the glDrawElement routine.
I'd like to know how does OpenGL expects to have the vertices in the array passed as an argument :
- do i have to put all the X coordinates first, then all the Y coordinates, and finally the Z coordinates
- or do i need to write the three coordinates one after another for each point ?
I raise this question because i try to use glDrawElement and my app crashes on that particular call.
Do i fill the array correctly ? I'm not sure
Here is how i did:
I defined a point, then i allocate an array. I wanted to be able the access the coordinates as if it was in a matrix ( a coordinate on each line)
typedef float Point[3];
Point * reducedVerticesArray;
reducedVerticesArray = (Point*)calloc (ReducedPointsContained , 3*sizeof(float))
then i fill the array by picking some values in another array.
Here i can access every cell using reducedVerticesArray[j][k].
Then i call:
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, reducedVerticesArray);
glDrawElements(GL_POINTS, reducedVerticesArraySize, GL_UNSIGNED_INT, reducedVerticesArray);
glDisableClientState(GL_VERTEX_ARRAY);
and here it crashes (back to windows). I'm wondering what i did wrong ?
(i tried with &reducedVerticesArray[0][0], same result)
[edited by - zifox on June 2, 2004 6:02:22 PM]