[Haskell-cafe] Loading a texture in OpenGL
cgaebel at csclub.uwaterloo.ca
Tue Feb 7 01:07:05 CET 2012
Thank you both. I'll be sure to try these out.
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.
On Mon, Feb 6, 2012 at 5:55 PM, Jason Dagit <dagitj at gmail.com> wrote:
> On Mon, Feb 6, 2012 at 12:00 PM, Clark Gaebel
> <cgaebel at csclub.uwaterloo.ca> wrote:
> > Using the OpenGL package on Hackage, how do I load a texture from an
> The answer will depend on a few things:
> * Which OpenGL package you use, for example OpenGL vs. OpenGLRaw
> * What type of 'array' you use.
> In the case of the OpenGL package you need to create a PixelData value
> and pass that on. You can find example code here:
> > In the red book, I see their code using glGenTextures and
> > but I can't find these in the documentation. Are there different
> functions I
> > should be calling?
> Yes. As you've noticed the API of the OpenGL package sometimes
> (often?) differs from that of the C OpenGL api. If that's what you're
> more familiar with then take a look at OpenGLRaw. Here is how to do
> the same thing as the previous two links but using OpenGLRaw:
> Instead of using Arrays as defined by Haskell98, I would recommend
> using something else like Data.Vector. The standard arrays must be
> converted to something else to work with OpenGL. Data.Vector on the
> other hand allows direct access to the pinned pointer and is thus
> suitable for use with OpenGL as is.
> Have you seen JuicyPixels? The version on hackage uses arrays, but the
> version in github uses vector. I'd recommend using the version from
> github. It's faster and it will be easier to pass the data to OpenGL:
> Good luck!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe