diff options
author | Jeanne-Kamikaze <jeannekamikaze@gmail.com> | 2013-02-22 17:09:14 +0100 |
---|---|---|
committer | Jeanne-Kamikaze <jeannekamikaze@gmail.com> | 2013-02-22 17:09:14 +0100 |
commit | 44134d7f8f3c13ba232b771eb0b53c249f009eff (patch) | |
tree | e9eb2a79eec0f6e965c3b6882ae4cf6293c2b579 | |
parent | 1f4b8ec3b58e329f27432a3fbc9ab37f3da84899 (diff) |
Switched to Core32; Added GeometryShader to ShaderType
-rw-r--r-- | Spear/GL.hs | 7 | ||||
-rw-r--r-- | Spear/Render/AnimatedModel.hs | 1 | ||||
-rw-r--r-- | Spear/Render/Program.hs | 4 | ||||
-rw-r--r-- | Spear/Render/StaticModel.hs | 1 | ||||
-rw-r--r-- | Spear/Render/Triangle.hs | 4 | ||||
-rw-r--r-- | Spear/Scene/Loader.hs | 3 |
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) | |||
99 | import Foreign.Marshal.Alloc (alloca) | 99 | import Foreign.Marshal.Alloc (alloca) |
100 | import Foreign.Marshal.Array (withArray) | 100 | import Foreign.Marshal.Array (withArray) |
101 | import Foreign.Storable (peek) | 101 | import Foreign.Storable (peek) |
102 | import Graphics.Rendering.OpenGL.Raw.Core31 | 102 | import Graphics.Rendering.OpenGL.Raw.Core32 |
103 | import System.Directory (doesFileExist, getCurrentDirectory, setCurrentDirectory) | 103 | import System.Directory (doesFileExist, getCurrentDirectory, setCurrentDirectory) |
104 | import System.IO (hPutStrLn, stderr) | 104 | import System.IO (hPutStrLn, stderr) |
105 | import Unsafe.Coerce | 105 | import 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. |
130 | data ShaderType = VertexShader | FragmentShader deriving (Eq, Show) | 130 | data ShaderType = VertexShader | FragmentShader | GeometryShader deriving (Eq, Show) |
131 | 131 | ||
132 | toGLShader :: ShaderType -> GLenum | 132 | toGLShader :: ShaderType -> GLenum |
133 | toGLShader VertexShader = gl_VERTEX_SHADER | 133 | toGLShader VertexShader = gl_VERTEX_SHADER |
134 | toGLShader FragmentShader = gl_FRAGMENT_SHADER | 134 | toGLShader FragmentShader = gl_FRAGMENT_SHADER |
135 | toGLShader 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. |
137 | withGLSLProgram :: GLSLProgram -> (GLuint -> a) -> a | 138 | withGLSLProgram :: 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 | ||
41 | import Control.Applicative ((<$>), (<*>)) | 41 | import Control.Applicative ((<$>), (<*>)) |
42 | import qualified Data.Vector as V | 42 | import qualified Data.Vector as V |
43 | import Graphics.Rendering.OpenGL.Raw.Core31 | ||
44 | import Unsafe.Coerce (unsafeCoerce) | 43 | import Unsafe.Coerce (unsafeCoerce) |
45 | 44 | ||
46 | type AnimationSpeed = Float | 45 | type 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 | ) |
12 | where | 12 | where |
13 | 13 | ||
14 | import Spear.GL (GLSLProgram) | 14 | import Spear.GL |
15 | |||
16 | import Graphics.Rendering.OpenGL.Raw.Core31 | ||
17 | 15 | ||
18 | data StaticProgram = StaticProgram | 16 | data 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 | |||
29 | import Spear.Render.Program | 29 | import Spear.Render.Program |
30 | 30 | ||
31 | import qualified Data.Vector as V | 31 | import qualified Data.Vector as V |
32 | import Graphics.Rendering.OpenGL.Raw.Core31 | ||
33 | import Unsafe.Coerce (unsafeCoerce) | 32 | import Unsafe.Coerce (unsafeCoerce) |
34 | 33 | ||
35 | data StaticModelResource = StaticModelResource | 34 | data 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 | |||
4 | where | 4 | where |
5 | 5 | ||
6 | 6 | ||
7 | import Graphics.Rendering.OpenGL.Raw.Core31 | 7 | import 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) | |||
39 | import Data.List as L (find) | 39 | import Data.List as L (find) |
40 | import Data.Map as M | 40 | import Data.Map as M |
41 | import qualified Data.StateVar as SV (get) | 41 | import qualified Data.StateVar as SV (get) |
42 | import Graphics.Rendering.OpenGL.Raw.Core31 | ||
43 | import Text.Printf (printf) | 42 | import Text.Printf (printf) |
44 | 43 | ||
45 | type Loader = Game SceneResources | 44 | type Loader = Game SceneResources |
@@ -204,7 +203,7 @@ rotateModel (Rotation ax ay az order) model = | |||
204 | loadTexture :: FilePath -> Loader GL.Texture | 203 | loadTexture :: FilePath -> Loader GL.Texture |
205 | loadTexture file = | 204 | loadTexture 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 | ||
209 | newShaderProgram :: SceneGraph -> Loader () | 208 | newShaderProgram :: SceneGraph -> Loader () |
210 | newShaderProgram (SceneLeaf _ props) = do | 209 | newShaderProgram (SceneLeaf _ props) = do |