snowglobe 3 → 3.0.0.1
raw patch · 2 files changed
+20/−13 lines, 2 filesdep ~OpenGL
Dependency ranges changed: OpenGL
Files
- SnowGlobe.hs +8/−8
- snowglobe.cabal +12/−5
SnowGlobe.hs view
@@ -1,14 +1,12 @@ -- SnowGlobe -- randomized fractal snowflakes demo--- (GPL3+) 2012,2014 Claude Heiland-Allen <claude@mathr.co.uk>--- usage: snowglobe--- 'f' toggles full screen, 'shift-R' toggles record, any other key to quit--- tested with: ghc-7.0.4, ghc-7.4-rc1, ghc-7.4.2, ghc-7.6.2, ghc-7.8.2+-- (GPL3+) 2012,2014,2015 Claude Heiland-Allen <claude@mathr.co.uk>+-- tested with: ghc-7.6.3, ghc-7.8.2, ghc-7.10.1~rc2 import Vector hiding (i) import Graphics.UI.GLUT hiding (scale, FramebufferObject) import qualified Graphics.UI.GLUT as GL import Graphics.Rendering.OpenGL.Raw- ( glTexImage2D, gl_TEXTURE_2D, gl_LUMINANCE32F, gl_LUMINANCE, gl_RGBA+ ( glTexImage2D, gl_TEXTURE_2D, gl_R32F, gl_RED, gl_RGBA , gl_UNSIGNED_BYTE, gl_FALSE, glClampColor, glGenerateMipmap , gl_CLAMP_VERTEX_COLOR, gl_CLAMP_READ_COLOR, gl_CLAMP_FRAGMENT_COLOR , glGenFramebuffers, glBindFramebuffer, glFramebufferTexture2D@@ -26,7 +24,6 @@ import System.Exit (exitSuccess) import System.IO (hPutStrLn, stderr, stdout, hPutStr, withBinaryFile, IOMode(WriteMode), hPutBuf) import System.Random (randomRIO)-import Unsafe.Coerce (unsafeCoerce) -- for OpenGL uniform newtype import Foreign (alloca, peek, nullPtr, withArray) import Graphics.Rendering.OpenGL.Capture (capturePPM) import Data.ByteString as BS (hPut, pack)@@ -171,6 +168,9 @@ currentProgram $= Nothing return $ Step (flakeRenderPass sR ts passes passes) +getUniformLocation :: UniformLocation -> GLint+getUniformLocation (UniformLocation u) = u+ -- multi step passes flakeRenderPass :: IORef SnowGlobe -> [M3] -> N -> N -> IO Render flakeRenderPass sR _ passes 0 = flakeRenderFinish sR passes@@ -182,7 +182,7 @@ currentProgram $= Just (pStep s0) uniform (pStep'er s0) $= TexCoord1 (realToFrac er :: GLfloat) uniform (pStep'src s0) $= TexCoord1 (0 :: GLint)- withArray (map ((realToFrac :: Float -> GLfloat) . (realToFrac :: Double -> Float)) . concatMap matrixToList $ ts) $ glUniformMatrix3fv (unsafeCoerce $ pStep'ts s0) 6 1+ withArray (map ((realToFrac :: Float -> GLfloat) . (realToFrac :: Double -> Float)) . concatMap matrixToList $ ts) $ glUniformMatrix3fv (getUniformLocation $ pStep'ts s0) 6 1 bindFBO (fBuffer s0) (tPong s0) textureBinding Texture2D $= Just (tPing s0) unitQuad@@ -462,7 +462,7 @@ newTex s = do [t] <- genObjectNames 1 textureBinding Texture2D $= Just t- glTexImage2D gl_TEXTURE_2D 0 (fromIntegral gl_LUMINANCE32F) (fromIntegral s) (fromIntegral s) 0 gl_LUMINANCE gl_UNSIGNED_BYTE nullPtr+ glTexImage2D gl_TEXTURE_2D 0 (fromIntegral gl_R32F) (fromIntegral s) (fromIntegral s) 0 gl_RED gl_UNSIGNED_BYTE nullPtr textureFilter Texture2D $= ((Linear', Nothing), Linear') textureWrapMode Texture2D S $= (Repeated, ClampToEdge) textureWrapMode Texture2D T $= (Repeated, ClampToEdge)
snowglobe.cabal view
@@ -1,5 +1,5 @@ Name: snowglobe-Version: 3+Version: 3.0.0.1 Synopsis: randomized fractal snowflakes demo Description: @snowglobe@ generates random snowflakes using iterated function systems via OpenGL texture feedback. The@@ -15,7 +15,14 @@ generated flake to the current working directory . * any other key: quit+ .+ Blog posts:+ .+ * http://mathr.co.uk/blog/2012-01-12_snowglobe.html+ .+ * http://mathr.co.uk/blog/2014-12-19_making_seasonal_cards_with_snowglobe.html +homepage: http://code.mathr.co.uk/snowglobe License: GPL-3 License-file: LICENSE Author: Claude Heiland-Allen@@ -34,15 +41,15 @@ containers, gl-capture, GLUT,- OpenGL == 2.9.*,+ OpenGL == 2.11.*, OpenGLRaw, random Source-repository head type: git- location: git://gitorious.org/maximus/snowglobe.git+ location: http://code.mathr.co.uk/snowglobe.git Source-repository this type: git- location: git://gitorious.org/maximus/snowglobe.git- tag: v3+ location: http://code.mathr.co.uk/snowglobe.git+ tag: v3.0.0.1