= Gloss = Gloss hides the pain of drawing simple vector graphics behind a nice data type and a few display functions. Gloss uses OpenGL and GLUT under the hood, but you won't have to worry about any of that. Get something cool on the screen in under 10 minutes. Gloss is a fork and cleanup of ANUPlot, which was used for teaching first year computer science at the [http://cs.anu.edu.au ANU] some time ago. Its main goal is to allow total beginners to get something working with a minimum of fuss. == Download == === From Hackage === * [http://hackage.haskell.org/package/gloss gloss] * [http://hackage.haskell.org/package/gloss-raster gloss-raster] * [http://hackage.haskell.org/package/gloss-examples gloss-examples] === With cabal === If you have cabal installed you should be able to do: {{{ cabal update cabal install gloss-examples gloss-styrene }}} === From the darcs repo === The source repos are at http://code.ouroborus.net/gloss {{{ darcs get http://code.ouroborus.net/gloss/gloss-stable cd gloss-stable cd gloss cabal install }}} Then again for the `examples` directory in that same repo. == Frequently Asked Questions (FAQ) == Q: Gloss freezes in `ghci`. It tries to draw the window but I don't get a picture and must kill the process.[[br]] A0: Upgrade to at least GHC 7.2[[br]] A1: Start `ghci` with `-fno-ghci-sandbox`. This is because OpenGL uses thread local state, which doesn't work when the running program is in a different thread.[[br]] A2: Try installing gloss to use the GLFW window manager interface instead of GLUT: `cabal install gloss --flags="GLFW -GLUT"` Q: Animations seem jerky.[[br]] A: Make sure you're compiling with {{{-O2 -threaded}}}. Without the threaded runtime, the code that manages the frame rate will behave badly. This is because GHC takes too long to reschedule the gloss process after the sleep timer has expired. With the threaded runtime, most simple animations should run at about 100fps, which is our internal frame-rate cap. Q: The window doesn't reshape properly under Xmonad.[[br]] A: Use the GLFW window manager interface instead, or prod the Xmonad people about it. This is probably an incompatibility between Xmonad and GLUT, but the main Gloss developer doesn't use Xmonad. == Further Information == To report bugs or request features, post in the [http://groups.google.com/group/haskell-gloss haskell-gloss] Google group. We're also interested in cool examples you come up with. Contributed examples can be added to the gloss-examples package and posted on this page. To get an account on the trac, send email to `trac@ouroborus.net` == Active Related Projects == * [http://hackage.haskell.org/package/diagrams diagrams] a Domain Specific Language for drawing 2D graphics. * [http://mahrz.github.com/craftwerk.html craftwerk] a graphics library with TikZ output. == Examples == These are some of the examples included in the [http://hackage.haskell.org/package/gloss-examples gloss-examples] package: || Hello || Lifespan || Styrene || Tree || Clock || Zen || || [[Image(WikiStart:gloss-hello-thumb.png)]] || [[Image(WikiStart:gloss-lifespan-thumb.png)]] || [[Image(WikiStart:gloss-styrene-thumb.png)]] || [[Image(WikiStart:gloss-tree-thumb.png)]] || [[Image(WikiStart:gloss-clock-thumb.png)]] || [[Image(WikiStart:gloss-zen-thumb.png)]] || || [http://code.ouroborus.net/gloss/gloss-stable/gloss-examples/picture/Hello/Main.hs code] [http://code.ouroborus.net/gloss/wiki/images/gloss-hello.png result] || [http://code.ouroborus.net/gloss/gloss-stable/gloss-examples/picture/Lifespan/ code] [http://code.ouroborus.net/gloss/wiki/images/gloss-lifespan.png result] || [http://code.ouroborus.net/gloss/gloss-stable/gloss-examples/picture/Styrene/ code] [http://code.ouroborus.net/gloss/wiki/images/gloss-styrene.png result] || [http://code.ouroborus.net/gloss/gloss-stable/gloss-examples/picture/Tree/Main.hs code] [http://code.ouroborus.net/gloss/wiki/images/gloss-tree.png result] || [http://code.ouroborus.net/gloss/gloss-stable/gloss-examples/picture/Clock/Main.hs code] [http://code.ouroborus.net/gloss/wiki/images/gloss-clock.png result] || [http://code.ouroborus.net/gloss/gloss-stable/gloss-examples/picture/Zen/Main.hs code] [http://www.youtube.com/watch?v=vm78Tkc-KhM video] ||