From 9989c65d75a476519addd6fca9f4df50cb232983 Mon Sep 17 00:00:00 2001 From: justin Date: Thu, 9 Mar 2023 21:28:22 +0000 Subject: [PATCH] To openglraw --- src/GLHelp.hs | 8 ++------ src/Loop.hs | 10 +++++----- src/MatrixHelper.hs | 2 +- src/Preload/Render.hs | 5 ++--- src/Shader/Bind.hs | 2 +- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/GLHelp.hs b/src/GLHelp.hs index 54e893bba..65e61922b 100644 --- a/src/GLHelp.hs +++ b/src/GLHelp.hs @@ -1,9 +1,9 @@ module GLHelp where -import Foreign.Ptr + import Foreign.Marshal +import Foreign.Ptr import Foreign.Storable import Graphics.GL.Core45 -import Graphics.Rendering.OpenGL hiding (Point, imageHeight, scale, translate) mglCreate :: (GLsizei -> Ptr GLuint -> IO ()) -> IO GLuint mglCreate f = do @@ -13,7 +13,3 @@ mglCreate f = do mglDelete :: (GLsizei -> Ptr GLuint -> IO ()) -> GLuint -> IO () mglDelete f i = with i $ \ptr -> f 1 ptr - -unTexture :: TextureObject -> GLuint -unTexture (TextureObject t) = t - diff --git a/src/Loop.hs b/src/Loop.hs index 388d20feb..31ab908c3 100644 --- a/src/Loop.hs +++ b/src/Loop.hs @@ -19,7 +19,7 @@ import Control.Concurrent import Control.Exception import Control.Monad import qualified Data.Text as T -import qualified Graphics.Rendering.OpenGL as GL +import Graphics.GL.Core45 import SDL import System.Mem import Data.Foldable @@ -47,7 +47,7 @@ setupLoop spf title winconfig paramCleanup ioStartWorld sideEffects eventFn = do destroyWindow $ \window -> bracket (glCreateContext window) - (\con -> GL.finish >> glDeleteContext con) + (\con -> glFinish >> glDeleteContext con) $ \_ -> bracket ioStartWorld @@ -89,7 +89,7 @@ applyEventIO fn mw e = case eventPayload e of QuitEvent -> return Nothing WindowClosedEvent _ -> return Nothing WindowSizeChangedEvent WindowSizeChangedEventData{windowSizeChangedEventSize = V2 x y} -> - (GL.viewport $= (GL.Position 0 0, GL.Size x y)) >> mupdate + glViewport 0 0 x y >> mupdate _ -> mupdate where mupdate = case mw of @@ -123,7 +123,7 @@ setupConLoop spf title winconfig paramCleanup ioStartWorld coneffs sideEffects e destroyWindow $ \window -> bracket (glCreateContext window) - (\con -> GL.finish >> glDeleteContext con) + (\con -> glFinish >> glDeleteContext con) $ \_ -> bracket ioStartWorld @@ -213,7 +213,7 @@ setupConLoop' spf title winconfig paramCleanup ioStartWorld coneffs sideEffects destroyWindow $ \window -> bracket (glCreateContext window) - (\con -> GL.finish >> glDeleteContext con) + (\con -> glFinish >> glDeleteContext con) $ \_ -> bracket ioStartWorld diff --git a/src/MatrixHelper.hs b/src/MatrixHelper.hs index c4e70b247..427a50179 100644 --- a/src/MatrixHelper.hs +++ b/src/MatrixHelper.hs @@ -5,7 +5,7 @@ module MatrixHelper import Geometry.Data import Linear.Matrix -import Graphics.Rendering.OpenGL (GLfloat) +import Graphics.GL.Core45 perspectiveMatrixb :: Float -- ^ Rotation diff --git a/src/Preload/Render.hs b/src/Preload/Render.hs index bea46b152..b137a13f1 100644 --- a/src/Preload/Render.hs +++ b/src/Preload/Render.hs @@ -12,7 +12,6 @@ import Data.Preload.Render import qualified Data.Vector.Mutable as MV import Foreign import Framebuffer.Setup -import Graphics.Rendering.OpenGL hiding (Point, imageHeight, scale, translate) import Shader import Shader.AuxAddition import Shader.Bind @@ -197,10 +196,10 @@ preloadRender = do fboHalf3Name <- setupTextureFramebuffer 300 300 -- reset to default framebuffer, ready for drawing direct to screen - bindFramebuffer Framebuffer $= defaultFramebufferObject + glBindFramebuffer GL_FRAMEBUFFER 0 -- set the clearColor to have 1 alpha - clearColor $= Color4 0 0 0 1 + glClearColor 0 0 0 1 shadV <- MV.new 6 zipWithM_ diff --git a/src/Shader/Bind.hs b/src/Shader/Bind.hs index b2fa55a0b..1efe39bef 100644 --- a/src/Shader/Bind.hs +++ b/src/Shader/Bind.hs @@ -33,7 +33,7 @@ bindShaderLayers shads counts = MV.imapM_ f shads f i shad = do let theVBO = _vaoVBO $ _shadVAO' shad stride = sum $ _vboAttribSizes theVBO - glBindBuffer GL_ARRAY_BUFFER (_vboName $ theVBO) + glBindBuffer GL_ARRAY_BUFFER (_vboName theVBO) VFSM.mapM_ (g stride theVBO) $ VFSM.enumFromStepN 0 1 6 -- [0..5] --S.mapM_ (g stride theVBO) $ S.each [0..5]