on fec4a41 help sign in
44 lines 1.2 kB history raw
1module Graphics.WebGL (link, mapTriangle, zipTriangle, bind, encapsulate, webgl) where
3{-| WebGL -}
5import Graphics.Element (Element)
6import Native.Graphics.WebGL
7import Signal (Signal)
9data Shader a u v = Dummy_Shader
10data Program a u = Dummy_Program
12link : Shader a u v -> Shader {} {} v -> Program a u
13link = Native.Graphics.WebGL.link
15-- Binder really should not need a program
16-- I need runtime type information from something though...
18type Triangle a = (a,a,a)
20triangle : a -> a -> a -> Triangle a
21triangle = (,,)
23mapTriangle : (a -> b) -> Triangle a -> Triangle b
24mapTriangle f (x,y,z) = (f x, f y, f z)
26zipTriangle : (a -> b -> c) -> Triangle a -> Triangle b -> Triangle c
27zipTriangle f (x,y,z) (x',y',z') = (f x x', f y y', f z z')
29data Buffer a = Dummy_Buffer
31bind : [Triangle a] -> Buffer a
32bind = Native.Graphics.WebGL.bind
34-- Now I cheat here because elm lacks existential types or rank-n
35-- I'm in essense doing the following
36-- data Model = forall a u. Model (Program a u) (Buffer a) u
38data Model = Dummy_Model
40encapsulate : Program a u -> Buffer a -> u -> Model
41encapsulate = Native.Graphics.WebGL.encapsulate
43webgl : (Int,Int) -> [Model] -> Element
44webgl = Native.Graphics.WebGL.webgl