Hi guys, a little help required with glDrawElements().
I can't for the life of me get it to draw anything, heres some code I am using
In the opengl red book it states that the type argument for glDrawElements() should be GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT or GL_UNSIGNED_INT.Code:void display( void ) { GLuint indices[] = { 50, 50, 50, 70, 70, 70, 70, 50 }; glClear( GL_COLOR_BUFFER_BIT ); glPushMatrix(); glColor3f( 1.0, 1.0, 1.0 ); glEnableClientState( GL_VERTEX_ARRAY ); glVertexPointer( 2, GL_INT, 0, indices ); glDrawElements( GL_POLYGON, 8, GL_UNSIGNED_INT, indices ); glDisableClientState( GL_VERTEX_ARRAY ); glPopMatrix(); glutSwapBuffers(); }
However it also states that the type argument for glVertexPointer() should be GL_SHORT, GL_INT, GL_FLOAT or GL_DOUBLE. No unsigned type!!!
So, do you not need glVertexPointer() when using glDrawElements()? I tried it and that didn't work either.
Any comments would be great.
![]()



LinkBack URL
About LinkBacks



