snowglobe 3.0.0.2 → 3.0.0.3
raw patch · 2 files changed
+45/−27 lines, 2 filesdep ~OpenGL
Dependency ranges changed: OpenGL
Files
- SnowGlobe.hs +37/−19
- snowglobe.cabal +8/−8
SnowGlobe.hs view
@@ -1,18 +1,36 @@ -- SnowGlobe -- randomized fractal snowflakes demo--- (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+-- (GPL3+) 2012,2014,2015,2016 Claude Heiland-Allen <claude@mathr.co.uk>+-- tested with: ghc-7.6.3, ghc-7.8.2, ghc-7.10.1~rc2, ghc-8.0.1 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_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- , gl_FRAMEBUFFER, gl_COLOR_ATTACHMENT0, glUniformMatrix3fv, gl_ALPHA+import Graphics.GL+ ( glTexImage2D+ , glClampColor+ , glGenerateMipmap+ , glGenFramebuffers+ , glBindFramebuffer+ , glFramebufferTexture2D+ , glUniformMatrix3fv , glGetTexImage )+import Graphics.GL.Tokens+{-+ ( GL_TEXTURE_2D+ , GL_R32F+ , GL_RED+ , GL_RGBA+ , GL_UNSIGNED_BYTE+ , GL_FALSE+ , GL_CLAMP_VERTEX_COLOR+ , GL_CLAMP_READ_COLOR+ , GL_CLAMP_FRAGMENT_COLOR+ , GL_ALPHA+ , GL_FRAMEBUFFER+ , GL_COLOR_ATTACHMENT0+ )+-} import Control.Exception (evaluate) import Control.Monad (forM_, replicateM, when) import Data.IORef (IORef, modifyIORef, newIORef, readIORef, writeIORef)@@ -215,7 +233,7 @@ currentProgram $= Nothing unbindFBO textureBinding Texture2D $= Just t- glGenerateMipmap gl_TEXTURE_2D+ glGenerateMipmap GL_TEXTURE_2D textureBinding Texture2D $= Nothing return $ Done t @@ -331,9 +349,9 @@ tPing' <- newTex size tPong' <- newTex size fBuffer' <- newFBO- glClampColor gl_CLAMP_VERTEX_COLOR gl_FALSE- glClampColor gl_CLAMP_READ_COLOR gl_FALSE- glClampColor gl_CLAMP_FRAGMENT_COLOR gl_FALSE+ glClampColor GL_CLAMP_VERTEX_COLOR $ fromIntegral GL_FALSE+ glClampColor GL_CLAMP_READ_COLOR $ fromIntegral GL_FALSE+ glClampColor GL_CLAMP_FRAGMENT_COLOR $ fromIntegral GL_FALSE sR <- newIORef SnowGlobe { pInitial = pInitial', pInitial'er = pInitial'er', pInitial'rho = pInitial'rho' , pStep = pStep', pStep'er = pStep'er', pStep'ts = pStep'ts', pStep'src = pStep'src'@@ -462,7 +480,7 @@ newTex s = do [t] <- genObjectNames 1 textureBinding Texture2D $= Just t- glTexImage2D gl_TEXTURE_2D 0 (fromIntegral gl_R32F) (fromIntegral s) (fromIntegral s) 0 gl_RED 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)@@ -473,7 +491,7 @@ newTexRGBA s = do [t] <- genObjectNames 1 textureBinding Texture2D $= Just t- glTexImage2D gl_TEXTURE_2D 0 (fromIntegral gl_RGBA) (fromIntegral s) (fromIntegral s) 0 gl_RGBA gl_UNSIGNED_BYTE nullPtr+ glTexImage2D GL_TEXTURE_2D 0 (fromIntegral GL_RGBA) (fromIntegral s) (fromIntegral s) 0 GL_RGBA GL_UNSIGNED_BYTE nullPtr textureFilter Texture2D $= ((Linear', Just Linear'), Linear') textureWrapMode Texture2D S $= (Repeated, ClampToEdge) textureWrapMode Texture2D T $= (Repeated, ClampToEdge)@@ -487,7 +505,7 @@ hPutStr h header allocaArray n $ \p -> do textureBinding Texture2D $= Just t- glGetTexImage gl_TEXTURE_2D 0 gl_ALPHA gl_UNSIGNED_BYTE (p :: Ptr Word8)+ glGetTexImage GL_TEXTURE_2D 0 GL_ALPHA GL_UNSIGNED_BYTE (p :: Ptr Word8) textureBinding Texture2D $= Nothing hPutBuf h p n @@ -498,13 +516,13 @@ bindFBO :: FramebufferObject -> TextureObject -> IO () bindFBO (FramebufferObject f) (TextureObject t) = do- glBindFramebuffer gl_FRAMEBUFFER f- glFramebufferTexture2D gl_FRAMEBUFFER gl_COLOR_ATTACHMENT0 gl_TEXTURE_2D t 0+ glBindFramebuffer GL_FRAMEBUFFER f+ glFramebufferTexture2D GL_FRAMEBUFFER GL_COLOR_ATTACHMENT0 GL_TEXTURE_2D t 0 unbindFBO :: IO () unbindFBO = do- glFramebufferTexture2D gl_FRAMEBUFFER gl_COLOR_ATTACHMENT0 gl_TEXTURE_2D 0 0- glBindFramebuffer gl_FRAMEBUFFER 0+ glFramebufferTexture2D GL_FRAMEBUFFER GL_COLOR_ATTACHMENT0 GL_TEXTURE_2D 0 0+ glBindFramebuffer GL_FRAMEBUFFER 0 fullQuad :: IO () fullQuad = do
snowglobe.cabal view
@@ -1,5 +1,5 @@ Name: snowglobe-Version: 3.0.0.2+Version: 3.0.0.3 Synopsis: randomized fractal snowflakes demo Description: @snowglobe@ generates random snowflakes using iterated function systems via OpenGL texture feedback. The@@ -18,11 +18,11 @@ . Blog posts: .- * <http://mathr.co.uk/blog/2012-01-12_snowglobe.html>+ * <https://mathr.co.uk/blog/2012-01-12_snowglobe.html> .- * <http://mathr.co.uk/blog/2014-12-19_making_seasonal_cards_with_snowglobe.html>+ * <https://mathr.co.uk/blog/2014-12-19_making_seasonal_cards_with_snowglobe.html> -homepage: http://code.mathr.co.uk/snowglobe+homepage: https://code.mathr.co.uk/snowglobe License: GPL-3 License-file: LICENSE Author: Claude Heiland-Allen@@ -41,15 +41,15 @@ containers, gl-capture, GLUT,- OpenGL == 2.11.*,+ OpenGL == 3.0.*, OpenGLRaw, random Source-repository head type: git- location: http://code.mathr.co.uk/snowglobe.git+ location: https://code.mathr.co.uk/snowglobe.git Source-repository this type: git- location: http://code.mathr.co.uk/snowglobe.git- tag: v3.0.0.2+ location: https://code.mathr.co.uk/snowglobe.git+ tag: v3.0.0.3