diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-12-03 01:03:52 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-12-03 01:03:52 -0700 |
| commit | 11fca081b1241e1915f357fa40baa3e97aceb823 (patch) | |
| tree | c0312c145d9133cef5e31b04a71bec050097f0f0 /Graphics/Glyph/Mat4.hs | |
| parent | 7dd8c59353167e84dab9e7a1afc16e2290b249e3 (diff) | |
| download | terralloc-11fca081b1241e1915f357fa40baa3e97aceb823.tar.gz terralloc-11fca081b1241e1915f357fa40baa3e97aceb823.tar.bz2 terralloc-11fca081b1241e1915f357fa40baa3e97aceb823.zip | |
Start reviving this ancient project. (It's pretty cool).
Got it to compile using Stack.
Skybox works, but nothing else really does. I think this is a problem
with how the program is interpreting the surface pixels when
calculating the map terrain and elevation.
I think some TLC is in order.
Diffstat (limited to 'Graphics/Glyph/Mat4.hs')
| -rw-r--r-- | Graphics/Glyph/Mat4.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Graphics/Glyph/Mat4.hs b/Graphics/Glyph/Mat4.hs index c1ae485..7d54b05 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,8 +9,9 @@ import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL (Uniform(..),uniform,UniformLocation(..),makeStateVar) -import Graphics.Rendering.OpenGL.Raw.Core31 +import Graphics.GL.Core43 +{- ORMOLU_DISABLE -}; data Mat4 a = Matrix4 (a,a,a,a, a,a,a,a, a,a,a,a, @@ -19,6 +20,7 @@ data Mat4 a = Matrix4 (a,a,a,a, data Mat3 a = Matrix3 ( a,a,a, a,a,a, a,a,a ) | IdentityMatrix3 +{- ORMOLU_ENABLE -}; class StorableMatrix t a where fromList :: [t] -> a t @@ -85,7 +87,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 @@ -97,7 +99,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 @@ -107,7 +109,7 @@ instance Uniform (Mat3 GLfloat) where uniformv _ = undefined 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 = |