(bind-func Shader_create
"create (and compile) an OpenGL shader"
(lambda (source:i8* type:GLenum)
(if (not (or (= type GL_VERTEX_SHADER)
(= type GL_FRAGMENT_SHADER)
(= type GL_GEOMETRY_SHADER)))
(begin (println "Error: shader type must be one of GL_VERTEX_SHADER, GL_FRAGMENT_SHADER or GL_GEOMETRY_SHADER")
null)
(let ((shader_id (glCreateShader type))
(source_ptr:i8** (salloc))
(shader (Shader shader_id type)))
(pset! source_ptr 0 source)
(glShaderSource shader_id 1 source_ptr (cast null i32*))
(glCompileShader shader_id)
(Shader_print_info_log shader)
shader))))