(bind-func ShaderProgram
"compile and link shader program (vert and frag shader)"
(lambda (name:String* vert:Shader* geom:Shader* frag:Shader*)
(if (not (and (= (type vert) GL_VERTEX_SHADER)
(= (type geom) GL_GEOMETRY_SHADER)
(= (type frag) GL_FRAGMENT_SHADER)))
(begin (println "Error: input shader types must be vert, geom and frag respectively.")
null)
(let ((program (ShaderProgram:[ShaderProgram*,i32,Shader*,Shader*,Shader*,String*]* (glCreateProgram) vert frag geom name)))
(glAttachShader (id program) (id vert))
(glAttachShader (id program) (id geom))
(glAttachShader (id program) (id frag))
(glLinkProgram (id program))
(gl_print_error "Error making shader program!")
(println 'ShaderProgram: program)
program))))