Created
March 2, 2022 15:53
-
-
Save davawen/af1490ffb3bbcf9ddc0cbab82e9f27aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Takes a symbolic type constant and returns its size | |
/// Probably missing a few types but those were the most important | |
size_t get_sizeof_type(GLenum type) | |
{ | |
switch(type) | |
{ | |
case GL_BYTE: | |
case GL_UNSIGNED_BYTE: | |
return sizeof(GLbyte); | |
case GL_SHORT: | |
case GL_UNSIGNED_SHORT: | |
return sizeof(GLshort); | |
case GL_INT_2_10_10_10_REV: | |
case GL_INT: | |
case GL_UNSIGNED_INT_2_10_10_10_REV: | |
case GL_UNSIGNED_INT: | |
return sizeof(GLint); | |
case GL_FLOAT: | |
return sizeof(GLfloat); | |
case GL_DOUBLE: | |
return sizeof(GLdouble); | |
case GL_FIXED: | |
return sizeof(GLfixed); | |
case GL_HALF_FLOAT: | |
return sizeof(GLhalf); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very helpful, thanks!