<font face="verdana,sans-serif">Thank you both. I'll be sure to try these out.<br><br>As
a matter of fact, I _am_ using JuicyPixels. I didn't realize there was a
version on github which uses Vector. Thanks for letting me know.<br>
<br>Regards,<br> - clark</font><br><br><div class="gmail_quote">On Mon, Feb 6, 2012 at 5:55 PM, Jason Dagit <span dir="ltr"><<a href="mailto:dagitj@gmail.com">dagitj@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mon, Feb 6, 2012 at 12:00 PM, Clark Gaebel<br>
<<a href="mailto:cgaebel@csclub.uwaterloo.ca">cgaebel@csclub.uwaterloo.ca</a>> wrote:<br>
> Using the OpenGL package on Hackage, how do I load a texture from an array?<br>
<br>
</div>The answer will depend on a few things:<br>
* Which OpenGL package you use, for example OpenGL vs. OpenGLRaw<br>
* What type of 'array' you use.<br>
<br>
In the case of the OpenGL package you need to create a PixelData value<br>
and pass that on. You can find example code here:<br>
<a href="https://github.com/dagit/nehe-tuts/blob/447f5471f3e7fe07b44dc5d2d87c4a95be35ce75/lesson06.hs" target="_blank">https://github.com/dagit/nehe-tuts/blob/447f5471f3e7fe07b44dc5d2d87c4a95be35ce75/lesson06.hs</a><br>
<a href="https://github.com/dagit/nehe-tuts/blob/447f5471f3e7fe07b44dc5d2d87c4a95be35ce75/Util.hs" target="_blank">https://github.com/dagit/nehe-tuts/blob/447f5471f3e7fe07b44dc5d2d87c4a95be35ce75/Util.hs</a><br>
<div class="im"><br>
<br>
> In the red book[1], I see their code using glGenTextures and glBindTexture,<br>
> but I can't find these in the documentation. Are there different functions I<br>
> should be calling?<br>
<br>
</div>Yes. As you've noticed the API of the OpenGL package sometimes<br>
(often?) differs from that of the C OpenGL api. If that's what you're<br>
more familiar with then take a look at OpenGLRaw. Here is how to do<br>
the same thing as the previous two links but using OpenGLRaw:<br>
<a href="https://github.com/dagit/nehe-tuts/blob/master/lesson06.hs" target="_blank">https://github.com/dagit/nehe-tuts/blob/master/lesson06.hs</a><br>
<a href="https://github.com/dagit/nehe-tuts/blob/master/Util.hs" target="_blank">https://github.com/dagit/nehe-tuts/blob/master/Util.hs</a><br>
<br>
Instead of using Arrays as defined by Haskell98, I would recommend<br>
using something else like Data.Vector. The standard arrays must be<br>
converted to something else to work with OpenGL. Data.Vector on the<br>
other hand allows direct access to the pinned pointer and is thus<br>
suitable for use with OpenGL as is.<br>
<br>
Have you seen JuicyPixels? The version on hackage uses arrays, but the<br>
version in github uses vector. I'd recommend using the version from<br>
github. It's faster and it will be easier to pass the data to OpenGL:<br>
<a href="https://github.com/Twinside/Juicy.Pixels" target="_blank">https://github.com/Twinside/Juicy.Pixels</a><br>
<br>
<br>
Good luck!<br>
<span class="HOEnZb"><font color="#888888">Jason<br>
<br>
</font></span></blockquote></div><br>