To openglraw

This commit is contained in:
2023-03-09 21:28:22 +00:00
parent 653de7226e
commit 9989c65d75
5 changed files with 11 additions and 16 deletions
+2 -6
View File
@@ -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
+5 -5
View File
@@ -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
+1 -1
View File
@@ -5,7 +5,7 @@ module MatrixHelper
import Geometry.Data
import Linear.Matrix
import Graphics.Rendering.OpenGL (GLfloat)
import Graphics.GL.Core45
perspectiveMatrixb
:: Float -- ^ Rotation
+2 -3
View File
@@ -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_
+1 -1
View File
@@ -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]