verticies = new cVertex[WIDTH * HEIGHT];
//initialize verticies here
ext->glGenBuffers( 1, &vertID );
ext->glBindBuffer( GL_ARRAY_BUFFER, vertID );
ext->glBufferData( GL_ARRAY_BUFFER,
( (WIDTH*HEIGHT) * sizeof(cVertex) ),
verticies,
GL_STATIC_DRAW );
indicies = new GLuint[INDEX_ARRAY_SIZE];
//initialize indicies here
ext->glGenBuffers( 1, &indID );
ext->glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, indID );
ext->glBufferData( GL_ELEMENT_ARRAY_BUFFER,
INDEX_ARRAY_SIZE * sizeof(GLuint),
indicies,
GL_STATIC_DRAW );
Rendering:
ext->glBindBuffer( GL_ARRAY_BUFFER, vertID );
ext->glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, indID );
glEnableClientState( GL_VERTEX_ARRAY );
glVertexPointer( 3, GL_FLOAT, 0, 0 );
glDrawElements( GL_TRIANGLE_STRIP, INDEX_ARRAY_SIZE, GL_UNSIGNED_INT, 0 );
glDisableClientState( GL_VERTEX_ARRAY );
ext->glBindBuffer( GL_ARRAY_BUFFER, 0 );
ext->glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 );
Im initializing the index array with degenerate triangles to draw the whole mesh in one call to glDrawElements. I know the array is correct since Ive printed it out a few times to make sure. Heres a screenshot of what is happening: http://img172.imageshack.us/img172/1703/examplejh9.jpg Anyone have an idea? If I replace GL_UNSIGNED_INT with another option I notice that the lines going back to the 0,0 spot in the screenshot happen much sooner, which leads me to believe that I have some sizing wrong in initialization.