module PointsRendering ( display, Point ) where import Graphics.UI.GLUT import Graphics.Rendering.OpenGL import Random type Point = (GLfloat, GLfloat, GLfloat) makeVertx = mapM_ (\(x,y,z) -> vertex $ Vertex3 x y z) getRand :: IO Float getRand = getStdRandom (randomR (0,1)) renderAs :: PrimitiveMode -> [Point] -> IO () renderAs mode points = renderPrimitive mode (makeVertx points) renderInWindow displayFunction = do (progName,_) <- getArgsAndInitialize createWindow "Primitive shapes" displayCallback $= displayFunction mainLoop displayPoints :: PrimitiveMode -> [Point] -> IO () displayPoints mode points = do renderAs mode points flush display :: PrimitiveMode -> [Point] -> IO () display mode points = renderInWindow (display' mode points) display' :: PrimitiveMode -> [Point] -> IO () display' mode points = do clear [ColorBuffer] currentColor $= Color4 0 0.3 1 1 displayPoints mode points