PDA

View Full Version : Type aliases



Kopelrativ
02-15-2012, 01:16 PM
I had some code that used sizeof(GL_UNSIGNED_INT). But then I changed it to sizeof(GL_UNSIGNED_SHORT), but I couldn't get it to work. It took me a couple of hours to identify the reason.

I am not asking for help, just writing to get rid of my frustration. Hopefully someone will enjoy it.

McLeary
02-15-2012, 01:49 PM
Are you sure this was the only reason?

GL_UNSIGNED_INT is defined as 0x1405 and GL_UNSIGNED_SHORT as 0x1403, both are integers, so sizeof will return 4 for both cases.

overlay
02-15-2012, 03:44 PM
McLeary is right.

You are looking for sizeof(GLuint) and sizeof(GLushort).

Just read through GL/gl.h. It's that simple.