The sgl/gl module provides a direct interface to the system’s GL library closely following the conventions of the C-language OpenGL API. It provides a binding for each #defined constant (these start with GL_) and for the functions in the GL 1.5 and GLU 1.3 specifications, except for the following:
Vertex arrays (GL 1.5, Section 2.8)
Buffer objects (GL 1.5, Section 2.9)
glGetPointerv (GL 1.5, Section 6.1.11)
Buffer object queries (GL 1.5, Section 6.1.13)
Polygon tessellation (GLU 1.3, Section 5)
gluQuadricCallback (GLU 1.3, Section 6.2)
NURBS (GLU 1.3, Section 7)
If one of the provided functions is not present on your system (e.g. if your system supports only GL 1.3), then the corresponding sgl/gl function raises a run-time exception when invoked.
The functions provided by sgl/gl perform comparable checking to their C-language counterparts; they check the types of their arguments, but do not check the length of array arguments. The following details the kinds of Scheme values that can be provided for each primitive OpenGL type:
OpenGL functions that take vector arguments accept cvector values. The type of the cvector is checked; for example, glVertex3fv expects a vector of GLfloats, so glVertex3fv accepts only a cvector containing reals. See also sgl/gl-vectors. Functions that accept arrays of type void* accept any cvector; you must ensure that you supply the proper kind of vector, as in the C-language OpenGL API.
These functions do not take a size argument, because it is derived from the length of the argument vector.
These functions do not take vector arguments. Instead, they allocate a vector of the requested size and return it.
This function takes in a GLuint vector and textures, and it returns 2 values: the specified boolean and a boolean vector of residences.
Instead of taking a vector argument, these function take an integer argument that specifies the size of the vector that is returned.
This function does not take a vector argument and returns a GLdouble vector of length 4.
These functions deal with strings instead of GLubyte vectors.
Instead of taking pointers to GLdoubles for return values, these function directly return GLdouble vectors.
These functions do not take vectors, instead they return a selection-buffer-object or feedback-buffer-object. The select-buffer->gl-uint-vector and feedback-buffer->gl-float-vector functions copy the contents of the buffer into a vector. Because the OpenGL library writes to the buffer-object on OpenGL function calls after glSelectBuffer or glFeedbackBuffer has returned, if the buffer is garbage collected before OpenGL is finished writing to it, the entire Scheme system can crash. The gl-process-selection function in sgl helps interpret the results of glSelectBuffer in a Scheme-friendly format.
These functions are all direct translations of the C OpenGL API.