Difference between revisions of "Talk:OpenGLTutorial2"
Jump to navigation
Jump to search
(Added missing () in idle function.) |
|||
Line 14: | Line 14: | ||
postRedisplay Nothing |
postRedisplay Nothing |
||
</haskell> |
</haskell> |
||
− | |||
− | which also led me to read about IORef and also realise that I could have used this in place of the $=! which once again shows that when you have to work harder and solve little things like this for yourself it helps you learn even better. Here's the alternative way to update the IORef containing the rotation angle. |
||
− | <haskell> |
||
− | updateIORef angle (a+0.1) |
||
− | </haskell> |
||
− | |||
Hope that helps somebody else! |
Hope that helps somebody else! |
||
EmacsTheViking |
EmacsTheViking |
Latest revision as of 23:02, 8 March 2011
Excellent article and it got me going with OpenGL and Haskell but there is a small mistake that prevents the successful compilation at the point "3.1 Animation" in the revised Display.hs, function 'idle' ...
idle angle = do
a <- get angle
angle $=! a+0.1
postRedisplay Nothing
To get it to work on Ubuntu with ghc 6.12.3 I had to change it by enclosing the update in parentheses like so,
idle angle = do
a <- get angle
angle $=! (a+0.1)
postRedisplay Nothing
Hope that helps somebody else! EmacsTheViking