▼ |  | GL: 3-D Graphics

1 | Using Open GL
2 | C-Style Open GL
3 | Racket-Style Open GL
4 | Open GL Vectors
5 | Bitmaps
6 | Initialization
| Index

On this page:

gl-selection-record
gl-accum
gl-active-texture
gl-alpha-func
gl-begin
gl-begin-query
gl-blend-color
gl-blend-equation
gl-blend-func
gl-blend-func-separate
gl-call-list
gl-check-extension
gl-clear
gl-clear-accum
gl-clear-color
gl-clear-depth
gl-clear-index
gl-clear-stencil
gl-clip-plane
gl-color
gl-color-mask
gl-color-material
gl-color-v
gl-copy-pixels
gl-cull-face
gl-cylinder
gl-delete-lists
gl-delete-queries
gl-depth-func
gl-depth-mask
gl-depth-range
gl-disable
gl-disk
gl-edge-flag
gl-enable
gl-end
gl-end-list
gl-end-query
gl-eval-coord
gl-eval-coord-v
gl-eval-mesh
gl-eval-point
gl-feedback-buffer->gl-float-vector
gl-finish
gl-flush
gl-front-face
gl-frustum
gl-gen-lists
gl-gen-queries
gl-get-error
gl-get-string
gl-hint
gl-index
gl-index-mask
gl-index-v
gl-init-names
gl-is-buffer
gl-is-enabled
gl-is-list
gl-is-query
gl-light
gl-light-model
gl-light-model-v
gl-light-v
gl-line-stipple
gl-line-width
gl-list-base
gl-load-identity
gl-load-matrix
gl-load-name
gl-load-transpose-matrix
gl-look-at
gl-map-grid
gl-material
gl-material-v
gl-matrix-mode
gl-mult-matrix
gl-mult-transpose-matrix
gl-multi-tex-coord
gl-multi-tex-coord-v
gl-new-list
gl-new-quadric
gl-normal
gl-normal-v
gl-ortho
gl-ortho-2d
gl-partial-disk
gl-pass-through
gl-perspective
gl-pick-matrix
gl-pixel-store
gl-point-parameter
gl-point-parameter-v
gl-point-size
gl-polygon-mode
gl-polygon-offset
gl-pop-attrib
gl-pop-client-attrib
gl-pop-matrix
gl-pop-name
gl-project
gl-push-matrix
gl-push-name
gl-quadric-draw-style
gl-quadric-normals
gl-quadric-orientation
gl-quadric-texture
gl-raster-pos
gl-raster-pos-v
gl-rect
gl-rect-v
gl-render-mode
gl-rotate
gl-sample-coverage
gl-scale
gl-scissor
gl-secondary-color
gl-secondary-color-v
gl-select-buffer->gl-uint-vector
gl-shade-model
gl-sphere
gl-stencil-func
gl-stencil-mask
gl-stencil-op
gl-tex-coord
gl-tex-coord-v
gl-tex-gen
gl-tex-gen-v
gl-translate
gl-u-get-string
gl-un-project
gl-un-project4
gl-vertex
gl-vertex-v
gl-viewport
gl-window-pos
gl-window-pos-v
gl-process-selection
gl-get-gl-version-number
gl-get-glu-version-number

top ← prev up next →

### 3`` Racket-Style OpenGL

(require sgl) | package: sgl

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 sgl/gl module.

Examples:

