float/double vs GLfloat/double

Post: #1
is there any reason to expect GLfloat/double ever being different from float and double.

like: when working with gl should i always use GL types for performance? is there a compatibility issue also?
Quote this message in a reply
Post: #2
I would recommend that you use GLfloat/GLdouble for any value that you will be passing to an OpenGL function. That way, if you ever port the application to another OS, you wont have to worry about it.

If you have a class/object that does not include any OpenGL headers, then just stick with float/double rather than including the headers just so that you can use GLfloat/GLdouble.
Quote this message in a reply
Post: #3
As I understand it, the advantage of GLtypes over the normal versions is that your code may be more portable. From the Redbook:

Quote:Note: Implementations of OpenGL have leeway in selecting which C data type to use to represent OpenGL data types. If you resolutely use the OpenGL defined data types throughout your application, you will avoid mismatched types when porting your code between different implementations.

[edit - eh, too late]
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #4
Using float and double rather than GLfloat and GLdouble is usually going to be OK. Although there's a possibility that on some future or past platform GLfloat might be a typedef of double and GLdouble might be a typedef of long double, I haven't seen that yet...

For the integer types, it's much more important that you use the appropriate typedef, as it does differ platform-to-platform whether the types like GLint, GLsizei are typedef'd from int, long, long long, &c.
Quote this message in a reply
Post: #5
the purpose of using glFloat, etc. is b/c between systems it has the same size in bytes. you don't have to worry about stuff like on one machine a float taking up 32 bytes and on another it taking 64.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  float FBO on iPhone (invalid operation error) Fenris 11 16,815 Jan 17, 2013 05:40 AM
Last Post: Fenris
  iPhone/iPad Audio Glitch - Double Hiss/Static reapz 2 7,129 Dec 8, 2010 06:22 PM
Last Post: reapz
  Best way to readback float pixels? kelvin 8 9,459 Feb 27, 2008 10:23 PM
Last Post: kelvin
  convert NSArray in float[] bonanza 6 12,612 Jun 25, 2007 10:33 AM
Last Post: TomorrowPlusX
  Double-Buffering with NSOpenGLView DesertPenguin 3 8,077 Aug 1, 2006 07:17 AM
Last Post: DesertPenguin