Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Glfloat etc...

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2001
    Posts
    19

    Glfloat etc...

    could the declaration
    static GLfloat vdata [12] [3]...
    be ionterchangeable with the c++ command
    static float vdata[12] [3]...?

    or GLuint interchangeable with int?

  2. #2
    Member Regular Contributor
    Join Date
    Jun 2000
    Location
    B.C., Canada
    Posts
    397

    Re: Glfloat etc...

    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

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Adelaide, South Australia, Australia
    Posts
    839

    Re: Glfloat etc...

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •