the code that defines the 5x5 grid, and the indices for a set of triangle strips;
float grid[] = { -2.f, 0.f, 2.f, -1.f, 0.f, 2.f, 0.f, 0.f, 2.f, 1.f, 0.f, 2.f, 2.f, 0.f, 2.f , -2.f, 0.f, 1.f, -1.f, 0.f, 1.f, 0.f, 0.f, 1.f, 1.f, 0.f, 1.f, 2.f, 0.f, 1.f , -2.f, 0.f, 0.f, -1.f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 2.f, 0.f, 0.f , -2.f, 0.f, -1.f, -1.f, 0.f, -1.f, 0.f, 0.f, -1.f, 1.f, 0.f, -1.f, 2.f, 0.f, -1.f , -2.f, 0.f, -2.f, -1.f, 0.f, -2.f, 0.f, 0.f, -2.f, 1.f, 0.f, -2.f, 2.f, 0.f, -2.f };unsigned short index[] = { 0, 5, 1, 6, 2, 7, 3, 8, 4, 9 , 5, 10, 6, 11, 7, 12, 8, 13, 9, 14 , 10, 15, 11, 16, 12, 17, 13, 18, 14, 19 , 15, 20, 16, 21, 17, 22, 18, 23, 19, 24 };
and the code to render;
glLoadIdentity(); // move the modelview matrix by 0.008 * the fine coords glTranslatef( 0.0f, -4.0f, ( 0.008f * ( float ) cam.fine_y ) * -1 ); glRotatef( angle, 1.f, 0.f, 0.f); // render the vertices in strips, which don't change their // relationships with each other. glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glDrawRangeElements( GL_TRIANGLE_STRIP, 0, 9, 14, GL_UNSIGNED_SHORT, index );
The "angle" variable is updated each frame, in an attempt to make sure I'm not looking in the wrong direction.
I've tried glDrawElements, glDrawRangeElements, glMultiDrawElements and glDrawArray, all with no success. I get the feeling I should be using glMultiDrawArrays, but if I've done the above wrong, it would really help for someone to point out which value/variable should actually be used.
I know that the screen is updating successfully, as I can get the clear colour to change during runtime.
Many thanks in advance.