packages feed

GLUtil 0.7.4 → 0.7.5

raw patch · 4 files changed

+14/−19 lines, 4 filesdep +transformersdep ~OpenGL

Dependencies added: transformers

Dependency ranges changed: OpenGL

Files

GLUtil.cabal view
@@ -1,5 +1,5 @@ Name:                GLUtil-Version:             0.7.4+Version:             0.7.5 Synopsis:            Miscellaneous OpenGL utilities. License:             BSD3 License-file:        LICENSE@@ -52,7 +52,8 @@                        linear >= 1.1.3,                        JuicyPixels >= 3,                        OpenGLRaw >= 1.1,-                       OpenGL >= 2.9,+                       OpenGL >= 2.9.2 && < 2.10,+                       transformers >= 0.3,                        vector >= 0.7   Build-tools:         cpphs   GHC-Options:         -Odph -Wall
src/Graphics/GLUtil/Shaders.hs view
@@ -29,10 +29,10 @@   ok <- get (compileStatus shader)   infoLog <- get (shaderInfoLog shader)   unless (null infoLog)-         (mapM_ putStrLn +         (mapM_ putStrLn                 ["Shader info log for '" ++ filePath ++ "':", infoLog, ""])   unless ok $ do-    deleteObjectNames [shader]+    deleteObjectName shader     ioError (userError "shader compilation failed")   return shader 
src/Graphics/GLUtil/Textures.hs view
@@ -99,11 +99,13 @@   where loadTex TexMono = case pixelType of                             GL.UnsignedShort -> loadAux Luminance16 Luminance                             GL.Float         -> loadAux R32F Red+                            GL.HalfFloat     -> loadAux R16F Red                             GL.UnsignedByte  -> loadAux R8 Red                             _                -> loadAux Luminance' Luminance         loadTex TexRG = case pixelType of                           GL.UnsignedShort -> loadAux RG16 RGInteger                           GL.Float -> loadAux RG32F RG+                          GL.HalfFloat -> loadAux RG16F RG                           GL.UnsignedByte -> loadAux RG8UI RGInteger                           GL.Byte -> loadAux RG8I RGInteger                           GL.Int -> loadAux RG32I RGInteger@@ -139,6 +141,7 @@ withTextures tt ts m = do mapM_ aux (zip ts [0..])                           r <- m                           cleanup 0 ts+                          activeTexture $= TextureUnit 0                           return r   where aux (t,i) = do activeTexture $= TextureUnit i                        textureBinding tt $= Just t@@ -166,14 +169,3 @@                        textureBinding tt $= Just t         cleanup i = do activeTexture $= TextureUnit i                        textureBinding tt $= Nothing--class MipMappable t where-  -- | Generate a complete set of mipmaps for the currently bound-  -- texture object.-  generateMipmap' :: t -> IO ()--instance MipMappable TextureTarget2D where-  generateMipmap' _ = glGenerateMipmap gl_TEXTURE_2D--instance MipMappable TextureTargetCubeMap where-  generateMipmap' _ = glGenerateMipmap gl_TEXTURE_CUBE_MAP
src/Graphics/GLUtil/Viewport.hs view
@@ -1,14 +1,16 @@ -- | Helpers for working with OpenGL viewports. module Graphics.GLUtil.Viewport where+import Control.Monad.IO.Class import Graphics.Rendering.OpenGL  -- | @withViewport pos sz m@ runs the action @m@ after setting the -- viewport with the given 'Position' and 'Size'. The viewport is -- reset to its original state after the action is run, and the result -- of the action is returned.-withViewport :: Position -> Size -> IO a -> IO a-withViewport p s m = do oldVP <- get viewport-                        viewport $= (p,s)+withViewport :: MonadIO m => Position -> Size -> m a -> m a+withViewport p s m = do oldVP <- liftIO $ do oldVP <- get viewport+                                             viewport $= (p,s)+                                             return oldVP                         r <- m-                        viewport $= oldVP+                        liftIO $ viewport $= oldVP                         return r