Re: 2D textures with OpenGL and GLUT
Jason Dagit <[email protected]> Wed, 2 Jul 2014 09:20:21 -0700
| Newsgroups | gmane.comp.lang.haskell.hopengl |
|---|---|
| Message-ID | <CAJ-DSywCUF-xK=giAhoMC5Vau_1ZjSCzg_Fpt+bSX1S5Kapm2Q@mail.gmail.com> |
--===============0072907283140548337== Content-Type: multipart/alternative; boundary=047d7bf0da26d6b48304fd3844c0 --047d7bf0da26d6b48304fd3844c0 Content-Type: text/plain; charset=UTF-8 On Wed, Jul 2, 2014 at 8:06 AM, Elise Huard <[email protected]> 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 :) --047d7bf0da26d6b48304fd3844c0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail= _quote">On Wed, Jul 2, 2014 at 8:06 AM, Elise Huard <span dir=3D"ltr"><<= a href=3D"mailto:[email protected]" target=3D"_blank">hopengl@elisehuar= d.be</a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex">Hi,<br> I've been trying to get a texture mapped onto a circle.<br> I've pounded my head against this problem for a good while,<br> been reading lots of posts about how to do it in C,<br></blockquote><div><b= r></div><div>For folks who are experienced with low-level Haskell I actuall= y recommend they use the OpenGLRaw library as it matches C examples more cl= osely. Although, if you're a Haskell beginner that may just be an extra= hassle.</div> <div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8= ex;border-left:1px #ccc solid;padding-left:1ex"> reproduced those as much as possible,<br> but the best I get is a fairly distorted texture<br> =C2=A0(I'm working with a basic checkerboard as displayed in the Redboo= k4<br> examples of GLUT,<br> just to make sure I've got it right before moving on to actual images).= <br> Code here:<br> loading texture<br> <a href=3D"https://github.com/elisehuard/game-prototype/blob/master/src/Mai= n.hs#L90" target=3D"_blank">https://github.com/elisehuard/game-prototype/bl= ob/master/src/Main.hs#L90</a><br> using the texture in a circle (mapping):<br> <a href=3D"https://github.com/elisehuard/game-prototype/blob/master/src/Mai= n.hs#L130" target=3D"_blank">https://github.com/elisehuard/game-prototype/b= lob/master/src/Main.hs#L130</a></blockquote><div><br></div><div>It's ha= rd to say what's going on with all those unsafeCoerce in there.</div> <div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex= ;border-left:1px #ccc solid;padding-left:1ex"><br> <br> the result is here<br> <a href=3D"https://github.com/elisehuard/game-prototype/blob/master/images/= texture.jpg" target=3D"_blank">https://github.com/elisehuard/game-prototype= /blob/master/images/texture.jpg</a><br> <br> (as you can see, it is not a checkerboard)<br> My aim is to make a 2D game to start with, so the perspective is orthogonal= ,<br> I don't know if that helps.<br></blockquote><div><br></div><div>Lots of= things can be orthogonal, but I believe in this case that orthographic is = the word you want :)</div><div><br></div><div><br></div></div></div></div> --047d7bf0da26d6b48304fd3844c0-- --===============0072907283140548337== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ HOpenGL mailing list [email protected] http://www.haskell.org/mailman/listinfo/hopengl --===============0072907283140548337==--