[HOpenGL] 2D textures with OpenGL and GLUT

Elise Huard hopengl at elisehuard.be
Wed Jul 2 15:06:39 UTC 2014


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, 
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

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.

This may be due to my being a noob with things OpenGL - 
I hope anyone can help me solve this, textures are a pretty important part.

Thank you,



More information about the HOpenGL mailing list