diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2022-12-02 01:52:24 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2022-12-02 01:53:24 -0700 |
commit | 0d8449f6632038ac38385bae8254f769333edc28 (patch) | |
tree | 4494b01784b6840e205c22a1ba6288852ca9a3fe /Graphics/Glyph/Mat4.hs | |
parent | a006a8dfc1d30a12160346da3c0ece4460b49966 (diff) | |
download | earths-ring-0d8449f6632038ac38385bae8254f769333edc28.tar.gz earths-ring-0d8449f6632038ac38385bae8254f769333edc28.tar.bz2 earths-ring-0d8449f6632038ac38385bae8254f769333edc28.zip |
Update this ancient project to work with modern Haskell.
Thsi is a big change, particularly with the SDL library. Not all the
original functionality is restored yet, but it's pretty close.
As a part of this reworking, I have moved the project to Stack.
Diffstat (limited to 'Graphics/Glyph/Mat4.hs')
-rw-r--r-- | Graphics/Glyph/Mat4.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Graphics/Glyph/Mat4.hs b/Graphics/Glyph/Mat4.hs index 546baa2..6581126 100644 --- a/Graphics/Glyph/Mat4.hs +++ b/Graphics/Glyph/Mat4.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts #-} module Graphics.Glyph.Mat4 where import Control.Monad @@ -9,7 +9,8 @@ import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL -import Graphics.Rendering.OpenGL.Raw.Core31 +import Graphics.GL.Compatibility30 +-- import Graphics.Rendering.OpenGL.Raw.Core31 data Mat4 a = Matrix (a,a,a,a, a,a,a,a, @@ -50,7 +51,7 @@ instance (Storable t) => StorableMatrix t Mat3 where instance Uniform (Mat4 GLfloat) where uniform (UniformLocation loc) = makeStateVar getter setter where setter mat = toPtr mat $ \ptr -> - glUniformMatrix4fv loc 1 (fromIntegral gl_FALSE) ptr + glUniformMatrix4fv loc 1 (fromIntegral GL_FALSE) ptr getter :: IO (Mat4 GLfloat) getter = do pid <- liftM fromIntegral getCurrentProgram @@ -61,7 +62,7 @@ instance Uniform (Mat4 GLfloat) where instance Uniform (Mat3 GLfloat) where uniform (UniformLocation loc) = makeStateVar getter setter where setter mat = toPtr mat $ \ptr -> - glUniformMatrix3fv loc 1 (fromIntegral gl_FALSE) ptr + glUniformMatrix3fv loc 1 (fromIntegral GL_FALSE) ptr getter :: IO (Mat3 GLfloat) getter = do pid <- liftM fromIntegral getCurrentProgram @@ -70,7 +71,7 @@ instance Uniform (Mat3 GLfloat) where fromPtr buf return ) getCurrentProgram :: IO GLint -getCurrentProgram = alloca $ glGetIntegerv gl_CURRENT_PROGRAM >> peek +getCurrentProgram = alloca $ \ptr -> glGetIntegerv GL_CURRENT_PROGRAM ptr >> peek ptr instance (Show a) => Show (Mat4 a) where show IdentityMatrix = |