[HOpenGL] 2D textures with OpenGL and GLUT
Jason Dagit
dagitj at gmail.com
Wed Jul 2 17:11:10 UTC 2014
On Wed, Jul 2, 2014 at 9:33 AM, Elise Huard <elise at jabberwocky.eu> wrote:
> Hi Jason,
> thanks for taking the time to answer.
> So trying to read between the lines:
> - do you have any _working_ examples of texture mapping with OpenGLRaw
> and low-level Haskell I could have a look at? (anything would help at
> this point)
>
I do. I converted some of the old nehe tutorials:
https://github.com/dagit/nehe-tuts
If you look through the history you can find examples that use a very very
old version of OpenGL (instead of OpenGLRaw). The OpenGL style in those
examples is old and no longer the recommended way. The examples use
immediate mode which is now deprecated in favor of shaders.
I think lesson 6 makes a cube and throws some textures on it. The lesson
numbers are meant to match these:
* http://nehe.gamedev.net/tutorial/lessons_01__05/22004/
* http://nehe.gamedev.net/tutorial/lessons_06__10/17010/
> - do you think the unsafeCoerce (which I borrowed from examples) that
> transform CpFloat to GLdouble might be the issue, or is this just a
> general stylistic comment?
>
Not just stylistic. As for correctness, I think the answer varies by
platform. Specifically, I think CFloat is not required to match GLdouble in
size (in fact, doubles should be expected to be twice as big). While both
types should correspond to IEEE 754 floats the bit width is very likely
different and that could easily cause the interpretation of the values to
go wonky. Imagine passing 64bits when only the first 32bits correspond to a
valid number or truncating a 64bit value to 32bits.
Which examples use unsafeCoerce for this? I'm just sort of curious so I can
recommend people not to use them :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/hopengl/attachments/20140702/55dad883/attachment.html>
More information about the HOpenGL
mailing list