module Display (display,idle) where import Graphics.Rendering.OpenGL import Graphics.UI.GLUT import Data.IORef import DisplayState import Cube import EndProg import States import TextureObjects display :: (IORef DState) -> (IORef WState) -> (IORef TexObjsGroup) -> IO() display dst wst tOGp= do clear [ColorBuffer] loadIdentity dst' <- readIORef dst wst' <- readIORef wst tOGp' <- readIORef tOGp scale (windowWH wst') 1.0 (1.0::GLfloat) mapM_ (cubeSet tOGp') (bObjs dst') swapBuffers idle :: (IORef DState) -> (IORef KState)-> (IORef CState) -> (IORef WState) -> IO() idle dst kst cst wst= do dst' <- readIORef dst kst' <- readIORef kst cst' <- readIORef cst wst' <- readIORef wst if (endD dst' kst' cst') == True then leaveMainLoop :: IO () else do dst $=! (newDState dst' kst' wst') postRedisplay Nothing