aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Spear/GL.hs7
-rw-r--r--Spear/Render/AnimatedModel.hs1
-rw-r--r--Spear/Render/Program.hs4
-rw-r--r--Spear/Render/StaticModel.hs1
-rw-r--r--Spear/Render/Triangle.hs4
-rw-r--r--Spear/Scene/Loader.hs3
6 files changed, 7 insertions, 13 deletions
diff --git a/Spear/GL.hs b/Spear/GL.hs
index 05e439a..eb84492 100644
--- a/Spear/GL.hs
+++ b/Spear/GL.hs
@@ -74,7 +74,7 @@ module Spear.GL
74, printGLError 74, printGLError
75, assertGL 75, assertGL
76 -- * OpenGL 76 -- * OpenGL
77, module Graphics.Rendering.OpenGL.Raw.Core31 77, module Graphics.Rendering.OpenGL.Raw.Core32
78, Ptr 78, Ptr
79, nullPtr 79, nullPtr
80) 80)
@@ -99,7 +99,7 @@ import Foreign.Marshal.Utils as Foreign (with)
99import Foreign.Marshal.Alloc (alloca) 99import Foreign.Marshal.Alloc (alloca)
100import Foreign.Marshal.Array (withArray) 100import Foreign.Marshal.Array (withArray)
101import Foreign.Storable (peek) 101import Foreign.Storable (peek)
102import Graphics.Rendering.OpenGL.Raw.Core31 102import Graphics.Rendering.OpenGL.Raw.Core32
103import System.Directory (doesFileExist, getCurrentDirectory, setCurrentDirectory) 103import System.Directory (doesFileExist, getCurrentDirectory, setCurrentDirectory)
104import System.IO (hPutStrLn, stderr) 104import System.IO (hPutStrLn, stderr)
105import Unsafe.Coerce 105import Unsafe.Coerce
@@ -127,11 +127,12 @@ instance ResourceClass GLSLProgram where
127 getResource = getProgramKey 127 getResource = getProgramKey
128 128
129-- | Supported shader types. 129-- | Supported shader types.
130data ShaderType = VertexShader | FragmentShader deriving (Eq, Show) 130data ShaderType = VertexShader | FragmentShader | GeometryShader deriving (Eq, Show)
131 131
132toGLShader :: ShaderType -> GLenum 132toGLShader :: ShaderType -> GLenum
133toGLShader VertexShader = gl_VERTEX_SHADER 133toGLShader VertexShader = gl_VERTEX_SHADER
134toGLShader FragmentShader = gl_FRAGMENT_SHADER 134toGLShader FragmentShader = gl_FRAGMENT_SHADER
135toGLShader GeometryShader = gl_GEOMETRY_SHADER
135 136
136-- | Apply the given function to the program's id. 137-- | Apply the given function to the program's id.
137withGLSLProgram :: GLSLProgram -> (GLuint -> a) -> a 138withGLSLProgram :: GLSLProgram -> (GLuint -> a) -> a
diff --git a/Spear/Render/AnimatedModel.hs b/Spear/Render/AnimatedModel.hs
index be3e2e3..9c05109 100644
--- a/Spear/Render/AnimatedModel.hs
+++ b/Spear/Render/AnimatedModel.hs
@@ -40,7 +40,6 @@ import Spear.Render.Program
40 40
41import Control.Applicative ((<$>), (<*>)) 41import Control.Applicative ((<$>), (<*>))
42import qualified Data.Vector as V 42import qualified Data.Vector as V
43import Graphics.Rendering.OpenGL.Raw.Core31
44import Unsafe.Coerce (unsafeCoerce) 43import Unsafe.Coerce (unsafeCoerce)
45 44
46type AnimationSpeed = Float 45type AnimationSpeed = Float
diff --git a/Spear/Render/Program.hs b/Spear/Render/Program.hs
index 6e94ca5..8f3fba7 100644
--- a/Spear/Render/Program.hs
+++ b/Spear/Render/Program.hs
@@ -11,9 +11,7 @@ module Spear.Render.Program
11) 11)
12where 12where
13 13
14import Spear.GL (GLSLProgram) 14import Spear.GL
15
16import Graphics.Rendering.OpenGL.Raw.Core31
17 15
18data StaticProgram = StaticProgram 16data StaticProgram = StaticProgram
19 { staticProgram :: GLSLProgram 17 { staticProgram :: GLSLProgram
diff --git a/Spear/Render/StaticModel.hs b/Spear/Render/StaticModel.hs
index 42cf9d0..cadf350 100644
--- a/Spear/Render/StaticModel.hs
+++ b/Spear/Render/StaticModel.hs
@@ -29,7 +29,6 @@ import Spear.Render.Model
29import Spear.Render.Program 29import Spear.Render.Program
30 30
31import qualified Data.Vector as V 31import qualified Data.Vector as V
32import Graphics.Rendering.OpenGL.Raw.Core31
33import Unsafe.Coerce (unsafeCoerce) 32import Unsafe.Coerce (unsafeCoerce)
34 33
35data StaticModelResource = StaticModelResource 34data StaticModelResource = StaticModelResource
diff --git a/Spear/Render/Triangle.hs b/Spear/Render/Triangle.hs
index 296349a..08a2c01 100644
--- a/Spear/Render/Triangle.hs
+++ b/Spear/Render/Triangle.hs
@@ -4,7 +4,5 @@ module Spear.Render.Triangle
4where 4where
5 5
6 6
7import Graphics.Rendering.OpenGL.Raw.Core31 7import Spear.GL
8
9
10 8
diff --git a/Spear/Scene/Loader.hs b/Spear/Scene/Loader.hs
index 22657bd..4467849 100644
--- a/Spear/Scene/Loader.hs
+++ b/Spear/Scene/Loader.hs
@@ -39,7 +39,6 @@ import Control.Monad.Trans (lift)
39import Data.List as L (find) 39import Data.List as L (find)
40import Data.Map as M 40import Data.Map as M
41import qualified Data.StateVar as SV (get) 41import qualified Data.StateVar as SV (get)
42import Graphics.Rendering.OpenGL.Raw.Core31
43import Text.Printf (printf) 42import Text.Printf (printf)
44 43
45type Loader = Game SceneResources 44type Loader = Game SceneResources
@@ -204,7 +203,7 @@ rotateModel (Rotation ax ay az order) model =
204loadTexture :: FilePath -> Loader GL.Texture 203loadTexture :: FilePath -> Loader GL.Texture
205loadTexture file = 204loadTexture file =
206 loadResource file textures addTexture $ 205 loadResource file textures addTexture $
207 GL.loadTextureImage file gl_LINEAR gl_LINEAR 206 GL.loadTextureImage file GL.gl_LINEAR GL.gl_LINEAR
208 207
209newShaderProgram :: SceneGraph -> Loader () 208newShaderProgram :: SceneGraph -> Loader ()
210newShaderProgram (SceneLeaf _ props) = do 209newShaderProgram (SceneLeaf _ props) = do