module Display (display,idle) where import Graphics.Rendering.OpenGL import Graphics.UI.GLUT import Data.IORef import Cube import Action display position oposition velocity accele = do clear [ColorBuffer] loadIdentity mapM_ (\(x,y,z) -> preservingMatrix $ do acc <- readIORef accele opos <- readIORef oposition vel <- readIORef velocity color $ (Color3 1.0 1.0 (1.0::GLfloat)) translate opos cube (0.1::GLfloat) ) [(0,0,0)] swapBuffers walls:: Vector3(PBound) walls = (Vector3 (-1.0,1.0) (-1.0,1.0) (-1.0,1.0)) wallsrefc :: Vector3(GLfloat) wallsrefc = Vector3 1.0 1.0 1.0 idle :: IORef(Vector3(Float)) -> IORef(Vector3(Float)) -> IORef(Vector3(Float)) -> IO() idle oposition velocity accele = do acc <- readIORef accele opos <- readIORef oposition vel <- readIORef velocity velocity $=! newVelocity3 walls wallsrefc opos acc vel oposition $=! nextPosition3 opos vel postRedisplay Nothing