GLUtil 0.6.4 → 0.6.6
raw patch · 4 files changed
+22/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Graphics.GLUtil: data Word32 :: *
+ Graphics.GLUtil.VertexArrayObjects: deleteVAO :: VertexArrayObject -> IO ()
+ Graphics.GLUtil.VertexArrayObjects: deleteVAOs :: [VertexArrayObject] -> IO ()
Files
- GLUtil.cabal +1/−1
- src/Graphics/GLUtil.hs +2/−2
- src/Graphics/GLUtil/JuicyTextures.hs +2/−0
- src/Graphics/GLUtil/VertexArrayObjects.hs +17/−1
GLUtil.cabal view
@@ -1,5 +1,5 @@ Name: GLUtil-Version: 0.6.4+Version: 0.6.6 Synopsis: Miscellaneous OpenGL utilities. License: BSD3 License-file: LICENSE
src/Graphics/GLUtil.hs view
@@ -4,14 +4,14 @@ module Graphics.GLUtil.Drawing, module Graphics.GLUtil.Shaders, module Graphics.GLUtil.Textures,- readTexture,+ readTexture, Word32, module Graphics.GLUtil.GLError, module Graphics.GLUtil.VertexArrayObjects, module Graphics.GLUtil.ShaderProgram, module Graphics.GLUtil.TypeMapping, module Graphics.GLUtil.Linear, module Graphics.GLUtil.Viewport) where-+import Data.Word (Word32) -- Simplify bufferIndices usage import Graphics.GLUtil.BufferObjects import Graphics.GLUtil.Drawing import Graphics.GLUtil.Shaders
src/Graphics/GLUtil/JuicyTextures.hs view
@@ -3,6 +3,7 @@ -- to create OpenGL textuers. module Graphics.GLUtil.JuicyTextures where import Codec.Picture (readImage, DynamicImage(..), Image(..))+import Codec.Picture.Types (convertImage, PixelRGB8) import Control.Applicative ((<$>)) import Graphics.GLUtil.Textures import Graphics.Rendering.OpenGL (TextureObject)@@ -20,6 +21,7 @@ aux (ImageRGB8 (Image w h p)) = Right <$> k (texInfo w h TexRGB p) aux (ImageRGBF (Image w h p)) = Right <$> k (texInfo w h TexRGB p) aux (ImageRGBA8 (Image w h p)) = Right <$> k (texInfo w h TexRGBA p)+ aux (ImageYCbCr8 img) = aux . ImageRGB8 $ convertImage img aux _ = return $ Left "Unsupported image format" -- | Load a 'TextureObject' from an image file. Supported formats
src/Graphics/GLUtil/VertexArrayObjects.hs view
@@ -1,6 +1,11 @@ -- | A thin layer over OpenGL 3.1+ vertex array objects.-module Graphics.GLUtil.VertexArrayObjects (makeVAO, withVAO, VAO) where+module Graphics.GLUtil.VertexArrayObjects + (makeVAO, withVAO, deleteVAO, deleteVAOs, VAO) where import Graphics.Rendering.OpenGL+import Graphics.Rendering.OpenGL.Raw.Core31 (glDeleteVertexArrays)+import Foreign.Marshal.Array (withArrayLen)+import Foreign.Marshal.Utils (with)+import Unsafe.Coerce (unsafeCoerce) -- |Short alias for 'VertexArrayObject'. type VAO = VertexArrayObject@@ -21,3 +26,14 @@ r <- useIt bindVertexArrayObject $= Nothing return r++-- | Delete a 'VertexArrayObject'.+deleteVAO :: VertexArrayObject -> IO ()+deleteVAO vao = with (vaoID vao) $ glDeleteVertexArrays 1+ where vaoID = unsafeCoerce :: VertexArrayObject -> GLuint++-- | Delete a list of 'VertexArrayObject's.+deleteVAOs :: [VertexArrayObject] -> IO ()+deleteVAOs vaos = withArrayLen (map vaoID vaos) $ + glDeleteVertexArrays . fromIntegral+ where vaoID = unsafeCoerce :: VertexArrayObject -> GLuint