2020-12-06 07:14:50 +00:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Renderer where
|
|
|
|
|
|
|
|
import qualified Graphics.Rendering.OpenGL as GL
|
|
|
|
|
|
|
|
import Control.Concurrent.STM
|
|
|
|
|
|
|
|
import Foreign.Ptr
|
|
|
|
|
|
|
|
-- internal imports
|
|
|
|
|
2021-04-29 18:28:52 +00:00
|
|
|
import Graphics
|
2020-12-06 07:14:50 +00:00
|
|
|
|
|
|
|
draw :: VertexArray -> IndexBuffer -> Shader -> IO ()
|
|
|
|
draw va ib sp = do
|
|
|
|
bind sp
|
|
|
|
bind va
|
|
|
|
bind ib
|
|
|
|
count <- atomically $ readTVar $ iBufCount ib
|
|
|
|
GL.drawElements GL.Triangles count GL.UnsignedInt nullPtr
|
|
|
|
|
|
|
|
-- clear :: IO ()
|
|
|
|
-- clear = GL.clear [GL.ColorBuffer]
|