ShaderProgram   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm

Implementation

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


Back to Index

Similar Entries