From 5fc86af23366bfa205d8d0ab62fa66aa8c1f6813 Mon Sep 17 00:00:00 2001 From: Stefan Dresselhaus Date: Mon, 17 Mar 2014 17:04:30 +0100 Subject: [PATCH] Changed OpenGL-Lvl to 3.30 with Tessellation-Ext - figured out how to enable extensions refs #471 @1h --- shaders/fragment.shader | 2 +- shaders/tessControl.shader | 3 ++- shaders/tessEval.shader | 4 +++- shaders/vertex.shader | 2 +- src/Main.hs | 11 +++++++++-- src/Types.hs | 3 ++- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/shaders/fragment.shader b/shaders/fragment.shader index aeb0ffc..285afcc 100644 --- a/shaders/fragment.shader +++ b/shaders/fragment.shader @@ -1,4 +1,4 @@ -#version 400 +#version 330 //#include "3rdParty/noise.glsl" diff --git a/shaders/tessControl.shader b/shaders/tessControl.shader index 36bae7f..e7a5d25 100644 --- a/shaders/tessControl.shader +++ b/shaders/tessControl.shader @@ -1,4 +1,5 @@ -#version 400 +#version 330 +#extension GL_ARB_tessellation_shader : require layout(vertices = 3) out; in vec3 vPosition[]; diff --git a/shaders/tessEval.shader b/shaders/tessEval.shader index 7ed631a..09f6483 100644 --- a/shaders/tessEval.shader +++ b/shaders/tessEval.shader @@ -1,4 +1,6 @@ -#version 400 +#version 330 + +#extension GL_ARB_tessellation_shader : require layout(triangles, equal_spacing, cw) in; in vec3 tcPosition[]; diff --git a/shaders/vertex.shader b/shaders/vertex.shader index 70b8530..c6e3c7c 100644 --- a/shaders/vertex.shader +++ b/shaders/vertex.shader @@ -1,4 +1,4 @@ -#version 400 +#version 330 //vertex-data in vec4 Color; diff --git a/src/Main.hs b/src/Main.hs index 1233375..43036f9 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -24,7 +24,6 @@ import Control.Lens ((^.), (.~), (%~)) import Linear as L -- GUI -import qualified Graphics.UI.SDL as SDL (Position) import Graphics.UI.SDL as SDL --import Graphics.UI.SDL.TTF as TTF --import Graphics.UI.SDL.TTF.Types @@ -32,7 +31,7 @@ import Graphics.UI.SDL as SDL -- Render import qualified Graphics.Rendering.OpenGL.GL as GL import Graphics.Rendering.OpenGL.Raw.Core31 -import Data.Time (getCurrentTime, UTCTime, diffUTCTime) +import Data.Time (getCurrentTime, diffUTCTime) import Graphics.Rendering.OpenGL.Raw.ARB.TessellationShader -- Our modules @@ -73,6 +72,13 @@ main = do --font <- TTF.openFont "fonts/ttf-04B_03B_/04B_03B_.TTF" 10 --TTF.setFontStyle font TTFNormal --TTF.setFontHinting font TTFHNormal + {-winRenderer <- getRenderer window + hudTex <- createTexture + winRenderer -- where + PixelFormatRGBA8888 -- RGBA32-bit + TextureAccessStreaming -- change occasionally + 1024 -- width + 600 -- height-} let zDistClosest = 1 zDistFarthest = zDistClosest + 30 @@ -145,6 +151,7 @@ main = do } , _gl = GLState { _glMap = glMap + , _hudTexture = Nothing } , _game = GameState { diff --git a/src/Types.hs b/src/Types.hs index 26856c0..8552d57 100644 --- a/src/Types.hs +++ b/src/Types.hs @@ -3,7 +3,7 @@ module Types where import Control.Concurrent.STM (TQueue) import qualified Graphics.Rendering.OpenGL.GL as GL -import Graphics.UI.SDL as SDL (Event, Window) +import Graphics.UI.SDL as SDL (Event, Window, Texture) import Foreign.C (CFloat) import Data.Time (UTCTime) import Linear.Matrix (M44) @@ -88,6 +88,7 @@ data GLMapState = GLMapState data GLState = GLState { _glMap :: !GLMapState + , _hudTexture :: Maybe Texture } data State = State