PDA

View Full Version : glIndexPointers and glDrawRangeElements type param



now
08-18-2004, 10:31 AM
Just out of curiosity, is there a reason why glIndexPointer only accepts GL_UNSIGNED_BYTE, GL_SHORT, GL_INT, GL_FLOAT and GL_DOUBLE while glDrawRangeElements only wants GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT and GL_UNSIGNED_INT?
Of course everything is cleary stated in the spec but nevertheless I found it a bit surprising and it's probably easy to overlook when you are sitting in front of a black screen trying to find out why nothing is drawn. (not that this would ever happen to me :rolleyes: )

Bob
08-19-2004, 12:28 AM
The types for glIndexPointer and glDrawRangeElements are completely unrelated, and there is no reason why they should accept the same set of types. In glDrawRangeElements, you specify the type of the values used as array index in the vertex arrays. glIndexPointer sets the color index pointer; in other words, it is the glColorPointer equivalent for paletted color modes (8-bit index colors vs 16/24/32-bit RGB(A) colors).

now
08-19-2004, 02:23 AM
Aaaaahh, okay, so you specifiy a color palette with glIndexPointer, now the types make sense.
I just used glIndexPointer as an 'equivalent' of the other gl*Pointer but instead of setting up a vertex buffer I thought you can use it for the index buffer.
Btw someone knows where to find a good slim documentation for OpenGL similiar to the D3D helpfile? I only found an ancient GL helpfile where the gl*Pointer functions are still marked as extensions with an additional parameter.
Oh and thanks for the clarification probably I would have never found this out by myself because everything worked and no error codes where thrown. So expect more 'noobish' questions from me in the future.

ZbuffeR
08-19-2004, 03:37 AM
For online OpenGL reference doc I frequently use the pyOpenGL one, they describe the C bindings too, and does not seem outdated :
http://pyopengl.sourceforge.net/documentation/manual/

And of course the GL spec itself :
http://www.opengl.org/documentation/spec.html

now
08-20-2004, 02:29 AM
Thanks for the python docu link. I'll give it a try.