Hello Claude,

My problem is everywhere hahaha. I haven't been able to do anything with textures, but those steps do sound like the way to go. Maybe if you could explain them a little bit more I'll do it, or maybe with the examples you mentioned I'll get it myself. 

When you say 'load' is the hardest: In all the tutorials or codes I've seen, I haven't been able to find any function which has that kind of signature, but I really have no idea on how to do such function myself :s. I really thought maybe OpenGL provided some functions to do it...

upload :: .... -- upload to the Graphics Card? 
I've used OpenGL in C++ and adding a texture is so easy, Probably I did all 3 steps you mention, but I never really worried about them, I just did it without paying attention on what was happening underneath.

draw :: ... This does sounds like what I used to do in C++ and it's what I was hoping to find in Haskell...

Thank you,

Hector Guilarte

On Sun, Jul 11, 2010 at 10:06 AM, Claude Heiland-Allen <claudiusmaximus@goto10.org> wrote:
Hi Hector,


On 11/07/10 03:02, Hector Guilarte wrote:
> I've been looking for a way to map a texture into a Quad primitive with
> HOpenGL with no luck.
[snip]

I'm having trouble understanding where your problem is.

There are three steps to texturing using an image file:

load   :: FilePath -> IO Image      -- read file to raw pixel buffer
upload :: Image -> IO TextureObject -- upload to graphics card
draw   :: TextureObject -> IO ()    -- use the texture on something

where
data Image = Image{ width, height, channels :: Int, pixels :: Ptr () }

Which step is problematic?

'load' is the hardest IMO, and doesn't have anything to do with OpenGL.
'upload' I would implement with 'build2DMipmaps'
'draw' is easy: bind the texture, add a 'texCoord' before each 'vertex'

I could provide some example code for 'upload' and 'draw' if you think it would help.


Claude
--
http://claudiusmaximus.goto10.org

_______________________________________________
HOpenGL mailing list
HOpenGL@haskell.org
http://www.haskell.org/mailman/listinfo/hopengl