On this page:
load-shader
create-program

24 Utility procedures for shaders

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!

procedure

(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.

procedure

(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.