GLfloat vs float, GLvoid vs void...

This is a discussion on GLfloat vs float, GLvoid vs void... within the Game Programming forums, part of the General Programming Boards category; what is the difference/advantage to using things like GLfloat, GLvoid, GLuint..... as apposed to the regular primitive types: float, void, ...

  1. #1
    pro-grammin
    Guest

    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
    Posts
    1,078
    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
    Posts
    2,267
    i will refer you to page 9 of the OpenGL 1.4 Specification.

    http://www.opengl.org/developers/doc...4/glspec14.pdf
    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, 06: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, 09: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, 07:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21