therealremi
02-11-2009, 10:14 AM
Hi,
I'm writing a code that is meant to be very portable and safe.
The problem that I encountered is that I see no safe way of matching C++ types with OpenGL types. For example, in C++ I store triangle indices as unsigned long integers. When I want to pass an array of them to OpenGL drawing function I need to supply OpenGL type identifier (e.g. GL_UNSIGNED_INT). How can I be sure that the size of OpenGL type GL_UNSIGNED_INT is equal to C++ unsigned long int?
I cannot simply do sizeof(GL_UNSIGNED_INT) because it's a number, not a typedef.
I'm writing a code that is meant to be very portable and safe.
The problem that I encountered is that I see no safe way of matching C++ types with OpenGL types. For example, in C++ I store triangle indices as unsigned long integers. When I want to pass an array of them to OpenGL drawing function I need to supply OpenGL type identifier (e.g. GL_UNSIGNED_INT). How can I be sure that the size of OpenGL type GL_UNSIGNED_INT is equal to C++ unsigned long int?
I cannot simply do sizeof(GL_UNSIGNED_INT) because it's a number, not a typedef.