Thread: GLfloat vs float, GLvoid vs void...

  1. #1

    GLfloat vs float, GLvoid vs void...

    what is the difference/advantage to using things like GLfloat, GLvoid, GLuint..... as apposed to the regular primitive types: float, void, ....

    is there any difference???

  2. #2
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    GLfloat, GLdouble, etc. are more portable.

    In C and C++, there is nothing that says a float has to be a certain number of bytes, same goes for an int, bool, double, etc.

    In the OpenGL standard, GLfloat is 4 bytes, GLdouble is 8 bytes, a GLboolean is 1 byte, etc.

    Here, you want your code to be guaranteed to use the same amount of space for these datatypes, so you should use the GL datatypes whenever you can.

  3. #3
    Has a Masters in B.S.
    Join Date
    Aug 2001
    i will refer you to page 9 of the OpenGL 1.4 Specification.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. LNK2001 ERROR!!! need help
    By lifeafterdeath in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2008, 05:05 PM
  2. ChangeDisplaySettings - Blank?
    By Tonto in forum Windows Programming
    Replies: 13
    Last Post: 12-26-2006, 04:17 PM
  3. help me
    By warthog89 in forum C Programming
    Replies: 11
    Last Post: 09-30-2006, 08:17 AM
  4. My attempt at lighting math
    By psychopath in forum Game Programming
    Replies: 11
    Last Post: 03-30-2005, 12:35 AM
  5. Display list not displaying?
    By psychopath in forum Game Programming
    Replies: 5
    Last Post: 09-19-2004, 06:47 PM