GLUtil 0.8.8 → 0.9.0
raw patch · 8 files changed
+22/−28 lines, 8 filesdep ~OpenGLdep ~OpenGLRaw
Dependency ranges changed: OpenGL, OpenGLRaw
Files
- CHANGELOG.md +4/−0
- GLUtil.cabal +3/−3
- src/Graphics/GLUtil/JuicyTextures.hs +3/−1
- src/Graphics/GLUtil/Linear.hs +1/−1
- src/Graphics/GLUtil/ShaderProgram.hs +3/−0
- src/Graphics/GLUtil/Shaders.hs +4/−4
- src/Graphics/GLUtil/TypeMapping.hs +1/−16
- src/Graphics/GLUtil/VertexArrayObjects.hs +3/−3
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.9.0++* OpenGL 3 dependency bump+ # 0.8.8 * Update to `hpp-0.3.0`
GLUtil.cabal view
@@ -1,5 +1,5 @@ Name: GLUtil-Version: 0.8.8+Version: 0.9.0 Synopsis: Miscellaneous OpenGL utilities. License: BSD3 License-file: LICENSE@@ -53,8 +53,8 @@ filepath, linear >= 1.1.3, JuicyPixels >= 3,- OpenGLRaw >= 1.1,- OpenGL >= 2.9.2 && < 2.14,+ OpenGLRaw >= 3.0 && < 3.2,+ OpenGL >= 3 && < 3.1, transformers >= 0.3, vector >= 0.7 if impl(ghc >= 7.10.1)
src/Graphics/GLUtil/JuicyTextures.hs view
@@ -1,10 +1,12 @@-{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE CPP, RankNTypes #-} -- | Uses the @JuicyPixels@ package to load images that are then used -- to create OpenGL textuers. module Graphics.GLUtil.JuicyTextures where import Codec.Picture (readImage, DynamicImage(..), Image(..)) import Codec.Picture.Types (convertImage)+#if __GLASGOW_HASKELL__ < 710 import Control.Applicative ((<$>))+#endif import Graphics.GLUtil.Textures import Graphics.Rendering.OpenGL (TextureObject)
src/Graphics/GLUtil/Linear.hs view
@@ -7,7 +7,7 @@ import Foreign.Marshal.Utils (with) import Foreign.Ptr (Ptr, castPtr) import Graphics.Rendering.OpenGL-import Graphics.Rendering.OpenGL.Raw.Core31+import Graphics.GL.Core31 import Linear import Unsafe.Coerce (unsafeCoerce)
src/Graphics/GLUtil/ShaderProgram.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- |Convenience interface for working with GLSL shader -- programs. Provides an interface for setting attributes and -- uniforms.@@ -14,7 +15,9 @@ -- * Working with ShaderProgram parameters getAttrib, enableAttrib, setAttrib, setUniform, getUniform) where import Prelude hiding (lookup)+#if __GLASGOW_HASKELL__ < 710 import Control.Applicative ((<$>), (<*>))+#endif import qualified Data.ByteString as BS import Data.List (find, findIndex, isSuffixOf) import Data.Map.Strict (Map, fromList, lookup)
src/Graphics/GLUtil/Shaders.hs view
@@ -1,13 +1,13 @@ -- |Utilities for working with fragment and vertex shader programs. module Graphics.GLUtil.Shaders (loadShader, loadShaderBS, linkShaderProgram, linkShaderProgramWith,- namedUniform, - uniformScalar, uniformVec, uniformMat, + namedUniform,+ uniformScalar, uniformVec, uniformMat, namedUniformMat, uniformGLMat4) where import Control.Monad (unless) import qualified Data.ByteString as BS import Graphics.Rendering.OpenGL-import Graphics.Rendering.OpenGL.Raw.Core31+import Graphics.GL.Core31 import Graphics.GLUtil.GLError import Foreign.Ptr (Ptr) import Unsafe.Coerce (unsafeCoerce)@@ -108,7 +108,7 @@ case length mat of 4 -> glUniformMatrix4fv loc' 1 1 ptr 3 -> glUniformMatrix3fv loc' 1 1 ptr- _ -> ioError . userError $ + _ -> ioError . userError $ "Only 3x3 and 4x4 matrices are supported" loc' = unUL loc
src/Graphics/GLUtil/TypeMapping.hs view
@@ -18,22 +18,14 @@ variableType :: a -> VariableType instance HasVariableType Float where variableType _ = Float'-instance HasVariableType GLfloat where variableType _ = Float'-instance HasVariableType GLint where variableType _ = Int' instance HasVariableType Int32 where variableType _ = Int' instance HasVariableType Word32 where variableType _ = UnsignedInt'-instance HasVariableType GLuint where variableType _ = UnsignedInt' instance HasVariableType (V1 GLfloat) where variableType _ = Float' instance HasVariableType (V2 GLfloat) where variableType _ = FloatVec2 instance HasVariableType (V3 GLfloat) where variableType _ = FloatVec3 instance HasVariableType (V4 GLfloat) where variableType _ = FloatVec4 -instance HasVariableType (V1 GLint) where variableType _ = Int'-instance HasVariableType (V2 GLint) where variableType _ = IntVec2-instance HasVariableType (V3 GLint) where variableType _ = IntVec3-instance HasVariableType (V4 GLint) where variableType _ = IntVec4- instance HasVariableType (V1 Int32) where variableType _ = Int' instance HasVariableType (V2 Int32) where variableType _ = IntVec2 instance HasVariableType (V3 Int32) where variableType _ = IntVec3@@ -44,16 +36,11 @@ instance HasVariableType (V3 Word32) where variableType _ = UnsignedIntVec3 instance HasVariableType (V4 Word32) where variableType _ = UnsignedIntVec4 -instance HasVariableType (V1 GLuint) where variableType _ = UnsignedInt'-instance HasVariableType (V2 GLuint) where variableType _ = UnsignedIntVec2-instance HasVariableType (V3 GLuint) where variableType _ = UnsignedIntVec3-instance HasVariableType (V4 GLuint) where variableType _ = UnsignedIntVec4- instance HasVariableType (M22 GLfloat) where variableType _ = FloatMat2 instance HasVariableType (M33 GLfloat) where variableType _ = FloatMat3 instance HasVariableType (M44 GLfloat) where variableType _ = FloatMat4 -instance forall t. HasVariableType t => HasVariableType [t] where +instance forall t. HasVariableType t => HasVariableType [t] where variableType _ = variableType (undefined::t) -- | Maps each 'VariableType' to its corresponding@@ -94,6 +81,4 @@ instance HasGLType Word8 where glType _ = GL.UnsignedByte instance HasGLType Word16 where glType _ = GL.UnsignedShort instance HasGLType Word32 where glType _ = GL.UnsignedInt-instance HasGLType GLuint where glType _ = GL.UnsignedInt instance HasGLType Float where glType _ = GL.Float-instance HasGLType GLfloat where glType _ = GL.Float
src/Graphics/GLUtil/VertexArrayObjects.hs view
@@ -1,8 +1,8 @@ -- | A thin layer over OpenGL 3.1+ vertex array objects.-module Graphics.GLUtil.VertexArrayObjects +module Graphics.GLUtil.VertexArrayObjects (makeVAO, withVAO, deleteVAO, deleteVAOs, VAO) where import Graphics.Rendering.OpenGL-import Graphics.Rendering.OpenGL.Raw.Core31 (glDeleteVertexArrays)+import Graphics.GL.Core31 (glDeleteVertexArrays) import Foreign.Marshal.Array (withArrayLen) import Foreign.Marshal.Utils (with) import Unsafe.Coerce (unsafeCoerce)@@ -34,6 +34,6 @@ -- | Delete a list of 'VertexArrayObject's. deleteVAOs :: [VertexArrayObject] -> IO ()-deleteVAOs vaos = withArrayLen (map vaoID vaos) $ +deleteVAOs vaos = withArrayLen (map vaoID vaos) $ glDeleteVertexArrays . fromIntegral where vaoID = unsafeCoerce :: VertexArrayObject -> GLuint