views:

167

answers:

1

Haskell is about computation by calculation of values.

DisplayLists / FBOs / VBOs are very very stateful by nature. I.e. "give me a display list / buffer object".

How do these bindings work in Haskell?

[I do understand monads; so a technical explaination, as opposed to a fluffy one, is preferred].

Thanks!

+1  A: 

HOpenGL does everything in the IO monad. The API it presents is more OpenGL-like than Haskell-like. For example,

do
    -- create a new display list
    dl <- defineNewList $ do
        -- put some
        -- drawing code
        -- in here

    -- call a pre-defined display list
    callList dl

So all the low-level OpenGL interactions do end up being very stateful.

ephemient
How do you release lists then? Or does it get auto-freed when the varaible falls out of scope?
anon
You have to manually free it with `deleteLists`, or reuse the ID for another display list with `defineList`.
ephemient
darn it; i was really hoping for something mind blowingly elegant
anon