Search code examples
openglindices

GLubyte vs GLshort for Indices


Looking through documentation for vertex arrays in OpenGL, two of the most common memory types used for indices I found were GLubyte (GL_UNSIGNED_BYTE) and GLshort (GL_SHORT). I was wondering if there was any actual difference between using the two for indices

Thanks, Dragonwrenn


Solution

  • GL_UNSIGNED_BYTE is OK for models which have at most 256 vertices - that's really not many.

    GL_UNSIGNED_SHORT, taking 2 bytes, would limit you to 65536 vertices - still that's kind of few.

    I'd say the most common variant is GL_UNSIGNED_INT, as even 2 bytes may not be enough for mid-poly and high-poly models.