Archived

This topic is now archived and is closed to further replies.

float vs GLfloat

This topic is 6166 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Heya...quick question for everyone: Whats the difference between straightforward variables & GLvariables? eg GLfloat, GLint, GLvoid etc... Are GLvariables stored on the gfx card for quick hardware access, or what? When should you use which? Cheers Catfish

Share this post


Link to post
Share on other sites
Well no difference at all.
Im not sure why they are there but it seems to me that Everyone has to make their own definitions of the standard variable types.

if you ever code ODBC, you will learn that there are SQLuint SQLTCHAR and so on..
and windows has it to BOOL just to name one

this code is taken from the top of gl.h:


typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef signed char GLbyte;
typedef short GLshort;
typedef int GLint;
typedef int GLsizei;
typedef unsigned char GLubyte;
typedef unsigned short GLushort;
typedef unsigned int GLuint;
typedef float GLfloat;
typedef float GLclampf;
typedef double GLdouble;
typedef double GLclampd;
typedef void GLvoid;


so a GLfloat is really notin'' but a simple 32bit float :D

Share this post


Link to post
Share on other sites
typedef float GLfloat;
It''s at the top of the opengl header.
It was just meant for those who wanted to use it.
So basically you can just use either and get the same result.
All depends on witch you think it more pretty. :D

Share this post


Link to post
Share on other sites
GL* types are for cross-plateform development. An int can be 16 or 32 bit long, depending on the OS. A GLint is ALWAYS 32 bit long, whatever your plateform is, which can be useful if you target several OS.

These GLstuff wasn''t created just for fun!

Share this post


Link to post
Share on other sites