On this page:

24 Utility procedures for shaders

These bindings are in opengl/util and not in opengl.

These procedures can be used to load shaders written in GLSL (the GL Shading Language). Note that these, too, should only be called when an OpenGL context is active!


(load-shader file shader-type)  exact-nonnegative->integer?

  file : (or/c path-string? input-port?)
  shader-type : exact-nonnegative-integer?
Load a shader written in GLSL from a named file or input port.

The parameter shader-type is typically either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER, although modern OpenGL versions define many more shader types. The returned shader object is already compiled and can be passed directly into create-program.


(create-program shader ...)  exact-nonnegative-integer?

  shader : exact-nonnegative-integer?
Create a complete GLSL program from combining several shaders.

This procedure takes shaders as created by load-shader and links them together into a single program. The resulting program is already linked and can be passed directly into glUseProgram.