Add uniform buffer window coordinate matrix

This commit is contained in:
2021-06-24 17:17:30 +02:00
parent 9c94ec93bd
commit 93936346f7
3 changed files with 63 additions and 57 deletions
+9 -10
View File
@@ -57,14 +57,6 @@ doDrawing pdata w = do
wallPoints = map fst wallPointsCol
let pmat = perspectiveMatrixb rot camzoom trans wins viewFroms
pmata <- (newMatrix RowMajor $ perspectiveMatrix rot camzoom trans wins viewFroms) :: IO (GLmatrix GLfloat)
-- withMatrix pmata $ \_ ptr ->
-- bufferData UniformBuffer $=
-- (fromIntegral $ sizeOf (head pmat) * length pmat
-- ,ptr
-- ,StreamDraw
-- )
withArray pmat $ \ptr ->
bufferData UniformBuffer $=
(fromIntegral $ sizeOf (head pmat) * length pmat
@@ -72,8 +64,6 @@ doDrawing pdata w = do
,StreamDraw
)
-- bufferData UniformBuffer $=
-- set the coordinate uniforms ready for drawing elements using world coordinates
--setIsoMatrixUniforms pdata rot camzoom trans wins
setPerpMatrixUniforms pdata rot camzoom trans wins viewFroms
@@ -145,6 +135,15 @@ doDrawing pdata w = do
-- reset the coordinate uniforms for pictures that are drawn wrt to window
-- coordinates
resetShaderUniforms (map extractProgAndUnis $ _pictureShaders pdata)
let pmata = perspectiveMatrixc 0 1 (0,0) (2,2)
withArray pmata $ \ptr ->
bufferData UniformBuffer $=
(fromIntegral $ sizeOf (head pmat) * length pmat
,ptr
,StreamDraw
)
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
_ <- renderFoldable pdata (picToLTree Nothing $ fixedCoordPictures w)
eTicks <- SDL.ticks