[HOpenGL] 2D textures with OpenGL and GLUT

Jason Dagit dagitj at gmail.com
Wed Jul 2 16:20:21 UTC 2014


On Wed, Jul 2, 2014 at 8:06 AM, Elise Huard <hopengl at elisehuard.be> wrote:

> Hi,
> I've been trying to get a texture mapped onto a circle.
> I've pounded my head against this problem for a good while,
> been reading lots of posts about how to do it in C,
>

For folks who are experienced with low-level Haskell I actually recommend
they use the OpenGLRaw library as it matches C examples more closely.
Although, if you're a Haskell beginner that may just be an extra hassle.


> reproduced those as much as possible,
> but the best I get is a fairly distorted texture
>  (I'm working with a basic checkerboard as displayed in the Redbook4
> examples of GLUT,
> just to make sure I've got it right before moving on to actual images).
> Code here:
> loading texture
> https://github.com/elisehuard/game-prototype/blob/master/src/Main.hs#L90
> using the texture in a circle (mapping):
> https://github.com/elisehuard/game-prototype/blob/master/src/Main.hs#L130


It's hard to say what's going on with all those unsafeCoerce in there.


>
> the result is here
> https://github.com/elisehuard/game-prototype/blob/master/images/texture.jpg
>
> (as you can see, it is not a checkerboard)
> My aim is to make a 2D game to start with, so the perspective is
> orthogonal,
> I don't know if that helps.
>

Lots of things can be orthogonal, but I believe in this case that
orthographic is the word you want :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/hopengl/attachments/20140702/d17251a0/attachment.html>


More information about the HOpenGL mailing list