svn: r9362
This commit is contained in:
Matthew Flatt 2008-04-18 18:49:23 +00:00
parent 180dc08777
commit 82c212625b
24 changed files with 2155 additions and 987 deletions

View File

@ -5,7 +5,7 @@
games/show-help
games/show-scribbling))
@title{@bold{Games}}
@title{@bold{Games}: Fun Examples}
The @exec{PLT Games} executable (or @exec{plt-games} under Unix) lets
you select one of the games distributed by PLT or other games

View File

@ -407,61 +407,65 @@
;; ----------------------------------------
(define/private (do-table-of-contents part ri delta quiet)
(define/private (do-table-of-contents part ri delta quiet depth)
(make-table #f (generate-toc part
ri
(+ delta
(length (collected-info-number
(part-collected-info part ri))))
#t
quiet)))
quiet
depth)))
(define/public (table-of-contents part ri)
(do-table-of-contents part ri -1 not))
(do-table-of-contents part ri -1 not +inf.0))
(define/public (local-table-of-contents part ri)
(table-of-contents part ri))
(define/public (local-table-of-contents part ri style)
(do-table-of-contents part ri -1 not (if (eq? style 'immediate-only)
1
+inf.0)))
(define/public (quiet-table-of-contents part ri)
(do-table-of-contents part ri 1 (lambda (x) #t)))
(do-table-of-contents part ri 1 (lambda (x) #t) +inf.0))
(define/private (generate-toc part ri base-len skip? quiet)
(define/private (generate-toc part ri base-len skip? quiet depth)
(let* ([number (collected-info-number (part-collected-info part ri))]
[subs
(if (quiet (and (part-style? part 'quiet)
(not (= base-len (sub1 (length number))))))
(apply append (map (lambda (p)
(generate-toc p ri base-len #f quiet))
(part-parts part)))
null)])
(if (and (quiet (and (part-style? part 'quiet)
(not (= base-len (sub1 (length number))))))
(positive? depth))
(apply append (map (lambda (p)
(generate-toc p ri base-len #f quiet (sub1 depth)))
(part-parts part)))
null)])
(if skip?
subs
(let ([l (cons
(list (make-flow
(list
(make-paragraph
subs
(let ([l (cons
(list (make-flow
(list
(make-element
'hspace
(list (make-string (* 2 (- (length number)
base-len))
#\space)))
(make-link-element
(if (= 1 (length number)) "toptoclink" "toclink")
(append
(format-number
number
(list (make-element 'hspace '(" "))))
(or (part-title-content part) '("???")))
(car (part-tags part))))))))
subs)])
(if (and (= 1 (length number))
(or (not (car number)) ((car number) . > . 1)))
(cons (list (make-flow
(list (make-paragraph
(list (make-element 'hspace (list "")))))))
l)
l)))))
(make-paragraph
(list
(make-element
'hspace
(list (make-string (* 2 (- (length number)
base-len))
#\space)))
(make-link-element
(if (= 1 (length number)) "toptoclink" "toclink")
(append
(format-number
number
(list (make-element 'hspace '(" "))))
(or (part-title-content part) '("???")))
(car (part-tags part))))))))
subs)])
(if (and (= 1 (length number))
(or (not (car number)) ((car number) . > . 1)))
(cons (list (make-flow
(list (make-paragraph
(list (make-element 'hspace (list "")))))))
l)
l)))))
;; ----------------------------------------

View File

@ -170,13 +170,13 @@
(define (clean-up s)
;; Remove leading spaces, which might appear there due to images or something
;; else that gets dropped in string form.
(regexp-replace* #rx"^ +" s ""))
(regexp-replace #rx"^ +" s ""))
(define (record-index word-seq element-seq tag content)
(make-index-element #f
(list (make-target-element #f content `(idx ,tag)))
`(idx ,tag)
(map clean-up word-seq)
word-seq
element-seq
#f))
@ -191,7 +191,7 @@
(define (as-index . s)
(let ([key (make-generated-tag)]
[content (decode-content s)])
(record-index (list (content->string content))
(record-index (list (clean-up (content->string content)))
(if (= 1 (length content))
content
(list (make-element #f content)))
@ -294,7 +294,7 @@
(lambda (renderer part ri)
(send renderer table-of-contents part ri))))
(define (local-table-of-contents)
(define (local-table-of-contents #:style [style #f])
(make-delayed-block
(lambda (renderer part ri)
(send renderer local-table-of-contents part ri))))
(send renderer local-table-of-contents part ri style))))

View File

@ -89,7 +89,7 @@
(cons (make-index-element
#f null (car tags)
(list (regexp-replace
#px"^(?:A|An|The)\\s" (content->string title) ""))
#px"^\\s+(?:(?:A|An|The)\\s)?" (content->string title) ""))
(list (make-element #f title))
(make-part-index-desc))
l)

View File

@ -889,7 +889,7 @@
(cond
[(string? i)
(let ([m (and (extra-breaking?)
(regexp-match-positions #rx"[-:/+]" i))])
(regexp-match-positions #rx"[-:/+_]|[a-z](?=[A-Z])" i))])
(if m
(list* (substring i 0 (cdar m))
;; Most browsers wrap after a hyphen. The

View File

@ -382,7 +382,7 @@
;; FIXME: isn't local to the section
(make-toc-paragraph null))
(define/override (local-table-of-contents part ri)
(define/override (local-table-of-contents part ri style)
(make-paragraph null))
;; ----------------------------------------

View File

@ -5,6 +5,8 @@
@guideintro["bytestrings"]{byte strings}
@local-table-of-contents[]
A @pidefterm{byte string} is a fixed-length arary of bytes. A
@pidefterm{byte} is an exact integer between @scheme[0] and
@scheme[255] inclusive.

View File

@ -7,6 +7,8 @@
@guideintro["characters"]{characters}
@local-table-of-contents[]
MzScheme characters range over Unicode scalar values, which includes
characters whose values range from @schemevalfont{#x0} to
@schemevalfont{#x10FFFF}, but not including @schemevalfont{#xD800} to

View File

@ -6,7 +6,7 @@
Each of the built-in datatypes comes with a set of procedures for
manipulating members of the datatype.
@local-table-of-contents[]
@local-table-of-contents[#:style 'immediate-only]
@; ------------------------------------------------------------

View File

@ -9,6 +9,8 @@
@guideintro["numbers"]{numbers}
@local-table-of-contents[]
All numbers are @deftech{complex numbers}. Some of them are
@deftech{real numbers}, and all of the real numbers that can be
represented are also @deftech{rational numbers}, except for

View File

@ -44,6 +44,8 @@
@title[#:tag "pairs"]{Pairs and Lists}
@local-table-of-contents[]
A @deftech{pair} combines exactly two values. The first value is
accessed with the @scheme[car] procedure, and the second value is
accessed with the @scheme[cdr] procedure. Pairs are not mutable (but
@ -532,12 +534,13 @@ must merely start with a chain of at least @scheme[pos] pairs.
@; Note: this is exactly the same description as the one for string-append*
Like @scheme[append], but the last argument is used as a list of
arguments for @scheme[append], so @scheme[(append* x ... xs)] is the
same as @scheme[(apply append x ... xs)]. In other words, the
arguments for @scheme[append], so @scheme[(append* lst ... lsts)] is the
same as @scheme[(apply append lst ... lsts)]. In other words, the
relationship between @scheme[append] and @scheme[append*] is similar
to the one between @scheme[list] and @scheme[list*].
@examples[#:eval list-eval
(append* '(a) '(b) '((c) (d)))
(cdr (append* (map (lambda (x) (list ", " x))
'("Alpha" "Beta" "Gamma"))))
]}

View File

@ -10,6 +10,8 @@
@section-index["strings" "pattern matching"]
@section-index["input ports" "pattern matching"]
@local-table-of-contents[]
Regular expressions are specified as strings or byte strings, using
the same pattern language as the Unix utility @exec{egrep} or Perl. A
string-specified pattern produces a character regexp matcher, and a

View File

@ -5,6 +5,8 @@
@guideintro["strings"]{strings}
@local-table-of-contents[]
A @pidefterm{string} is a fixed-length array of
@seclink["characters"]{characters}.
@ -365,18 +367,20 @@ allocated string).}
@note-lib[scheme/string]
@(define string-eval (make-base-eval))
@interaction-eval[#:eval string-eval (require scheme/string)]
@interaction-eval[#:eval string-eval (require scheme/string scheme/list)]
@defproc[(string-append* [str string?] ... [strs (listof string?)]) string?]{
@; Note: this is exactly the same description as the one for append*
Like @scheme[string-append], but the last argument is used as a list of
arguments for @scheme[string-append], so @scheme[(string-append* x ... xs)] is the
same as @scheme[(apply string-append x ... xs)]. In other words, the
relationship between @scheme[string-append] and @scheme[string-append*] is similar
to the one between @scheme[list] and @scheme[list*].
Like @scheme[string-append], but the last argument is used as a list
of arguments for @scheme[string-append], so @scheme[(string-append*
str ... strs)] is the same as @scheme[(apply string-append str
... strs)]. In other words, the relationship between
@scheme[string-append] and @scheme[string-append*] is similar to the
one between @scheme[list] and @scheme[list*].
@examples[#:eval string-eval
(string-append* "a" "b" '("c" "d"))
(string-append* (cdr (append* (map (lambda (x) (list ", " x))
'("Alpha" "Beta" "Gamma")))))
]}

View File

@ -4,6 +4,8 @@
slideshow/step
slideshow/slides-to-picts))
@(define d=> @elem['rarr])
@title[#:style 'toc]{Making Slides}
@declare-exporting[slideshow/base slideshow]
@ -102,6 +104,7 @@ Creates title text. Returns @scheme[((current-titlet) str)].}
@defproc[(para [#:width width real? (current-para-width)]
[#:align align (one-of/c 'left 'center 'right) 'left]
[#:fill? fill? any/c #t]
[#:decode? decode? any/c #t]
[element (flat-rec-contract elem/c
(or/c string? pict? (listof elem/c)))] ...)
pict?]{
@ -111,11 +114,23 @@ and that is exactly @scheme[width] units if @scheme[fill?] is true. If
@scheme[fill?] is @scheme[#f], then the result pict is as wide as the
widest line.
Each list @scheme[element]s are sliced into the sequence of string and
pict elements. Strings are split at spaces for word-wrapping to fit
the page, and a space is added between elements. If a string element
starts with a punctuation mark (e.g., a comma), however, no space is
added before the string.
Each list within @scheme[element]s is spliced into the sequence of
string and pict elements. If @scheme[decode?] is true, then strings
among the @scheme[element]s are decoded by performing the following
substitutions: @litchar["---"] @d=> @litchar["\u2014"], @litchar["--"]
@d=> @litchar["\u2013"], @litchar["``"] @d=> @litchar["\u201C"],
@litchar["''"] @d=> @litchar["\u201D"], @litchar["'"] @d=>
@litchar["\u2019"].
Strings are split at spaces for word-wrapping to fit the page, and a
space is added between elements. If a string element starts with one
of the following punctuation marks (after decoding), however, no space
is added before the string:
@t{
@hspace[2] @litchar{-} @litchar{'} @litchar{,} @litchar{.} @litchar{ } @litchar{:}
@litchar{;} @litchar{?} @litchar{!} @litchar{)} @litchar["\u201D"] @litchar["\u2019"]
}
The @scheme[align] argument specifies how to align lines within the
paragraph.
@ -128,6 +143,7 @@ See the spacing between lines is determined by the
[#:bullet blt pict? bullet]
[#:align align (one-of/c 'left 'center 'right) 'left]
[#:fill? fill? any/c #t]
[#:decode? decode? any/c #t]
[element (flat-rec-contract elem/c
(or/c string? pict? (listof elem/c)))] ...)
pict?]{
@ -143,6 +159,7 @@ paragraph.}
[#:bullet blt pict? o-bullet]
[#:align align (one-of/c 'left 'center 'right) 'left]
[#:fill? fill? any/c #t]
[#:decode? decode? any/c #t]
[element (flat-rec-contract elem/c
(or/c string? pict? (listof elem/c)))] ...)
pict?]{

View File

@ -1,921 +0,0 @@
_GL_/_OpenGL_ bindings for PLT Scheme
Sgl provides access to the system's GL library, version 1.5, and GLU library,
version 1.3. The GL API and hence the sgl library do not address system level
concerns, such as the attachment of GL rendering contexts to displays. The
sgl library should work with any PLT Scheme extension that provides GL with
access to the system (such as a binding for glx). DrScheme and mred
automatically attach a GL rendering context to each canvas% object on (at
least) Windows, Linux and OS X systems. Refer to the gears.ss example
(${PLTHOME}/collects/sgl/examples/gears.ss) and the with-gl-context method on
canvas% objects for more information on using the built-in GL rendering
context support.
Sgl has two layers, gl.ss and sgl.ss. The gl.ss library provides access to
the C-language-style GL API, whereas the sgl.ss library provides a more
Scheme-like interface. The gl.ss library provides a binding for each #defined
constant and for most functions in GL 1.5 and GLU 1.3. The functions 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 sgl.ss
library provides wrappers around many of the functions in the gl.ss library to
present a more Scheme-friendly interface, including function names that follow
Scheme conventions, and checked, symbolic enumeration arguments, and
array-length checks.
Safety:
GL programming is inherently unsafe, even when using only the sgl.ss library.
Although sgl.ss checks the arguments to each function call, violation of
higher-level assumptions of the system's GL library can cause it to crash,
bringing the entire Scheme system down. For example, sending a large number
of vertices in a single glBegin causes at least some GL implementations to
crash.
_gl.ss_
Use the gl.ss module by adding (require sgl/gl) to your program.
The gl.ss module provides a direct interface to the system's GL library
closely following the conventions of the C-language GL 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 GL 1.3), the function will raise a run-time exception when
invoked.
The names exported from "gl.ss" are case-sensitive (e.g. `glBegin'
instead of `glbegin'), so accessing the bindings from case-insensitive
code is difficult.
Types:
The functions provided by gl.ss 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 chart details what Scheme
values can be passed in for each primitive GL type.
GLtype Scheme value
------------------------------------------------------------------------------
GLbyte, GLshort, GLint exact integer in the proper range
GLubyte, GLushort, GLuint non-negative exact integer in the proper range
GLsizei, GLenum, GLbitfield non-negative exact integer in the proper range
GLfloat, GLdouble real number
GLclampf, GLclampd real number
GLboolean Any value, interpreted such that
#f is GL_FALSE and anything else is GL_TRUE
(This means that you should not usually
GL_FALSE or GL_TRUE as arguments, since they
are bound to integers, both will end up being
converted to GL_TRUE.)
GL functions that take vector arguments accept cvector values. Section 2.4 of
the PLT Foreign Interface Manual describes the functions for creating and
manipulating cvectors (make-cvector, cvector, cvector?, cvector-length,
cvector-type, cvector-ref, cvector-set!, cvector->list, and list->cvector).
The type of the cvector is checked: for example, glVertex3fv expects a vector
of GLfloats, and will only accept a cvector containing GLfloats. The
gl-vector.ss module provides cvector operations that account for the GL type
information. Functions that accept arrays of type void* will accept any
cvector, you must ensure that you supply the proper kind of vector, as in the
C-language GL API.
The following functions have interfaces that differ from their C-language
counterparts. The function index at the end of this document refers back
to these notes for each function.
1: glPixelMap
glDeleteTextures
glDeleteQueries
These functions do not take a size argument, it is derived from the length of
the argument vector.
2: glGenTextures
glGenQueries
These functions do not take vector arguments. Instead, they allocate a vector
of the requested size and return it.
3: glAreTexturesResident
This function takes in a single uint vector, textures, and returns 2 values:
the specified boolean and a boolean vector residences.
4: glGetBooleanv
glGetIntegerv
glGetFloatv
glGetDoublev
glGetLight
glGetMaterial
glGetTexEnv
glGetTexGen
glGetTexParameter
glGetTexLevelParameter
glGetPixelMap
glGetMap
glGetBufferParameter
glGetConvolutionParameter
glGetHistogramParameter
glGetMinmaxParameter
glGetQuery
glGetQueryObject
Instead of taking a vector argument, these function take an integer argument
that specifies the size of the vector which is returned.
5: glGetClipPlane
This function does not take a vector argument and returns a double vector of
length 4.
6: glGetString
gluCheckExtension
gluErrorString
gluGetString
These functions deal with strings instead of ubyte vectors.
7: gluProject
gluUnProject
gluUnProject4
Instead of taking pointers to doubles for return values, these function
directly return double vectors.
8: glSelectBuffer
glFeedbackBuffer
These functions do not take vectors, instead they return a
selection-buffer-object or feedback-buffer-object. The gl.ss library provides
the functions select-buffer->gl-uint-vector and
feedback-buffer->gl-float-vector to copy the contents of the buffer into a
vector. Because the GL library writes to the buffer-object on GL function
calls after glSelectBuffer or glFeedbackBuffer has returned, if the buffer is
garbage collected before GL is finished writing to it, the entire Scheme
system can crash. The process-selection function in sgl helps interpret the
results of glSelectBuffer in a Scheme-friendly format.
Notational Example:
(require sgl/gl
sgl/gl-vectors)
(glBegin GL_TRIANGLES)
(glVertex3i 1 2 3)
(glVertex4fv (gl-float-vector 1 2 3 4))
(glEnd)
See alpha.ss in the examples subdirectory of the sgl collection
(${PLTHOME}/collects/sgl/examples/alpha.ss) for a working example. Try
choosing the sk.jpg file in the icons when this example asks you for a file.
You may have to press "t" a few times if the spinning cube is blank.
_gl-vectors.ss_
The gl-vectors module supports GL programming with cvectors. In this
document, and in the error messages, a gl-vector is just a cvector, from (lib
"foreign.ss"), and a gl-<type>-vector is a cvector with an appropriate type.
Use this module by adding (require sgl/gl-vectors) to your
program. I suggest using this module instead of using the cvector function
directly because these functions are specialized to handling the GL typedefs
correctly.
The gl-vectors.ss module provides the following functions, which are synonyms
for the corresponding cvector functions:
gl-vector->vector
gl-vector->list
gl-vector-length
gl-vector-ref
gl-vector-set!
gl-vector?
Furthermore, for each <type> in byte, ubyte, short, ushort, int, uint, float,
double, boolean gl-vectors.ss provides the following functions:
gl-<type>-vector?: any -> boolean
True when the argument is a gl-<type>-vector
make-gl-<type>-vector: non-negative-integer -> gl-<type>-vector
Makes a gl-<type>-vector of the given length
gl-<type>-vector: X ... -> gl-<type>-vector
Makes a gl-<type>-vector from the given arguments
vector->gl-<type>-vector: vector -> gl-<type>-vector
Converts a Scheme vector into the specified gl-<type>-vector
list->gl-<type>-vector: vector -> gl-<type>-vector
Converts a Scheme list into the specified gl-<type>-vector
gl-<type>-vector+: gl-vector ... -> gl-type-vector
Computes the element-by-element sum of the given gl-vectors and places the
result into a gl-<type>-vector
gl-<type>-vector-: gl-vector ... -> gl-type-vector
Computes the element-by-element difference of the given gl-vectors and
places the result into a gl-<type>-vector
gl-<type>-vector*: real-number gl-vector -> gl-type-vector
Multiplies each element of the given gl-vector by the given number and
places the result into a gl-<type>-vector
Finally, the following functions are also provided.
gl-vector-norm: gl-vector -> real-number
Returns the square root of the sum of the squares of the elements of the
given gl-vector
_sgl.ss_
Use the sgl.ss module by adding (require sgl/sgl) to your program. To get it
with all function names prefixed with "gl-" use (require sgl) (which is
actually sgl/main, reproviding everything from sgl.ss with the prefix). Or you
can also use (require (prefix <some-prefix> sgl/sgl)) directly instead. The
sgl.ss module provides a more Scheme-like interface to the GL functions in
gl.ss.
Functions in sgl.ss 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 all
underscores with dashes. 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 GL does not attempt to write
or read after the array.
The functions in sgl.ss use Scheme style names instead of C style names. To
convert a C GL name to a Scheme GL name, drop the leading "gl" (use the
require form to choose whatever prefix you desire, as above), 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.ss. For example, sgl.ss
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 GL interface has 24 vertex
functions glVertex3i, glVertex4fv, etc.
The sgl.ss module is not yet complete and many functions from the gl module do
not yet have counterparts in the sgl.ss module. See the list of functions
below.
Notational Example:
(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)
See gears.ss in the examples subdirectory of the sgl collection
(${PLTHOME}/collects/sgl/examples/gears.ss) for a working example. Also see
the checkers game in ${PLTHOME}/collects/games/checkers/checkers.ss.
sgl provides the following utility functions that have no OpenGL counterpart:
process-selection: gl-uint-vector int -> (listof selection-record)
where a selection-record is defined by this exported struct:
(define-struct selection-record (min-z max-z stack)).
process-selection parses the contents of a gl-vector from the format used by
glSelectBuffer. The second argument should be the number of hits as returned
by glRenderMode.
get-gl-version-number: -> int
Returns the version number as an integer: 10, 11, 12, 13, 14, 15, or 20.
get-glu-version-number: -> int
Returns the version number as an integer: 10, 11, 12, or 13.
_bitmap.ss_
The "bitmap.ss" library in the "sgl" collection provides a helper
function for converting a MrEd bitmap to a GL list:
> (bitmap->gl-list bitmap #:with-gl with-gl-proc
#:mask bitmap)
Converts the given bitmap (an instance of bitmap%) into a GL list that
can be rendered with `call-list' or `glCallList'. The rendered object
is a square on the z=0 plane with corners at (0,0) and (1,1).
If `with-gl-proc' is provided, it must accept a thunk and call it
while the relevant GL context is selected. Otherwise, the relevant GL
context must be selected already.
If `mask' is given, it is used as the mask bitmap (for extracting
alpha values). The default is the result of the `get-loaded-mask'
method of `bm'.
=================================================================
Function indexes
=================================================================
---------------------------- sgl.ss: ----------------------------
(struct selection-record (min-z max-z stack))
accum
active-texture
alpha-func
begin
begin-query
blend-color
blend-equation
blend-func
blend-func-separate
call-list
check-extension
clear
clear-accum
clear-color
clear-depth
clear-index
clear-stencil
clip-plane
color
color-mask
color-material
color-v
copy-pixels
cull-face
cylinder
delete-lists
delete-queries
depth-func
depth-mask
depth-range
disable
disk
edge-flag
enable
end
end-list
end-query
eval-coord
eval-coord-v
eval-mesh
eval-point
feedback-buffer->gl-float-vector
finish
flush
front-face
frustum
gen-lists
gen-queries
get-error
get-string
get-gl-version-number
get-glu-version-number
hint
index
index-mask
index-v
init-names
is-buffer
is-enabled
is-list
is-query
light
light-model
light-model-v
light-v
line-stipple
line-width
list-base
load-identity
load-matrix
load-name
load-transpose-matrix
look-at
map-grid
material
material-v
matrix-mode
mult-matrix
mult-transpose-matrix
multi-tex-coord
multi-tex-coord-v
new-list
new-quadric
normal
normal-v
ortho
ortho-2d
partial-disk
pass-through
perspective
pick-matrix
pixel-store
point-parameter
point-parameter-v
point-size
polygon-mode
polygon-offset
pop-attrib
pop-client-attrib
pop-matrix
pop-name
process-selection
project
push-matrix
push-name
quadric-draw-style
quadric-normals
quadric-orientation
quadric-texture
raster-pos
raster-pos-v
rect
rect-v
render-mode
rotate
sample-coverage
scale
scissor
secondary-color
secondary-color-v
select-buffer->gl-uint-vector
shade-model
sphere
stencil-func
stencil-mask
stencil-op
tex-coord
tex-coord-v
tex-gen
tex-gen-v
translate
u-get-string
un-project
un-project4
vertex
vertex-v
viewport
window-pos
window-pos-v
----------------------------- gl.ss: -----------------------------
glAccum
glActiveTexture
glAlphaFunc
glAreTexturesResident *3
glBegin
glBeginQuery
glBindTexture
glBitmap
glBlendColor
glBlendEquation
glBlendFunc
glBlendFuncSeparate
glCallList
glCallLists
glClear
glClearAccum
glClearColor
glClearDepth
glClearIndex
glClearStencil
glClipPlane
glColor3b
glColor3bv
glColor3d
glColor3dv
glColor3f
glColor3fv
glColor3i
glColor3iv
glColor3s
glColor3sv
glColor3ub
glColor3ubv
glColor3ui
glColor3uiv
glColor3us
glColor3usv
glColor4b
glColor4bv
glColor4d
glColor4dv
glColor4f
glColor4fv
glColor4i
glColor4iv
glColor4s
glColor4sv
glColor4ub
glColor4ubv
glColor4ui
glColor4uiv
glColor4us
glColor4usv
glColorMask
glColorMaterial
glColorSubTable
glColorTable
glColorTableParameterfv
glColorTableParameteriv
glCompressedTexImage1D
glCompressedTexImage2D
glCompressedTexImage3D
glCompressedTexSubImage1D
glCompressedTexSubImage2D
glCompressedTexSubImage3D
glConvolutionFilter1D
glConvolutionFilter2D
glConvolutionParameterf
glConvolutionParameterfv
glConvolutionParameteri
glConvolutionParameteriv
glCopyColorSubTable
glCopyColorTable
glCopyConvolutionFilter1D
glCopyConvolutionFilter2D
glCopyPixels
glCopyTexImage1D
glCopyTexImage2D
glCopyTexSubImage1D
glCopyTexSubImage2D
glCopyTexSubImage3D
glCullFace
glDeleteLists
glDeleteQueries *1
glDeleteTextures *1
glDepthFunc
glDepthMask
glDepthRange
glDisable
glDrawBuffer
glDrawPixels
glEdgeFlag
glEdgeFlagv
glEnable
glEnd
glEndList
glEndQuery
glEvalCoord1d
glEvalCoord1dv
glEvalCoord1f
glEvalCoord1fv
glEvalCoord2d
glEvalCoord2dv
glEvalCoord2f
glEvalCoord2fv
glEvalMesh1
glEvalMesh2
glEvalPoint1
glEvalPoint2
glFeedbackBuffer *8
glFinish
glFlush
glFogCoordd
glFogCoorddv
glFogCoordf
glFogCoordfv
glFogf
glFogfv
glFogi
glFogiv
glFrontFace
glFrustum
glGenLists
glGenQueries *2
glGenTextures *2
glGetBooleanv *4
glGetBufferParameteriv *4
glGetClipPlane *5
glGetColorTable
glGetCompressedTexImage
glGetConvolutionFilter
glGetConvolutionParameterfv *4
glGetConvolutionParameteriv *4
glGetDoublev *4
glGetError
glGetFloatv *4
glGetHistogram
glGetHistogramParameterfv *4
glGetHistogramParameteriv *4
glGetIntegerv *4
glGetLightfv *5
glGetLightiv *5
glGetMapdv *4
glGetMapfv *4
glGetMapiv *4
glGetMaterialfv *4
glGetMaterialiv *4
glGetMinmax
glGetMinmaxParameterfv *4
glGetMinmaxParameteriv *4
glGetPixelMapfv *4
glGetPixelMapuiv *4
glGetPixelMapusv *4
glGetPolygonStipple
glGetQueryObjectiv *4
glGetQueryObjectuiv *4
glGetQueryiv *4
glGetSeparableFilter
glGetString *6
glGetTexEnvfv *4
glGetTexEnviv *4
glGetTexGendv *4
glGetTexGenfv *4
glGetTexGeniv *4
glGetTexImage
glGetTexLevelParameterfv *4
glGetTexLevelParameteriv *4
glGetTexParameterfv *4
glGetTexParameteriv *4
glHint
glHistogram
glIndexMask
glIndexd
glIndexdv
glIndexf
glIndexfv
glIndexi
glIndexiv
glIndexs
glIndexsv
glIndexub
glIndexubv
glInitNames
glIsBuffer
glIsEnabled
glIsList
glIsQuery
glIsTexture
glLightModelf
glLightModelfv
glLightModeli
glLightModeliv
glLightf
glLightfv
glLighti
glLightiv
glLineStipple
glLineWidth
glListBase
glLoadIdentity
glLoadMatrixd
glLoadMatrixf
glLoadName
glLoadTransposeMatrixd
glLoadTransposeMatrixf
glLogicOp
glMap1d
glMap1f
glMap2d
glMap2f
glMapGrid1d
glMapGrid1f
glMapGrid2d
glMapGrid2f
glMaterialf
glMaterialfv
glMateriali
glMaterialiv
glMatrixMode
glMinmax
glMultMatrixd
glMultMatrixf
glMultTransposeMatrixd
glMultTransposeMatrixf
glMultiTexCoord1d
glMultiTexCoord1dv
glMultiTexCoord1f
glMultiTexCoord1fv
glMultiTexCoord1i
glMultiTexCoord1iv
glMultiTexCoord1s
glMultiTexCoord1sv
glMultiTexCoord2d
glMultiTexCoord2dv
glMultiTexCoord2f
glMultiTexCoord2fv
glMultiTexCoord2i
glMultiTexCoord2iv
glMultiTexCoord2s
glMultiTexCoord2sv
glMultiTexCoord3d
glMultiTexCoord3dv
glMultiTexCoord3f
glMultiTexCoord3fv
glMultiTexCoord3i
glMultiTexCoord3iv
glMultiTexCoord3s
glMultiTexCoord3sv
glMultiTexCoord4d
glMultiTexCoord4dv
glMultiTexCoord4f
glMultiTexCoord4fv
glMultiTexCoord4i
glMultiTexCoord4iv
glMultiTexCoord4s
glMultiTexCoord4sv
glNewList
glNormal3b
glNormal3bv
glNormal3d
glNormal3dv
glNormal3f
glNormal3fv
glNormal3i
glNormal3iv
glNormal3s
glNormal3sv
glOrtho
glPassThrough
glPixelMapfv *1
glPixelMapuiv *1
glPixelMapusv *1
glPixelStoref
glPixelStorei
glPixelTransferf
glPixelTransferi
glPixelZoom
glPointParameterf
glPointParameterfv
glPointParameteri
glPointParameteriv
glPointSize
glPolygonMode
glPolygonOffset
glPolygonStipple
glPopAttrib
glPopClientAttrib
glPopMatrix
glPopName
glPushAttrib
glPushClientAttrib
glPushMatrix
glPushName
glRasterPos2d
glRasterPos2dv
glRasterPos2f
glRasterPos2fv
glRasterPos2i
glRasterPos2iv
glRasterPos2s
glRasterPos2sv
glRasterPos3d
glRasterPos3dv
glRasterPos3f
glRasterPos3fv
glRasterPos3i
glRasterPos3iv
glRasterPos3s
glRasterPos3sv
glRasterPos4d
glRasterPos4dv
glRasterPos4f
glRasterPos4fv
glRasterPos4i
glRasterPos4iv
glRasterPos4s
glRasterPos4sv
glReadBuffer
glReadPixels
glRectd
glRectdv
glRectf
glRectfv
glRecti
glRectiv
glRects
glRectsv
glRenderMode
glResetHistogram
glResetMinmax
glRotated
glRotatef
glSampleCoverage
glScaled
glScalef
glScissor
glSecondaryColor3b
glSecondaryColor3bv
glSecondaryColor3d
glSecondaryColor3dv
glSecondaryColor3f
glSecondaryColor3fv
glSecondaryColor3i
glSecondaryColor3iv
glSecondaryColor3s
glSecondaryColor3sv
glSecondaryColor3ub
glSecondaryColor3ubv
glSecondaryColor3ui
glSecondaryColor3uiv
glSecondaryColor3us
glSecondaryColor3usv
glSelectBuffer *8
glSeparableFilter2D
glShadeModel
glStencilFunc
glStencilMask
glStencilOp
glTexCoord1d
glTexCoord1dv
glTexCoord1f
glTexCoord1fv
glTexCoord1i
glTexCoord1iv
glTexCoord1s
glTexCoord1sv
glTexCoord2d
glTexCoord2dv
glTexCoord2f
glTexCoord2fv
glTexCoord2i
glTexCoord2iv
glTexCoord2s
glTexCoord2sv
glTexCoord3d
glTexCoord3dv
glTexCoord3f
glTexCoord3fv
glTexCoord3i
glTexCoord3iv
glTexCoord3s
glTexCoord3sv
glTexCoord4d
glTexCoord4dv
glTexCoord4f
glTexCoord4fv
glTexCoord4i
glTexCoord4iv
glTexCoord4s
glTexCoord4sv
glTexEnvf
glTexEnvfv
glTexEnvi
glTexEnviv
glTexGend
glTexGendv
glTexGenf
glTexGenfv
glTexGeni
glTexGeniv
glTexImage1D
glTexImage2D
glTexImage3D
glTexParameterf
glTexParameterfv
glTexParameteri
glTexParameteriv
glTexSubImage1D
glTexSubImage2D
glTexSubImage3D
glTranslated
glTranslatef
glVertex2d
glVertex2dv
glVertex2f
glVertex2fv
glVertex2i
glVertex2iv
glVertex2s
glVertex2sv
glVertex3d
glVertex3dv
glVertex3f
glVertex3fv
glVertex3i
glVertex3iv
glVertex3s
glVertex3sv
glVertex4d
glVertex4dv
glVertex4f
glVertex4fv
glVertex4i
glVertex4iv
glVertex4s
glVertex4sv
glViewport
glWindowPos2d
glWindowPos2dv
glWindowPos2f
glWindowPos2fv
glWindowPos2i
glWindowPos2iv
glWindowPos2s
glWindowPos2sv
glWindowPos3d
glWindowPos3dv
glWindowPos3f
glWindowPos3fv
glWindowPos3i
glWindowPos3iv
glWindowPos3s
glWindowPos3sv
gluBuild1DMipmapLevels
gluBuild1DMipmaps
gluBuild2DMipmapLevels
gluBuild2DMipmaps
gluBuild3DMipmapLevels
gluBuild3DMipmaps
gluCheckExtension *6
gluCylinder
gluDisk
gluErrorString *6
gluGetString *6
gluLookAt
gluNewQuadric
gluOrtho2D
gluPartialDisk
gluPerspective
gluPickMatrix
gluProject *7
gluQuadricDrawStyle
gluQuadricNormals
gluQuadricOrientation
gluQuadricTexture
gluScaleImage
gluSphere
gluUnProject *7
gluUnProject4 *7

View File

@ -13,6 +13,10 @@
[(macosx) (ffi-lib "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU")]
[else (ffi-lib "libGLU")]))
(define (unavailable name)
(lambda x
(error 'name "unavailable on this system")))
(define-syntax define-foreign-lib
(syntax-rules (->)
((_ lib name type ... ->)
@ -22,10 +26,7 @@
;(printf "~a~n" 'name)
(provide name)
(define name
(get-ffi-obj 'name lib (_fun type ...)
(lambda ()
(lambda x
(error 'name "unavailable on this system")))))))))
(get-ffi-obj 'name lib (_fun type ...) (unavailable 'name)))))))
(define-syntax define-foreign
(syntax-rules ()

View File

@ -5,3 +5,5 @@
(define clean (list (build-path "compiled" "native" (system-library-subpath))
"compiled"))
(define compile-omit-paths '("examples"))
(define scribblings '(("scribblings/sgl.scrbl" (multi-page))))

View File

@ -0,0 +1,28 @@
#lang scribble/doc
@(require "common.ss"
(for-label scheme/class))
@title[#:tag "bitmaps"]{Bitmaps}
@defmodule[sgl/bitmap]
@defproc[(bitmap->gl-list [bitmap (is-a?/c bitmap%)]
[#:with-gl with-gl-proc ((-> any) . -> . any)
(lambda (f) (f))]
[#:mask mask (or/c (is-a?/c bitmap%) false/c)
(send bitmap get-loaded-mask)])
exact-integer?]{
Converts the given bitmap into an OpenGL list that can be rendered
with @scheme[gl-call-list] or @scheme[glCallList]. The rendered object
is a square on the @math{z=0} plane with corners at @math{(0,0)} and
@math{(1,1)}.
The @scheme[with-gl-proc] must accept a thunk and call it while the
relevant OpenGL context is selected. Otherwise, the relevant OpenGL
context must be selected already.
If @scheme[mask] is not @scheme[#f], it is used as the mask bitmap for
extracting alpha values.}

View File

@ -0,0 +1,20 @@
#lang scheme/base
(require scribble/manual
scribble/bnf
(for-label scheme/base
scheme/contract
scheme/gui/base
(except-in scheme/foreign ->)
sgl
sgl/gl
sgl/gl-vectors))
(provide (all-from-out scribble/manual)
(for-label (all-from-out scheme/base
scheme/contract
scheme/gui/base
scheme/foreign
sgl
sgl/gl
sgl/gl-vectors)))

View File

@ -0,0 +1,88 @@
#lang scribble/doc
@(require "common.ss"
scribble/bnf
(for-syntax scheme/base))
@title[#:tag "gl-vectors"]{OpenGL Vectors}
@defmodule[sgl/gl-vectors]
The @schememodname[sgl/gl-vectors] module supports OpenGL programming
with @scheme[cvector]s. In this document and in the error messages, a
``gl-vector'' is just a @scheme[cvector], while a
``gl-@nonterm{type}-vector'' is a @scheme[cvector] with an appropriate
type. Using the @schememodname[sgl/gl-vectors] module instead of using
@scheme[cvector] directly because these functions are specialized to
handling the OpenGL types correctly.
@deftogether[(
@defproc[(gl-vector? [v any/c]) boolean?]
@defproc[(gl-vector->vector [vec cvector?]) vector?]
@defproc[(gl-vector->list [vec cvector?]) list?]
@defproc[(gl-vector-length [vec cvector?]) exact-nonnegative-integer?]
@defproc[(gl-vector-ref [vec cvector?][pos exact-nonnegative-integer?]) any/v]
@defproc[(gl-vector-set! [vec cvector?][pos exact-nonnegative-integer?][v any/v]) void?]
)]{
Synonyms for @scheme[cvector?], @scheme[cvector->vector], @scheme[cvector-length], etc.}
@(define-syntax (define-gl-vector stx)
(syntax-case stx ()
[(_ type)
(let ([mk (lambda s
(string->symbol (apply string-append s)))]
[type (symbol->string (syntax-e #'type))]
[locs (lambda (l)
(datum->syntax #'here
(list
(datum->syntax #'here
(car l)
#("?" 1 1 2 1))
(datum->syntax #'here
(car l)
#("?" 1 3 4 1)))
#("?" 1 0 1 3)))])
(with-syntax ([<type> (mk type)]
[<type>? (mk type "?")]
[gl-<type>-vector? (mk "gl-" type "-vector?")]
[gl-<type>-vector (mk "gl-" type "-vector")]
[make-gl-<type>-vector (mk "make-gl-" type "-vector")]
[vector->gl-<type>-vector (mk "vector->gl-" type "-vector")]
[list->gl-<type>-vector (mk "list->gl-" type "-vector")]
[gl-<type>-vector+ (mk "gl-" type "-vector+")]
[gl-<type>-vector- (mk "gl-" type "-vector-")]
[gl-<type>-vector* (mk "gl-" type "-vector*")]
[vectorof-<type>? (locs `(vectorof ,(mk type "?")))]
[listof-<type>? (locs `(listof ,(mk type "?")))])
#'(...
@deftogether[(
@defproc[(gl-<type>-vector? [v any/c]) boolean?]
@defproc[(make-gl-<type>-vector [pos exact-nonnegative-integer?]) gl-<type>-vector?]
@defproc[(gl-<type>-vector [v <type>?] ...) gl-<type>-vector?]
@defproc[(vector->gl-<type>-vector [v vectorof-<type>?] ...) gl-<type>-vector?]
@defproc[(list->gl-<type>-vector [v listof-<type>?] ...) gl-<type>-vector?]
@defproc[(gl-<type>-vector+ [vec gl-<type>-vector?] ...+) gl-<type>-vector?]
@defproc[(gl-<type>-vector- [vec gl-<type>-vector?] ...+) gl-<type>-vector?]
@defproc[(gl-<type>-vector* [x real?][vec gl-<type>-vector?]) gl-<type>-vector?]
)]{
Operations on vectors of @scheme[<type>] elements. The @scheme[gl-<type>-vector+]
and @scheme[gl-<type>-vector-] functions compute the element-by-element sum and
difference of the given vectors, respectively. The @scheme[gl-<type>-vector*] function
multiplies each element of @scheme[vec] by @scheme[x].})))]))
@(define-gl-vector byte)
@(define-gl-vector ubyte)
@(define-gl-vector short)
@(define-gl-vector ushort)
@(define-gl-vector int)
@(define-gl-vector uint)
@(define-gl-vector float)
@(define-gl-vector double)
@(define-gl-vector boolean)
@defproc[(gl-vector-norm [vec gl-vector?]) real?]{
Returns the square root of the sum of the squares of the elements
of @scheme[vec].}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,217 @@
#lang scribble/doc
@(require "common.ss"
scribble/eval
(for-syntax scheme/base))
@title[#:tag "main"]{Scheme-Style OpenGL}
@defmodule[sgl]
The functions in @schememodname[sgl] use Scheme style names instead of
C style names. To convert a C OpenGL name to a Scheme OpenGL name,
change the @tt{gl} prefix to @schemeidfont{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
@schememodname[sgl]. For example, @schememodname[sgl] provides two
vertex functions: @scheme[vertex] and @scheme[vertex-v]. The
@scheme[vertex] function accepts 2, 3 or 4 numerical arguments, and
the @scheme[vertex-v] function accepts @scheme[gl-vector]s of length
2, 3 or 4. The C language OpenGL interface, in contrast, has 24
vertex functions: @tt{glVertex3i}, @tt{glVertex4fv}, etc.
Functions in @schememodname[sgl] take symbols instead of integers for
@tt{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 @tt{#define} constant, determine the
corresponding symbolic argument by removing the leading @tt{GL_},
converting the letters to lower-case and replacing each @tt{_} with
@schemeidfont{-}. For example, @tt{GL_TRIANGLES} becomes
@scheme['triangles], and @tt{GL_TRIANGLE_STRIP} becomes
@scheme['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 @schememodname[sgl] module is not as complete as the
@schememodname[sgl/gl] module.
@as-examples[
@schemeblock[
(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)
]]
@defstruct[selection-record ([min-z real?] [max-z real?] [stack ....])]{
Represents a selection.}
@(define-syntax-rule (def-scheme-gl (id ...) body ...)
@deftogether[(
@defthing[id procedure?] ...
) body ...])
@def-scheme-gl[(
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-process-selection
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
)]{
Scheme-style variants of the OpenGL functions.}
@defproc[(process-selection [vec gl-uint-vector?]
[hits exact-nonnegative-integer?])
(listof selection-record?)]{
Parses the contents of @scheme[vec] from the format used by
@scheme[glSelectBuffer]. The second argument should be the number of
hits as returned by @scheme[glRenderMode].}
@defproc[(get-gl-version-number) exact-nonnegative-integer?]{
Returns the run-time OpenGL version number as an integer: @scheme[10],
@scheme[11], @scheme[12], @scheme[13], @scheme[14], @scheme[15], or
@scheme[20].}
@defproc[(get-glu-version-number) exact-nonnegative-integer?]{
Returns the run-time GLU version number as an integer: @scheme[10],
@scheme[11], @scheme[12], or @scheme[13].}

View File

@ -0,0 +1,31 @@
#lang scribble/doc
@(require "common.ss")
@title[#:tag "overview"]{Using OpenGL}
The @schememodname[sgl/gl] library provides direct access to the
C-style OpenGL API, whereas the @schememodname[sgl] library provides a
more Scheme-like interface. The @schememodname[sgl/gl] library
provides a binding for each @tt{#defined} constant and for most
functions in OpenGL 1.5 and GLU 1.3. The functions 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
@schememodname[sgl] library provides wrappers around many of the
functions in the @schememodname[sgl/gl] library to present a more
Scheme-friendly interface, including function names that follow Scheme
conventions, and checked, symbolic enumeration arguments, and
array-length checks.
@bold{Warning on Safety:} OpenGL programming is inherently unsafe,
even when using only the @schememodname[sgl] library. Although
@schememodname[sgl] checks the arguments to each function call,
violation of higher-level assumptions of the system's OpenGL library
can cause it to crash, bringing the entire Scheme system down. For
example, sending a large number of vertices in a single @tt{glBegin}
causes at least some GL implementations to crash.
Some examples are available in the @filepath{examples} directory of
the @filepath{sgl} collection in the PLT Scheme installation. For
@filepath{alpha.ss}, try choosing the @filepath{sk.jpg} image distritbuted
with PLT Scheme in the @filepath{icons} collection; you may have to
press the ``t'' key a few times if the spinning cube is blank.

View File

@ -0,0 +1,25 @@
#lang scribble/doc
@(require "common.ss")
@title{@bold{GL}: 3-D Graphics}
The @schememodname[sgl] libraries provide access to the rendering
functions of @as-index{OpenGL} 1.5 and @as-index{GLU} 1.3
libraries. The @schememodname[sgl] libraries to not address
system-level concerns, such as the attachment of GL rendering contexts
to displays. Instead, the libraries should work with any PLT Scheme
extension that provides GL with access to the system (such as a
binding for @tt{glx}). Notably, the @schememodname[scheme/gui/base]
library provides support for rendering contexts via the
@scheme[canvas%] class and its @method[canvas% with-gl-context]
method.
@table-of-contents[]
@include-section["overview.scrbl"]
@include-section["gl.scrbl"]
@include-section["main.scrbl"]
@include-section["gl-vectors.scrbl"]
@include-section["bitmap.scrbl"]
@index-section[]