> (require sgl sgl/gl-vectors)
> (gl-begin 'triangles)
> (gl-vertex 1 2 3)
> (gl-vertex-v (gl-float-vector 1 2 3 4))
> (gl-end)

> > struct

> > (struct |  | gl-selection-record (min-z max-z stack)

> #:extra-constructor-name make-gl-selection-record)
> min-z : real?
> max-z : real?
> stack : ....

Represents a selection.

> > value

> > gl-accum : procedure?

> > value

> > gl-active-texture : procedure?

> > value

> > gl-alpha-func : procedure?

> > value

> > gl-begin : procedure?

> > value

> > gl-begin-query : procedure?

> > value

> > gl-blend-color : procedure?

> > value

> > gl-blend-equation : procedure?

> > value

> > gl-blend-func : procedure?

> > value

> > gl-blend-func-separate : procedure?

> > value

> > gl-call-list : procedure?

> > value

> > gl-check-extension : procedure?

> > value

> > gl-clear : procedure?

> > value

> > gl-clear-accum : procedure?

> > value

> > gl-clear-color : procedure?

> > value

> > gl-clear-depth : procedure?

> > value

> > gl-clear-index : procedure?

> > value

> > gl-clear-stencil : procedure?

> > value

> > gl-clip-plane : procedure?

> > value

> > gl-color : procedure?

> > value

> > gl-color-mask : procedure?

> > value

> > gl-color-material : procedure?

> > value

> > gl-color-v : procedure?

> > value

> > gl-copy-pixels : procedure?

> > value

> > gl-cull-face : procedure?

> > value

> > gl-cylinder : procedure?

> > value

> > gl-delete-lists : procedure?

> > value

> > gl-delete-queries : procedure?

> > value

> > gl-depth-func : procedure?

> > value

> > gl-depth-mask : procedure?

> > value

> > gl-depth-range : procedure?

> > value

> > gl-disable : procedure?

> > value

> > gl-disk : procedure?

> > value

> > gl-edge-flag : procedure?

> > value

> > gl-enable : procedure?

> > value

> > gl-end : procedure?

> > value

> > gl-end-list : procedure?

> > value

> > gl-end-query : procedure?

> > value

> > gl-eval-coord : procedure?

> > value

> > gl-eval-coord-v : procedure?

> > value

> > gl-eval-mesh : procedure?

> > value

> > gl-eval-point : procedure?

> > value

> > gl-feedback-buffer->gl-float-vector : procedure?

> > value

> > gl-finish : procedure?

> > value

> > gl-flush : procedure?

> > value

> > gl-front-face : procedure?

> > value

> > gl-frustum : procedure?

> > value

> > gl-gen-lists : procedure?

> > value

> > gl-gen-queries : procedure?

> > value

> > gl-get-error : procedure?

> > value

> > gl-get-string : procedure?

> > value

> > gl-hint : procedure?

> > value

> > gl-index : procedure?

> > value

> > gl-index-mask : procedure?

> > value

> > gl-index-v : procedure?

> > value

> > gl-init-names : procedure?

> > value

> > gl-is-buffer : procedure?

> > value

> > gl-is-enabled : procedure?

> > value

> > gl-is-list : procedure?

> > value

> > gl-is-query : procedure?

> > value

> > gl-light : procedure?

> > value

> > gl-light-model : procedure?

> > value

> > gl-light-model-v : procedure?

> > value

> > gl-light-v : procedure?

> > value

> > gl-line-stipple : procedure?

> > value

> > gl-line-width : procedure?

> > value

> > gl-list-base : procedure?

> > value

> > gl-load-identity : procedure?

> > value

> > gl-load-matrix : procedure?

> > value

> > gl-load-name : procedure?

> > value

> > gl-load-transpose-matrix : procedure?

> > value

> > gl-look-at : procedure?

> > value

> > gl-map-grid : procedure?

> > value

> > gl-material : procedure?

> > value

> > gl-material-v : procedure?

> > value

> > gl-matrix-mode : procedure?

> > value

> > gl-mult-matrix : procedure?

> > value

> > gl-mult-transpose-matrix : procedure?

> > value

> > gl-multi-tex-coord : procedure?

> > value

> > gl-multi-tex-coord-v : procedure?

> > value

> > gl-new-list : procedure?

> > value

> > gl-new-quadric : procedure?

> > value

> > gl-normal : procedure?

> > value

> > gl-normal-v : procedure?

> > value

> > gl-ortho : procedure?

> > value

> > gl-ortho-2d : procedure?

> > value

> > gl-partial-disk : procedure?

> > value

> > gl-pass-through : procedure?

> > value

> > gl-perspective : procedure?

> > value

> > gl-pick-matrix : procedure?

> > value

> > gl-pixel-store : procedure?

> > value

> > gl-point-parameter : procedure?

> > value

> > gl-point-parameter-v : procedure?

> > value

> > gl-point-size : procedure?

> > value

> > gl-polygon-mode : procedure?

> > value

> > gl-polygon-offset : procedure?

> > value

> > gl-pop-attrib : procedure?

> > value

> > gl-pop-client-attrib : procedure?

> > value

> > gl-pop-matrix : procedure?

> > value

> > gl-pop-name : procedure?

> > value

> > gl-project : procedure?

> > value

> > gl-push-matrix : procedure?

> > value

> > gl-push-name : procedure?

> > value

> > gl-quadric-draw-style : procedure?

> > value

> > gl-quadric-normals : procedure?

> > value

> > gl-quadric-orientation : procedure?

> > value

> > gl-quadric-texture : procedure?

> > value

> > gl-raster-pos : procedure?

> > value

> > gl-raster-pos-v : procedure?

> > value

> > gl-rect : procedure?

> > value

> > gl-rect-v : procedure?

> > value

> > gl-render-mode : procedure?

> > value

> > gl-rotate : procedure?

> > value

> > gl-sample-coverage : procedure?

> > value

> > gl-scale : procedure?

> > value

> > gl-scissor : procedure?

> > value

> > gl-secondary-color : procedure?

> > value

> > gl-secondary-color-v : procedure?

> > value

> > gl-select-buffer->gl-uint-vector : procedure?

> > value

> > gl-shade-model : procedure?

> > value

> > gl-sphere : procedure?

> > value

> > gl-stencil-func : procedure?

> > value

> > gl-stencil-mask : procedure?

> > value

> > gl-stencil-op : procedure?

> > value

> > gl-tex-coord : procedure?

> > value

> > gl-tex-coord-v : procedure?

> > value

> > gl-tex-gen : procedure?

> > value

> > gl-tex-gen-v : procedure?

> > value

> > gl-translate : procedure?

> > value

> > gl-u-get-string : procedure?

> > value

> > gl-un-project : procedure?

> > value

> > gl-un-project4 : procedure?

> > value

> > gl-vertex : procedure?

> > value

> > gl-vertex-v : procedure?

> > value

> > gl-viewport : procedure?

> > value

> > gl-window-pos : procedure?

> > value

> > gl-window-pos-v : procedure?

Racket-style variants of the OpenGL functions.

> > procedure

> > (gl-process-selection vec hits) → (listof gl-selection-record?)

> vec : gl-uint-vector?
> hits : exact-nonnegative-integer?

Parses the contents of vec from the format used by glSelectBuffer. The second argument should be the number of hits as returned by glRenderMode.

> > procedure

> > (gl-get-gl-version-number) → exact-nonnegative-integer?

Returns the run-time OpenGL version number as an integer: 10, 11, 12, 13, 14, 15, or 20.

> > procedure

> > (gl-get-glu-version-number) → exact-nonnegative-integer?

Returns the run-time GLU version number as an integer: 10, 11, 12, or 13.
top ← prev up next →