Opengl and Haskell GLdouble/GLfloat vs. Double/Float

I am going to be doing a lot of opengl stuff in haskell and so far one thing has irked me. Why does haskell keep the GLFloat and GL types and not just the Haskell types. -- Berlin Brown [berlin dot brown at gmail dot com] http://botspiritcompany.com/botlist/?

bbrown wrote:
I am going to be doing a lot of opengl stuff in haskell and so far one thing has irked me. Why does haskell keep the GLFloat and GL types and not just the Haskell types.
It mirrors the C API in doing so. I assume that this is because, in principle a system might exist where the graphics card (and hence, openGL library) used different-precision numbers to the CPU. Perhaps 32bit card on a 64bit machine gives you 32bit GLints even though you have 64 bit ints? I don't know how often (if ever) this happens in practice. Certainly GLfloat, GLdouble, GLint are members of all the type classes you would hope them to be and they are no less convenient to use. Jules

On 9/28/07, Jules Bean
Certainly GLfloat, GLdouble, GLint are members of all the type classes you would hope them to be and they are no less convenient to use.
And so, if you need it, you can always coerce between the GL and the "standard" Haskell types by using the general coercion functions: 'fromIntegral' and 'realToFrac'. Bas
participants (3)
-
Bas van Dijk
-
bbrown
-
Jules Bean