[Haskell-cafe] Correct way to record state in OpenGL?
Christopher Lane Hinson
lane at downstairspeople.org
Sun Apr 4 09:08:59 EDT 2010
A state monad is really just a convenience (of the sanity-sustaining
variety), so that you don't have to name a variable for each new
modification of your state. It won't help you here with this specific
Create an IORef or MVar early in your main function, and pass it into your
callback functions. All of the callbacks will then have access to the
same mutable contents.
On Sun, 4 Apr 2010, Mark Spezzano wrote:
> What is the correct way to record "custom" state when using OpenGL?
> By this, I refer to, say, properties of a square--say it's x,y coordinates as it moves across the screen. This requires that the program keep track of the object's state as it moves. These coordinates are _not_ part of the OpenGL state machine, so is the correct way to use the State monad?
> If so--or if not so--how would I proceed to keep track of the state of my objects as they move about the screen? Maybe the HOpenGL implementation comes with such state-tracking devices?
> Please post code snippets if necessary.
> Thanks in advance,
> Mark Spezzano
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe