Skip to content
haskell, opengl, toy project
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
shaders remove simtime Oct 18, 2017
src/Quine
tests upgrade tests to also compile with stackage lts-4.0 Jan 10, 2016
.editorconfig added get for Buffer incl tests Nov 21, 2014
.gitignore bumped stack so quine compiles after SDL version increment, add .stac… Jun 2, 2017
.travis.yml
.vim.custom
CHANGELOG.markdown
LICENSE
Main.hs upgrade to sdl2-2.1.0+ (stack lts-4.0) Jan 10, 2016
PAPERS.markdown more on BVH construction techniques Nov 29, 2014
README.markdown reference the right executable Nov 25, 2014
Setup.lhs Fix the GHC 8.2 build by using a simple Setup.hs Apr 1, 2017
TODO.markdown
Toy.hs
Triangles.hs
quine.cabal
stack.yaml

README.markdown

Quine

This is just me waxing nostalgic and throwing together some code for playing with graphics.

I reserve the right to get bored and go do something else that actually makes money.

A couple of shader toys:

$ toy -F shaders/examples/generators.frag

screenshot of generators

$ toy -F shaders/examples/dodecahedron.frag

screenshot of a dodecahedron

$ toy -F shaders/examples/chains.frag

screenshot of chains

Now I need to make things fast.

Usage Instructions

You can start up the process with just

$ toy

Resolution Settings

Full-screen can be accessed on a mac with Cmd-Enter, or you can start there with -f

$ toy -f

Due to a bug in SDL 2.0.3 on OSX when rendering through Cocoa, this currently has to use the "fullscreen via desktop" method otherwise I can't let you return to the desktop.

If you want to use native fullscreen then you can get coarser resolutions that run much faster (due to the lack of upsampling) with

$ toy -f -n -x 1024 -y 768

Retina rendering supported via -r, but figuring out the device scaling factor is currently not, I'll guess 2.0 as it is the default, but you can play with the ratio with -s.

$ toy -r -s 2.0

Mac "Deferred Updates"

On a Mac the compositior carefully helpfully batches up all the frame updates. This rather sharply caps the frame rate.

You can disable this with

$ sudo defaults write /Library/Preferences/com.apple.windowserver Compositor -dict deferredUpdates 0

but you'll probably need to restart.

To re-enable it:

$ sudo defaults write /Library/Preferences/com.apple.windowserver Compositor -dict deferredUpdates 1

Not being a Mac developer, I don't know how to do this in a less invasive manner. Suggestions are welcome.

Profiling

By default ekg will start on port 5616, and you can connect to monitor the rendering process.

You can run quine -M to also have the browser pop open to the page on startup. (On a mac)

Opening the quine.frame chart will give you a handy FPS meter (which is now also in the title for the window).

Contact Information

Contributions and bug reports are welcome!

Please feel free to contact me through github or on the #haskell and #haskell-game IRC channels on irc.freenode.net.

Build bot spam from this project goes to #haskell-lens.

-Edward Kmett

You can’t perform that action at this time.