3 Racket-Style OpenGL
The functions in sgl use Racket style names instead of
C style names. To convert a C OpenGL name to a Racket OpenGL name,
change the gl prefix to gl-, separate adjacent
words with hyphens, and convert to all lower case. Functions that
have several variants to accommodate different numbers and types of
arguments are collapsed into one or two functions in
sgl. For example, sgl provides two
vertex functions: vertex and vertex-v. The
vertex function accepts 2, 3 or 4 numerical arguments, and
the vertex-v function accepts gl-vectors of length
2, 3 or 4. The C language OpenGL interface, in contrast, has 24
vertex functions: glVertex3i, glVertex4fv, etc.
Functions in sgl take symbols instead of integers for
GLenum arguments. Each function checks that the given symbol is
an acceptable argument and raises an exception if it is not. Given
the name of a C-language #define constant, determine the
corresponding symbolic argument by removing the leading GL_,
converting the letters to lower-case and replacing each _ with
-. For example, GL_TRIANGLES becomes
'triangles, and GL_TRIANGLE_STRIP becomes
'triangle-strip. Additionally, the functions check the
length of any array arguments to ensure that OpenGL does not attempt
to write or read after the array.
The sgl module is not as complete as the
Represents a selection.
Racket-style variants of the OpenGL functions.
Parses the contents of vec
from the format used by
. The second argument should be the number of
hits as returned by glRenderMode
Returns the run-time OpenGL version number as an integer: 10,
11, 12, 13, 14, 15, or
Returns the run-time GLU version number as an integer: 10,
11, 12, or 13.