module Main (main) where import Prelude hiding (id) import Lib main :: IO () main = do let -- variables a_vPos = var'vec3 $ id "a_vPos" v_pos = var'vec3 $ id "v_pos" u_view = var'mat4 $ id "u_view" u_projection = var'mat4 $ id "u_projection" -- variable declarations a_vPos' = dec_var (id "a_vPos") T'vec3 v_pos' = dec_var (id "v_pos") T'vec3 u_view' = dec_var (id "u_view") T'mat4 u_projection' = dec_var (id "u_projection") T'mat4 -- shaders (vert, frag) = mkShaders -- uniforms [ u_view' , u_projection'] -- vertex inputs [ (0, a_vPos')] -- gl_Position expression ( u_projection `mul` (u_view `mul` vec4 (v_pos, float 1)) ) -- passthrough [ (v_pos', a_vPos) ] -- output name (id "o_vColor") -- output expression ( vec4 ( float 0.5 `add` float 0.5 `mul` normalize v_pos :: Exp T'vec3 , float 1 ) ) putStrLn $ show vert putStrLn $ show frag putStrLn $ uncheckedCompileShader vert putStrLn $ uncheckedCompileShader frag