To openglraw
This commit is contained in:
+2
-6
@@ -1,9 +1,9 @@
|
|||||||
module GLHelp where
|
module GLHelp where
|
||||||
import Foreign.Ptr
|
|
||||||
import Foreign.Marshal
|
import Foreign.Marshal
|
||||||
|
import Foreign.Ptr
|
||||||
import Foreign.Storable
|
import Foreign.Storable
|
||||||
import Graphics.GL.Core45
|
import Graphics.GL.Core45
|
||||||
import Graphics.Rendering.OpenGL hiding (Point, imageHeight, scale, translate)
|
|
||||||
|
|
||||||
mglCreate :: (GLsizei -> Ptr GLuint -> IO ()) -> IO GLuint
|
mglCreate :: (GLsizei -> Ptr GLuint -> IO ()) -> IO GLuint
|
||||||
mglCreate f = do
|
mglCreate f = do
|
||||||
@@ -13,7 +13,3 @@ mglCreate f = do
|
|||||||
|
|
||||||
mglDelete :: (GLsizei -> Ptr GLuint -> IO ()) -> GLuint -> IO ()
|
mglDelete :: (GLsizei -> Ptr GLuint -> IO ()) -> GLuint -> IO ()
|
||||||
mglDelete f i = with i $ \ptr -> f 1 ptr
|
mglDelete f i = with i $ \ptr -> f 1 ptr
|
||||||
|
|
||||||
unTexture :: TextureObject -> GLuint
|
|
||||||
unTexture (TextureObject t) = t
|
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -19,7 +19,7 @@ import Control.Concurrent
|
|||||||
import Control.Exception
|
import Control.Exception
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Graphics.Rendering.OpenGL as GL
|
import Graphics.GL.Core45
|
||||||
import SDL
|
import SDL
|
||||||
import System.Mem
|
import System.Mem
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
@@ -47,7 +47,7 @@ setupLoop spf title winconfig paramCleanup ioStartWorld sideEffects eventFn = do
|
|||||||
destroyWindow
|
destroyWindow
|
||||||
$ \window -> bracket
|
$ \window -> bracket
|
||||||
(glCreateContext window)
|
(glCreateContext window)
|
||||||
(\con -> GL.finish >> glDeleteContext con)
|
(\con -> glFinish >> glDeleteContext con)
|
||||||
$ \_ ->
|
$ \_ ->
|
||||||
bracket
|
bracket
|
||||||
ioStartWorld
|
ioStartWorld
|
||||||
@@ -89,7 +89,7 @@ applyEventIO fn mw e = case eventPayload e of
|
|||||||
QuitEvent -> return Nothing
|
QuitEvent -> return Nothing
|
||||||
WindowClosedEvent _ -> return Nothing
|
WindowClosedEvent _ -> return Nothing
|
||||||
WindowSizeChangedEvent WindowSizeChangedEventData{windowSizeChangedEventSize = V2 x y} ->
|
WindowSizeChangedEvent WindowSizeChangedEventData{windowSizeChangedEventSize = V2 x y} ->
|
||||||
(GL.viewport $= (GL.Position 0 0, GL.Size x y)) >> mupdate
|
glViewport 0 0 x y >> mupdate
|
||||||
_ -> mupdate
|
_ -> mupdate
|
||||||
where
|
where
|
||||||
mupdate = case mw of
|
mupdate = case mw of
|
||||||
@@ -123,7 +123,7 @@ setupConLoop spf title winconfig paramCleanup ioStartWorld coneffs sideEffects e
|
|||||||
destroyWindow
|
destroyWindow
|
||||||
$ \window -> bracket
|
$ \window -> bracket
|
||||||
(glCreateContext window)
|
(glCreateContext window)
|
||||||
(\con -> GL.finish >> glDeleteContext con)
|
(\con -> glFinish >> glDeleteContext con)
|
||||||
$ \_ ->
|
$ \_ ->
|
||||||
bracket
|
bracket
|
||||||
ioStartWorld
|
ioStartWorld
|
||||||
@@ -213,7 +213,7 @@ setupConLoop' spf title winconfig paramCleanup ioStartWorld coneffs sideEffects
|
|||||||
destroyWindow
|
destroyWindow
|
||||||
$ \window -> bracket
|
$ \window -> bracket
|
||||||
(glCreateContext window)
|
(glCreateContext window)
|
||||||
(\con -> GL.finish >> glDeleteContext con)
|
(\con -> glFinish >> glDeleteContext con)
|
||||||
$ \_ ->
|
$ \_ ->
|
||||||
bracket
|
bracket
|
||||||
ioStartWorld
|
ioStartWorld
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ module MatrixHelper
|
|||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
|
|
||||||
import Linear.Matrix
|
import Linear.Matrix
|
||||||
import Graphics.Rendering.OpenGL (GLfloat)
|
import Graphics.GL.Core45
|
||||||
|
|
||||||
perspectiveMatrixb
|
perspectiveMatrixb
|
||||||
:: Float -- ^ Rotation
|
:: Float -- ^ Rotation
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import Data.Preload.Render
|
|||||||
import qualified Data.Vector.Mutable as MV
|
import qualified Data.Vector.Mutable as MV
|
||||||
import Foreign
|
import Foreign
|
||||||
import Framebuffer.Setup
|
import Framebuffer.Setup
|
||||||
import Graphics.Rendering.OpenGL hiding (Point, imageHeight, scale, translate)
|
|
||||||
import Shader
|
import Shader
|
||||||
import Shader.AuxAddition
|
import Shader.AuxAddition
|
||||||
import Shader.Bind
|
import Shader.Bind
|
||||||
@@ -197,10 +196,10 @@ preloadRender = do
|
|||||||
fboHalf3Name <- setupTextureFramebuffer 300 300
|
fboHalf3Name <- setupTextureFramebuffer 300 300
|
||||||
|
|
||||||
-- reset to default framebuffer, ready for drawing direct to screen
|
-- reset to default framebuffer, ready for drawing direct to screen
|
||||||
bindFramebuffer Framebuffer $= defaultFramebufferObject
|
glBindFramebuffer GL_FRAMEBUFFER 0
|
||||||
|
|
||||||
-- set the clearColor to have 1 alpha
|
-- set the clearColor to have 1 alpha
|
||||||
clearColor $= Color4 0 0 0 1
|
glClearColor 0 0 0 1
|
||||||
|
|
||||||
shadV <- MV.new 6
|
shadV <- MV.new 6
|
||||||
zipWithM_
|
zipWithM_
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ bindShaderLayers shads counts = MV.imapM_ f shads
|
|||||||
f i shad = do
|
f i shad = do
|
||||||
let theVBO = _vaoVBO $ _shadVAO' shad
|
let theVBO = _vaoVBO $ _shadVAO' shad
|
||||||
stride = sum $ _vboAttribSizes theVBO
|
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]
|
VFSM.mapM_ (g stride theVBO) $ VFSM.enumFromStepN 0 1 6 -- [0..5]
|
||||||
--S.mapM_ (g stride theVBO) $ S.each [0..5]
|
--S.mapM_ (g stride theVBO) $ S.each [0..5]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user