24 lines
743 B
Haskell
24 lines
743 B
Haskell
module Shader (drawShaderLay) where
|
|
|
|
import Control.Monad.Primitive
|
|
import qualified Data.Vector.Unboxed.Mutable as UMV
|
|
import Graphics.GL.Core45
|
|
import Shader.Data
|
|
import Shader.Parameters
|
|
|
|
drawShaderLay :: Int -> UMV.MVector (PrimState IO) Int -> Int -> (GLuint, VBO) -> IO ()
|
|
{-# INLINE drawShaderLay #-}
|
|
drawShaderLay l countsVector shadIn fs = do
|
|
i <- UMV.read countsVector shadIn
|
|
glUseProgram (fst fs)
|
|
glUniform1i 0 . fromIntegral $ (l * numSubElements)
|
|
glDrawArrays
|
|
GL_TRIANGLES
|
|
(fromIntegral $ l * numSubElements)
|
|
(drawCountMod shadIn i)
|
|
|
|
drawCountMod :: Int -> Int -> GLsizei
|
|
drawCountMod i n
|
|
| i == 3 = fromIntegral $ 2 * n -- modifies ellipse draw count
|
|
| otherwise = fromIntegral n
|