Skip to content

Instantly share code, notes, and snippets.

@ishiy1993
Created November 23, 2015 03:46
Show Gist options
  • Save ishiy1993/247434322de25c8c299d to your computer and use it in GitHub Desktop.
Save ishiy1993/247434322de25c8c299d to your computer and use it in GitHub Desktop.
HaskellでOpenGL(GLUT)を使って、円を描画する。
import Graphics.UI.GLUT
display :: DisplayCallback
display = do
clear [ColorBuffer]
color (Color3 0 0 0 :: Color3 GLdouble)
renderPrimitive LineLoop $ mapM_ vertex2d [Vertex2 (0.5*cos t) (0.5*sin t) | t <- [0,0.01..2*pi]]
flush
where
vertex2d = vertex :: Vertex2 GLdouble -> IO ()
main :: IO ()
main = do
getArgsAndInitialize
initialDisplayMode $= [RGBAMode]
createWindow "Sample"
clearColor $= Color4 1 1 1 1
displayCallback $= display
mainLoop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment