PDA

View Full Version : Glfloat etc...



zzapatista
02-21-2001, 08:08 PM
could the declaration
static GLfloat vdata [12] [3]...
be ionterchangeable with the c++ command
static float vdata[12] [3]...?

or GLuint interchangeable with int?

j
02-21-2001, 08:11 PM
GLfloat is the same as float.
GLuint is the same as unsigned int.

Check the gl.h header file, all the GL data types are typedef'd near the top of it.

j

john
02-21-2001, 10:22 PM
well, not always.

sizeof(GLfloat) != sizeof(float) forall architectures

GLfloat is GUARANTEED to be 32 bits wide, because the opengl arb say it WILL be, and Lo, it is so.

but, all the C/C++ specification says is that

sizeof(char)<=sizeof(short int)<=sizeof(long int)

sizeof(float)<=sizeof(double)

(or, something to that effect), so that... char isn't ALWAYS 8 bits on ALL machines (some have 16bit characters), floats aren't always 32 bits (some are 64, or even 80bits...). it depends.

so, the answer is: no, it isn't interchangeable, but you can probably get away with it. perhaps.

cheers,
John