Next: , Up: GL API   [Index]


3.4.1 OpenGL Operation

3.4.1.1 Begin/End Paradigm

Macro: gl-begin begin-mode body ...

Begin immediate-mode drawing with begin-mode, evaluate the sequence of body expressions, and then end drawing (as with glBegin and glEnd).

The values produced by the last body expression are returned to the continuation of the gl-begin.

Function: gl-edge-flag boundary?

Flag edges as either boundary or nonboundary. Note that the edge mode is only significant if the polygon-mode is line or point.

3.4.1.2 Vertex Specification

Function: gl-vertex x y [z=0.0] [w=1.0]

Draw a vertex at the given coordinates.

The following procedures modify the current per-vertex state. Drawing a vertex captures the current state and associates it with the vertex.

Function: gl-texture-coordinates s [t=0.0] [r=0.0] [q=1.0]

Set the current texture coordinate.

Function: gl-multi-texture-coordinates texture s [t=0.0] [r=0.0] [q=1.0]

Set the current texture coordinate for a specific texture unit.

Function: gl-color red green blue [alpha=1.0]

Set the current color.

Function: gl-vertex-attribute index x [y=0.0] [z=0.0] [w=1.0]

Set the current value of a generic vertex attribute.

Function: gl-normal x y z

Set the current normal vector. By default the normal should have unit length, though setting (enable-cap rescale-normal) or (enable-cap normalize) can change this.

Function: gl-fog-coordinate coord

Set the current fog coordinate.

Function: gl-secondary-color red green blue

Set the current secondary color.

Function: gl-index c

Set the current color index.

3.4.1.3 Rectangles

Function: gl-rectangle x1 y1 x2 y2

Draw a rectangle in immediate-mode with a given pair of corner points.

3.4.1.4 Coordinate Transformation

Function: gl-depth-range near-val far-val

Specify the mapping of the near and far clipping planes, respectively, to window coordinates.

Function: gl-viewport x y width height

Set the viewport: the pixel position of the lower-left corner of the viewport rectangle, and the width and height of the viewport.

Function: gl-load-matrix m [#:transpose=#f]

Load a matrix. m should be a packed vector in column-major order.

Note that Guile’s two-dimensional arrays are stored in row-major order, so you might need to transpose the matrix as it is loaded (via the #:transpose keyword argument).

Function: gl-multiply-matrix m [#:transpose=#f]

Multiply the current matrix by m. As with gl-load-matrix, you might need to transpose the matrix first.

Function: set-gl-matrix-mode matrix-mode

Set the current matrix mode. See the matrix-mode enumerator.

Macro: with-gl-push-matrix body ...

Save the current matrix, evaluate the sequence of body expressions, and restore the saved matrix.

Function: gl-load-identity

Load the identity matrix.

Function: gl-rotate angle x y z

Rotate the current matrix about the vector (x,y,z). angle should be specified in degrees.

Function: gl-translate x y z

Translate the current matrix.

Function: gl-scale x y z

Scale the current matrix.

Function: gl-frustum left right bottom top near-val far-val

Multiply the current matrix by a perspective matrix. left, right, bottom, and top are the coordinates of the corresponding clipping planes. near-val and far-val specify the distances to the near and far clipping planes.

Function: gl-ortho left right bottom top near-val far-val

Multiply the current matrix by a perspective matrix. left, right, bottom, and top are the coordinates of the corresponding clipping planes. near-val and far-val specify the distances to the near and far clipping planes.

Function: set-gl-active-texture texture

Set the active texture unit.

Function: gl-enable enable-cap
Function: gl-disable enable-cap

Enable or disable server-side GL capabilities.

3.4.1.5 Colors and Coloring

Function: set-gl-shade-model mode

Select flat or smooth shading.


Next: , Up: GL API   [Index]