Results 1 to 4 of 4

Thread: Difference between GLvoid and void

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2008
    Posts
    13

    Difference between GLvoid and void

    Hey people,

    there's something I'm confused about. Why are there GL... datatypes? Regarding to the gl.h, all these datatypes are just typedefs of the "normal" types, like void, bool, int ect.

    So, where is the difference? Are the GL datatypes stored in the Graphic Memory instead of the RAM?

    Cya,
    Shelling

  2. #2
    Senior Member Regular Contributor
    Join Date
    Aug 2007
    Location
    USA
    Posts
    243

    Re: Difference between GLvoid and void

    This is to maintain portability across platforms. For example, a GLfloat must be 32 bits minimum, and so it might be typedef'd differently on a different platform to ensure this.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jan 2004
    Posts
    314

    Re: Difference between GLvoid and void

    HexCat is right, although I would rephrase that 'minimum' stuff. Normal C/C++ types are defined with a minimum word size defined by the compiler.
    Compilers of 15 years ago might well have defined an int as 16-bits, whereas it's usually a 32-bit now, and now that 64-bit CPUs are becoming common the defaults may well change again.
    However OpenGL's expected word sizes are exact. The link libraries and drivers expect certain sizes because they are not recompiled when the application is compiled, so the application must use the correct sizes. That's what the GL... types are for.

    Of course a void does not have any storage at all, so why a GLvoid would be necessary is anyone's guess. Since it can appear anywhere and not just in front of a function (returning nothing), my guess is that it's there merely for consistency.

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2011
    Location
    Fortaleza, CE
    Posts
    1

    Re: Difference between GLvoid and void

    According to the Red Book:

    "Finally, OpenGL defines the type of GLvoid. This is most often used for OpenGL commands that accept pointers to array of values."
    [OpenGL Programming Guide, Third Edition (OpenGL V1.2) Page 9.]

    I hope this helps.
    Vasconcelos, Fabiano
    Programming Student [C/C++]
    Using Linux Ubuntu & GNU GCC
    IDE: NetBeans


Similar Threads

  1. GLvoid
    By Sidney in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-10-2015, 01:34 PM
  2. Converting an int to const GLvoid
    By Bobalandi in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 02-29-2008, 08:54 PM
  3. Origin of "GLvoid"
    By Paul Martz in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 09-05-2005, 08:49 AM
  4. GLvoid
    By marcel in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 12-09-2003, 10:02 AM
  5. OT: C++inline void or void
    By DaViper in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 01-31-2001, 06:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean