[Top] [Contents] [Index] [ ? ]

Gauche-gl : OpenGL binding for Gauche

This is a reference manual of Gauche-gl, an OpenGL binding for the Gauche Scheme implementation. This manual is for version 0.3.1.

1. Introduction  
2. Installation  
3. Getting Started  
4. OpenGL API  
5. GLU API  
6. GLUT API  
7. Vectors and matrices  
A. Indices  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. Introduction

Gauche-gl is an extension module of Gauche Scheme implementation. It provides the following modules:

gl
The module that provides bindings to OpenGL API. It covers almost all functions in OpenGL 1.2, and most functions in GLU. The functions are described in 4. OpenGL API and 5. GLU API.
gl.glut
The module that provides bindings to most functions in GLUT. The functions are described in 6. GLUT API.
gl.math3d
The module that provides vector and matrix calculations optimized for 3D homogeneous coordinates. The vector and matrix objects here can be directly passed to Gauche-gl functions. The functions are descrbied in 7. Vectors and matrices.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2. Installation

Installing Gauche-gl is usually straightforward on Unix variants. At the time of writing this Manual, Gauche-gl can't be complied on Cygwin.

You have to have the following programs installed on your machine.

The standard way to compile and install Gauche-gl is as follows:

 
% gzcat Gauche-gl-0.3.1.tgz | tar xf -
% cd Gauche-gl-0.3.1
% ./configure
% make
% make test
% make install

The confiugre script figures out the location Gauche is installed, and install Gauche-gl in the same place.

If you have GLUT installed in non-standard place, you have to tell the configure script where it is.

 
% ./configure --with-glut=DIR

It is reported that Mesa in FreeBSD ports is compiled with pthreads enabled, and Gauche-gl can't be linked unless Gauche itself is compiled with pthreads. The configure script of Gauche prints warning if you specify pthreads, but it is safe as far as you don't call make-thread in your program.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. Getting Started

3.1 GL calls in Scheme  
3.2 Using GLUT  
3.3 Performance tips  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 GL calls in Scheme

I assume you have basic knowledge of OpenGL API. Gauche-gl maps OpenGL calls to Scheme procedures pretty straightforwardly. For example, the very first example of "OpenGL Programming Guide", the pseudo code of OpenGL application, can be written in Gauche-gl like this:

 
(use gl)

(define (main args)
  (initialize-a-window-please)

  (gl-clear-color 0.0 0.0 0.0 0.0)
  (gl-clear GL_COLOR_BUFFER_BIT)
  (gl-color 1.0 1.0 1.0)
  (gl-ortho 0.0 1.0 0.0 1.0 -1.0 1.0)
  (gl-begin* GL_POLYGON
    (gl-vertex 0.25 0.25 0.0)
    (gl-vertex 0.75 0.25 0.0)
    (gl-vertex 0.75 0.75 0.0)
    (gl-vertex 0.25 0.75 0.0)
    )
  (gl-flush)
  (update-the-window-and-check-for-events)
  0)

Note that initialize-a-window-please and update-the-window-and-check-for-events are function calls dependent on the windowing system. Gauche-gl comes with GLUT binding and you can use it to do basic stuff. In the separate package Gauche-gtk, a binding to GtkGLExt is provided, which allows you to do GL rendering inside Gtk widgets.

For the time being, let's focus on the pure GL part.

The mapping of GL call name is straightforward. The mixed case names in OpenGL C API is expanded to hyphenated name, e.g. glClearColor => gl-clear-color. OpenGL enums are mapped as is, e.g. GL_POLYGON. (Note that Gauche is case-sensitive by default. Also note the underscore, not hyphen, in constants).

A few convenience macros, such as gl-begin*, is defined. There are straight bindings of gl-begin and gl-end, so you can write the drawing part in the same way as in C:

 
  (gl-begin GL_POLYGON)
    (gl-vertex 0.25 0.25 0.0)
    (gl-vertex 0.75 0.25 0.0)
    (gl-vertex 0.75 0.75 0.0)
    (gl-vertex 0.25 0.75 0.0)
  (gl-end)

Actually gl-begin* macro expands into the above calls. It's a matter of taste, but the macro version guarantees begin and end match, and the syntax-aware editor can indent internal calls accordingly.

You might have noticed that the type suffix in C API is not in Gauche binding. The Scheme function figures out the type of passed arguments and calls appropriate C API. SRFI-4 uniform numeric vectors are used to represent arrays of numbers.

 
  (gl-vertex 1.0 2.0 3.0)    => glVertex3d
  (gl-vertex '#f32(1.0 2.0)) => glVertex2fv
  (gl-vertex '#s32(3 2 5))   => glVertex3iv

Generally, passing uniform vectors is much more efficient than giving individual numbers, for the former can eliminate the cost of type checking and unboxing.

Some GL calls can also take gl.math3d primitive objects such as vector4f, point4f or matrix4f (See section 7. Vectors and matrices). For example, you can pass point4f object to gl-vertex, vector4f to gl-normal, and matrix4f to gl-mult-matrix. They are efficient since calculations on those types are defined natively in gl.math3d, and passing it to GL call doesn't cost unboxing.

Variables GL_VERSION_1_1, GL_VERSION_1_2 and GL_VERSION_1_3 may be defined and bound to #t if the platform on which Gauche-gl is compiled supports OpenGL version 1.1, 1.2 or 1.3, respectively. You can use symbol-bound? to check these variables are bound. You can also use symbol-bound? to check the existence of extensions, such as GL_ARB_multitexture.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Using GLUT

In order to make a runnable script, you need to use some windowing system interface. GLUT binding provides a simple way for it.

Here is a complete runnable Scheme script, ported from Example 1-2 in "OpenGL Programming Guide":

 
(use gl)
(use gl.glut)

(define (disp)
  (gl-clear GL_COLOR_BUFFER_BIT)
  (gl-color '#f32(1.0 1.0 1.0))
  (gl-begin* GL_POLYGON
    (gl-vertex '#f32(0.25 0.25 0.0))
    (gl-vertex '#f32(0.75 0.25 0.0))
    (gl-vertex '#f32(0.75 0.75 0.0))
    (gl-vertex '#f32(0.25 0.75 0.0))
    )
  (gl-flush)
  )

(define (init)
  (gl-clear-color 0.0 0.0 0.0 0.0)
  (gl-matrix-mode GL_PROJECTION)
  (gl-load-identity)
  (gl-ortho 0.0 1.0 0.0 1.0 -1.0 1.0)
  )

(define (keyboard key x y)
  (cond
   ((= key 27) (exit 0))
   ))

(define (main args)
  (glut-init args)
  (glut-init-display-mode (logior GLUT_SINGLE GLUT_RGB))
  (glut-init-window-size 250 250)
  (glut-init-window-position 100 100)
  (glut-create-window "hello")
  (init)
  (glut-display-func disp)
  (glut-keyboard-func keyboard)
  (glut-main-loop)
  0)

The (use gl.glut) form loads GLUT binding. The name mapping is the same as GL's: mixed case names to hyphenated names.

In order to handle various events, you can pass a closure to glut-display-func etc. In the keyboard and mouse event callback, all arguments are integers.

There are more examples under the `examples/' directory which uses GLUT.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3 Performance tips

If you want to display millions of polygons in 30 fps, Gauche-gl is not for you. Consider using implementations that compiles into native code. The purpose of Gauche-gl is to provide reasonable performance for interactive development and experiment.

However, if you know some tips, actually you can go quite far, especially with recent processors and graphics chips.

Avoid alocation within the inner loop.
The functional (non-destructive) operations tend to return newly-allocated objects. Use linear-update (destructive) versions instead, such as matrix-mul!, u8vector-add!, etc, whenever possible. Pre-allocating temporary vectors is also effective.

Reduce the number of calls within the inner loop.
Vertex arrays are much better than calling gl-vertex over and over. Also consider using display lists if you're displaying rigid objects.

Keep numbers within a uniform vector.
Every time you take a number out of a uniform vector (or <vector4f> etc.), Gauche has to wrap the number by a tag (boxing). Also when you store a number into a uniform vector, Gauche has to check the type of the object, then strip a tag (unboxing). Those are all overhead you wouldn't have if you operate directly on uniform vectors (or <vector4f> etc).

Write extensions to accelerate.
If the above strategies are not enough, consider writing computation-intensive part in C as an extension. The easier way is to make C routines operate on uniform vectors, which is essentially a pointer to an array of numbers from C, and let Scheme handle higher-level data structures. (It could be viewed like relations between a coprocessor and a processor; the former does simple, iterative calculations fast, and the latter handles complicated logic).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. OpenGL API


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5. GLU API


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6. GLUT API

6.1 GLUT window manipulation  
6.2 GLUT overlay  
6.3 GLUT menu API  
6.4 GLUT callbacks  
6.5 GLUT colormap  
6.6 GLUT state retrieval  
6.7 GLUT font  
6.8 GLUT pre-built models  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1 GLUT window manipulation

Function: glut-init args

Function: glut-init-display-mode mode

Constant: GLUT_RGB
Constant: GLUT_RGBA
Constant: GLUT_INDEX
Constant: GLUT_SINGLE
Constant: GLUT_DOUBLE
Constant: GLUT_ACCUM
Constant: GLUT_ALPHA
Constant: GLUT_DEPTH
Constant: GLUT_STENCIL
Constant: GLUT_MULTISAMPLE
Constant: GLUT_STEREO
Constant: GLUT_LUMINANCE

Function: glut-init-display-string string

Function: glut-init-window-size width height

Function: glut-init-window-position x y

Function: glut-main-loop

Function: glut-create-widnow name

Function: glut-create-sub-window win x y width height

Function: glut-destroy-window win

Function: glut-post-redisplay

Function: glut-post-window-redisplay win

Function: glut-swap-buffers

Function: glut-get-window

Function: glut-set-window win

Function: glut-set-window-title title

Function: glut-set-icon-title title

Function: glut-position-window x y

Function: glut-reshape-window width height

Function: glut-push-window
Function: glut-pop-window

Function: glut-iconify-window

Function: glut-show-window
Function: glut-hide-window

Function: glut-full-screen

Function: glut-set-cursor cursor

Constant: GLUT_CURSOR_RIGHT_ARROW
Constant: GLUT_CURSOR_LEFT_ARROW
Constant: GLUT_CURSOR_INFO
Constant: GLUT_CURSOR_DESTROY
Constant: GLUT_CURSOR_HELP
Constant: GLUT_CURSOR_CYCLE
Constant: GLUT_CURSOR_SPRAY
Constant: GLUT_CURSOR_WAIT
Constant: GLUT_CURSOR_TEXT
Constant: GLUT_CURSOR_CROSSHAIR
Constant: GLUT_CURSOR_UP_DOWN
Constant: GLUT_CURSOR_LEFT_RIGHT
Constant: GLUT_CURSOR_TOP_SIDE
Constant: GLUT_CURSOR_BOTTOM_SIDE
Constant: GLUT_CURSOR_LEFT_SIDE
Constant: GLUT_CURSOR_RIGHT_SIDE
Constant: GLUT_CURSOR_TOP_LEFT_CORNER
Constant: GLUT_CURSOR_TOP_RIGHT_CORNER
Constant: GLUT_CURSOR_BOTTOM_RIGHT_CORNER
Constant: GLUT_CURSOR_BOTTOM_LEFT_CORNER
Constant: GLUT_CURSOR_INHERIT
Constant: GLUT_CURSOR_NONE
Constant: GLUT_CURSOR_FULL_CROSSHAIR

Function: glut-warp-pointer x y


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2 GLUT overlay

Function: glut-establish-overlay

Function: glut-remove-overlay

Function: glut-use-layer layer

Function: glut-post-overlay-redisplay

Function: glut-post-window-overlay-redisplay win

Function: glut-show-overlay

Function: glut-hide-overlay


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.3 GLUT menu API

Function: glut-create-menu callback

Function: glut-destroy-menu menu

Function: glut-get-emnu

Function: glut-set-menu menu

Function: glut-add-menu-entry label value

Function: glut-add-sub-menu label submenu

Function: glut-change-to-menu-entry item label value

Function: glut-change-to-sub-menu item label submenu

Function: glut-remove-menu-item item

Function: gult-attach-menu button

Function: glut-detach-menu button


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.4 GLUT callbacks

Function: glut-display-func fn

Function: glut-reshape-func fn

Function: glut-keyboard-func fn

Constant: GLUT_KEY_F1
Constant: GLUT_KEY_F2
Constant: GLUT_KEY_F3
Constant: GLUT_KEY_F4
Constant: GLUT_KEY_F5
Constant: GLUT_KEY_F6
Constant: GLUT_KEY_F7
Constant: GLUT_KEY_F8
Constant: GLUT_KEY_F9
Constant: GLUT_KEY_F10
Constant: GLUT_KEY_F11
Constant: GLUT_KEY_F12
Constant: GLUT_KEY_LEFT
Constant: GLUT_KEY_UP
Constant: GLUT_KEY_RIGHT
Constant: GLUT_KEY_DOWN
Constant: GLUT_KEY_PAGE_UP
Constant: GLUT_KEY_PAGE_DOWN
Constant: GLUT_KEY_HOME
Constant: GLUT_KEY_END
Constant: GLUT_KEY_INSERT

Function: glut-mouse-func fn

Constant: GLUT_LEFT_BUTTON
Constant: GLUT_MIDDLE_BUTTON
Constant: GLUT_RIGHT_BUTTON
Constant: GLUT_DOWN
Constant: GLUT_UP

Function: glut-motion-func fn

Function: glut-passive-motion-func fn

Function: glut-entry-func fn

Constant: GLUT_LEFT
Constant: GLUT_ENTERED

Function: glut-visibility-func fn

Constant: GLUT_NOT_VISIBLE
Constant: GLUT_VISIBLE

Function: glut-idle-func fn

Function: glut-timer-func millis fn value

Function: glut-menu-state-func fn

Function: glut-special-func fn

Function: glut-spaceball-motion-func fn

Function: glut-spaceball-rotate-func fn

Function: glut-spaceball-button-func fn

Function: glut-button-box-func fn

Function: glut-dials-func fn

Function: glut-tablet-motion-func fn

Function: glut-tablet-button-func fn

Function: glut-menu-status-func fn

Function: glut-overlay-dislay-func fn

Function: glut-window-status-func fn

Function: glut-keyboard-up-func fn

Function: glut-special-up-func fn

Function: glut-joystick-func fn interval


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.5 GLUT colormap

Function: glut-set-color index r g b

Function: glut-get-color index component

Constant: GLUT_RED
Constant: GLUT_GREEN
Constant: GLUT_BLUE

Function: glut-copy-colormap win


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.6 GLUT state retrieval

Function: glut-get type

Constant: GLUT_WINDOW_X
Constant: GLUT_WINDOW_Y
Constant: GLUT_WINDOW_WIDTH
Constant: GLUT_WINDOW_HEIGHT
Constant: GLUT_WINDOW_BUFFER_SIZE
Constant: GLUT_WINDOW_STENCIL_SIZE
Constant: GLUT_WINDOW_DEPTH_SIZE
Constant: GLUT_WINDOW_RED_SIZE
Constant: GLUT_WINDOW_GREEN_SIZE
Constant: GLUT_WINDOW_BLUE_SIZE
Constant: GLUT_WINDOW_ALPHA_SIZE
Constant: GLUT_WINDOW_ACCUM_RED_SIZE
Constant: GLUT_WINDOW_ACCUM_GREEN_SIZE
Constant: GLUT_WINDOW_ACCUM_BLUE_SIZE
Constant: GLUT_WINDOW_ACCUM_ALPHA_SIZE
Constant: GLUT_WINDOW_DOUBLEBUFFER
Constant: GLUT_WINDOW_RGBA
Constant: GLUT_WINDOW_PARENT
Constant: GLUT_WINDOW_NUM_CHILDREN
Constant: GLUT_WINDOW_COLORMAP_SIZE
Constant: GLUT_WINDOW_NUM_SAMPLES
Constant: GLUT_WINDOW_STEREO
Constant: GLUT_WINDOW_CURSOR
Constant: GLUT_SCREEN_WIDTH
Constant: GLUT_SCREEN_HEIGHT
Constant: GLUT_SCREEN_WIDTH_MM
Constant: GLUT_SCREEN_HEIGHT_MM
Constant: GLUT_MENU_NUM_ITEMS
Constant: GLUT_DISPLAY_MODE_POSSIBLE
Constant: GLUT_INIT_WINDOW_X
Constant: GLUT_INIT_WINDOW_Y
Constant: GLUT_INIT_WINDOW_WIDTH
Constant: GLUT_INIT_WINDOW_HEIGHT
Constant: GLUT_INIT_DISPLAY_MODE
Constant: GLUT_ELAPSED_TIME
Constant: GLUT_WINDOW_FORMAT_ID

Function: glut-device-get type

Constant: GLUT_HAS_KEYBOARD
Constant: GLUT_HAS_MOUSE
Constant: GLUT_HAS_SPACEBALL
Constant: GLUT_HAS_DIAL_AND_BUTTON_BOX
Constant: GLUT_HAS_TABLET
Constant: GLUT_NUM_MOUSE_BUTTONS
Constant: GLUT_NUM_SPACEBALL_BUTTONS
Constant: GLUT_NUM_BUTTON_BOX_BUTTONS
Constant: GLUT_NUM_DIALS
Constant: GLUT_NUM_TABLET_BUTTONS
Constant: GLUT_DEVICE_IGNORE_KEY_REPEAT
Constant: GLUT_DEVICE_KEY_REPEAT
Constant: GLUT_HAS_JOYSTICK
Constant: GLUT_OWNS_JOYSTICK
Constant: GLUT_JOYSTICK_BUTTONS
Constant: GLUT_JOYSTICK_AXES
Constant: GLUT_JOYSTICK_POLL_RATE

Function: glut-extension-supported name

Function: glut-get-modifiers

Constant: GLUT_ACTIVE_SHIFT
Constant: GLUT_ACTIVE_CTRL
Constant: GLUT_ACTIVE_ALT

Function: glut-layer-get type

Constant: GLUT_OVERLAY_POSSIBLE
Constant: GLUT_LAYER_IN_USE
Constant: GLUT_HAS_OVERLAY
Constant: GLUT_TRANSPARENT_INDEX
Constant: GLUT_NORMAL_DAMAGED
Constant: GLUT_OVERLAY_DAMAGED


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.7 GLUT font

Class: <glut-font>

Function: glut-bitmap-character font character

Function: glut-bitmap-width font character

Function: glut-stroke-character font character

Function: glut-stroke-width font character

Function: glut-bitmap-length font string

Function: glut-stroke-length font string


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.8 GLUT pre-built models

Function: glut-wire-sphere radius slices stacks
Function: glut-solid-sphere radius slices stacks

Function: glut-wire-cone radius height slices stacks
Function: glut-solid-cone radius height slices stacks

Function: glut-wire-cube size
Function: glut-solid-cube size

Function: glut-wire-torus inner outer sides rings
Function: glut-solid-torus inner outer sides rings

Function: glut-wire-dodecahedron
Function: glut-solid-dodecahedron

Function: glut-wire-teapot size
Function: glut-soild-teapot size

Function: glut-wire-octahedron
Function: glut-solid-octahedron

Function: glut-wire-tetrahedron
Function: glut-solid-tetrahedron

Function: glut-wire-icosahedron
Function: glut-solid-icosahedron


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7. Vectors and matrices

Module: gl.math3d
The module provides vector and matrix operations useful for 3D computer graphics.

Actually this module itself doesn't depend on GL; you can use this module alone to do matrix calculations. However, the structure of objects are designed so that they can be passed directly to Gauche-gl functions, reducing the overhead of type conversions.

The purpose of this module is to provide reasonable performance. So the operations are fixed to 3D homogeneous coordinates, i.e. a vector is 4-element column vector, and a matrix is 4x4 square matrix. If you want more flexibility, <array> class in gauche.array provides much more generic structures, trading performance.

Elements of vectors and matrices are represented in float internally. When you retrieve each element individually, it is converted to double, so you might see some precision errors. There are lots of operations directly manipulate group of elements without retrieving each element to Scheme world, avoiding overhead of conversion.

7.1 Vectors and points  
7.2 Vector arrays and point arrays  
7.3 Matrices  
7.4 Quaternions  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.1 Vectors and points

Class: <vector4f>
Class: <point4f>
4x1 column vectors. Vector4f is intended to be used to represent a vector, and point4f is to a point, but as far as OpenGL concerns, both are just an array of four floats, x, y, z and w.

These classes inherit <sequence> and <collection> classes. So if you import gauche.sequence module, you can use generic function such as ref and (setter ref) to get/set individual elements. The generic version of map and for-each can also be used on the vector4f and point4f instances.

Aside from the type, the only difference is that the default value of w component--- it's 0.0 for vectors, and 1.0 for points. So usual transformation produces expected results; for example point plus vector becomes point, vector plus vector becomes vector, and translating point changes its coordinates but translating vectors doesn't, and so on. However, you can set w component to other value to do nontrivial operations.

Reader syntax: #,(vector4f x y z w)
Reader syntax: #,(point4f x y z w)
These SRFI-10 syntax can be used to denote literal <vector4f> and <point4f> instance, respectively.

The write methods are defined so that the instance is written out in this form, and can be read back later.

Function: vector4f? obj
Function: point4f? obj
Returns true iff obj is vector4f and point4f, respectively.

Function: vector4f x y z &optional (w 0.0)
Function: point4f x y z &optional (w 1.0)
Creates a vector4f and point4f instance with given values, respectively.

Function: make-vector4f
Function: make-point4f
Another way to create a vector4f and a point4f. The first returns #,(vector4f 0.0 0.0 0.0 0.0), and the latter returns #,(point4f 0.0 0.0 0.0 1.0).

Function: list->vector4f l
Function: list->point4f l
Convert a list of three or four real numbers to a vector4f and a point4f, respectively. If l is not a list of three or four real numbers, an error is signalled.

 
(list->vector4f l)
  == (apply vector4f l)
  == (coerce-to <vector4f> l)

Function: vector4f->list v
Function: point4f->list p
Convert a vector4f and a point4f to a list of four real numbers, respectively.

 
(vector4f->list v)
  == (coerce-to <list> v)
  == (map (cut ref v <>) (iota 4))

Function: f32vector->vector4f v &optional start
Function: f32vector->point4f v &optional start
Creates a vector4f or a point4f, initializing by the elements of f32vector v. V must be longer than 4, and the first four elements are used to initialize the created vector or point.

If optional start argument is given, it specifies an index of v from which the initial values are taken; that is, start, start+1, start+2 and start+3-th elements are used to create a vector or a point. This allows to create vectors from plain float array:

 
(map (lambda (off) (f32vector->vector4f vec (* off 4)))
     (iota (/ (size-of vec) 4)))

The conversion can be done using coerce-to, as well.

 
(f32vector->vector4f vec)
  == (coerce-to <vector4f> vec)

Function: vector4f->f32vector v
Function: point4f->f32vector p
Convert a vector4f v or a point4f p to four-element f32vector.

 
(vector4f->f32vector v)
 == (coerce-to <f32vector> v)

Function: vector4f-copy v
Function: point4f-copy p
Returns a new copy of vector4f v or point4f p, respectively.

Function: vector4f-copy! dstv srcv
Function: point4f-copy! dstp srcp
Destructively sets the content of srcv or srcp to dstv or dstp, respectively.

Function: vector4f-set! v k value
Function: point4f-set! p k value
Sets a real number value to k-th element of a vector4f v or a point4f p.

 
(vector4f-set! v k value)
  == (set! (ref v k) value)

Function: vector4f-ref v k &optional fallback
Function: point4f-ref p k &optional fallback
Gets a value of k-th element of a vector4f v or a point4f p. If k is out of range, an error is signalled, unless fallback is provided, in such a case fallback is returned.

 
(vector4f-ref v k)
  == (ref v k)

Function: vector4f-dot x y
Returns a dot product of two vector4fs, x and y.

Function: vector4f-cross x y
Returns a cross product of two vector4fs, x and y. (w element is ignored).

Function: vector4f-normalize x
Function: vector4f-normalize! x
Returns a normalized vector of vector4f x. Vector4f-normalize allocates a new vector, while vector4f-normalize! modifies the original vector.

As a special case, if x is a vector of length 0, a vector of length 0 is returned.

Function: vector4f-add x y
Function: vector4f-sub x y
Function: vector4f-add! x y
Function: vector4f-sub! x y
Returns a sum of two vector4fs, x and y. The destructive version modifies x.

Function: point4f-add x y
Function: point4f-add! x y
Adds a point4f x and a vector4f y, and returns a translated point. The destructive version modifies x.

Function: point4f-sub x y
Subtracts either a vector4f or a point4f y from a point4f x. If y is a vector4f, returns a translated point. If y is a point4f, returns a vector4f from point y to point x.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.2 Vector arrays and point arrays

Class: <vector4f-array>
Class: <point4f-array>
Represents an array of vector4fs and point4fs. This is an efficient way to keep an array of vectors or points, for the elements are packed in a simple float array. They are especially useful to work with GL's vertex array feature. gl-vertex-pointer can take <point4f-array>, and gl-normal-pointer can take <vector4f-array>.

It is also possible to "view" a plain f32vector as <vector4f-array> or <point4f-array> without copying its content, by f32vector->vector4f-array/shared and f32vector->point4f-array/shared. Combined to read-block!, you can do efficient binary I/O of vertex arrays, for example.

Inherits <sequence> and <collection>. When viewed as a sequence or a collection, they behaves like sequence or collection of vector4f and point4f objects, respectively.

Function: make-vector4f-array len &optional init-vector
Function: make-point4f-array len &optional init-point
Creates a vector4f-array or point4f-array with len elements. Each element is initialized by a vector4f init-vector or a point4f init-point if provided.

Function: vector4f-array? obj
Function: point4f-array? obj
Returns true iff obj is a vector4f-array or a point4f-array, respectively.

Function: vector4f-array-length array
Function: point4f-array-length array
Returns length (number of vectors/points) in array array.

Reader syntax: #,(vector4f-array len elt ...)
Reader syntax: #,(point4f-array len elt ...)
Vector4f-array and point4f-array have external representation using this SRFI-10 syntax. Len is a length of array, and each elt is a list of four floats representing each element of the array.

 
(f32vector->vector4f-array #f32(1 2 3 4 6 7 4 3))
  => #,(vector4f-array 2 (1 2 3 4) (6 7 4 3) )

Function: list->vector4f-array list
Function: list->point4f-array list
From given list of vector4fs or point4fs, creates and returns a vector4f-array or point4f-array, respectively.

Function: f32vector->vector4f-array v
Function: f32vector->point4f-array v
Converts f32vector v to a vector4f-array or a point4f-array. The length of v must be multiple of four. The content of v is copied.

 
(f32vector->vector4f-array v)
  == (coerce-to <vector4f-array> v)

Function: f32vector->vector4f-array/shared v
Function: f32vector->point4f-array/shared v
Like above, but the content of v is shared by the result array, instead of being copied. So the modification of result array will be visible from original f32vector v and vice versa. It will allow efficient handling of large vertex arrays.

Function: vector4f-array->f32vector array
Function: point4f-array->f32vector array
Converts a vector4f-array or a point4f-array array to a f32vector.

 
(vector4f-array->f32vector array)
  == (coerce-to <f32vector> array)

Function: vector4f-array-set! array i vector
Function: point4f-array-set! array i point
Sets a vector4f vector or a point4f point to i-th element of vector4f-array or point4f-array array, respectively.

 
(vector4f-array-set! array i vector)
  == (set! (ref array i) vector)

Function: vector4f-array-ref array i &optional fallback
Function: point4f-array-ref array i &optional fallback
Returns a vector4f or a point4f which is the i-th element of array array, respectively. If k is out of range, an error is signalled, unless fallback is provided, in such a case fallback is returned.

 
(vector4f-array-ref array i)
  == (ref array i)

(ref #,(vector4f-array 2 (1 2 3 4) (6 7 4 3))  1)
  => #,(vector4f 6 7 4 3)

Function: vector4f-array-ref/shared array i &optional fallback
Function: point4f-array-ref/shared array i &optional fallback
Like above, but the returned vector4f or point4f shares the storage with the original array. Thus the modification of the result vector or point will be visible from array, and vice versa.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.3 Matrices

Class: <matrix4f>
4x4 matrix. Internally it is represented as an array of 16 floats, stored in column-major order. (It is the same order OpenGL uses, so it can be passed to OpenGL calls without overhead).

Inherits <sequence> and <collection>. When a matrix4f is treated as a sequence, it works as if it is a single sequence of floats in column-major order.

Function: make-matrix4f &optional init
Returns a new matrix4f instance. If init is omitted, the matrix is a unit matrix. Otherwise, init must be a f32vector of length 16, and the elements in the matrix is initialized by ones in f32vector.

 
;; Creates a matrix like this:
;;    1 2 3 4
;;    0 1 0 5
;;    0 0 1 6
;;    0 0 0 1

(make-matrix4f '#f32vector(1 0 0 0
                           2 1 0 0
                           3 0 1 0
                           4 5 6 1))

Function: matrix4f m00 m10 m20 m30 m01 m11 m21 m31 m02 m12 m22 m32 m03 m13 m23 m33
Creates a new matrix4f instance with give values.

Function: matrix4f? obj
Returns true iff obj is a matrix4f.

Reader syntax: #,(matrix4f elt ...)
A matrix4f is represented extrenally using SRFI-10 syntax. The elements are listed in column-major order.

Function: list->matrix4f l
Function: matrix4f->list m
Converts between list of 16 real numbers and matrix4f.

Function: f32vector->matrix4f v &optional start
Creates a new matrix4f and initializes it with 16 elements in f32vector v. If optional start is given, it specifies the start offset in vector v to be used as initial values. The f32vector v must have enough length.

Function: matrix4f->f32vector m
Returns a new f32vector that has elements from matrix4f m.

Function: matrix4f-copy m
Returns a new copy of m.

Function: matrix4f-copy! dstm srcm
Copies contents of srcm to dstm.

Function: matrix4f-set! m i value
Sets a real number value to i-th element of matrix m. Since the matrix is laid out in column-major order, the one-dimensional index m{i} and two-dimensional index m(i,j) corresponds as follows:
 
  m(0,0) = m{0}   m(0,1) = m{4}   m(0,2) = m{8}   m(0,3) = m{12}
  m(1,0) = m{1}   m(1,1) = m{5}   m(1,2) = m{9}   m(1,3) = m{13}
  m(2,0) = m{2}   m(2,1) = m{6}   m(2,2) = m{10}  m(2,3) = m{14}
  m(3,0) = m{3}   m(3,1) = m{7}   m(3,2) = m{11}  m(3,3) = m{15}

Function: matrix4f-ref m i &optional fallback
Returns the i-th element of matrix m. If i is out of range, an error is signalled, unless fallback is provided, in such a case fallback is returned.

Function: matrix4f-set2! m i j value
Sets value to (i, j) element of matrix m.

Function: matrix4f-ref2 m i j
Returns the (i, j) element of matrix m.

Function: matrix4f-row m i
Function: matrix4f-column m i
Function: matrix4f-column/shared m i
Returns i-th row vector or i-th column vector of matrix m, as a vector4f instance.

Furthermore, the returned vector from matrix4f-column/shared shares the storage with m.

Function: matrix4f-mul m obj
Obj may be a scalar (real number), a vector4f, a point4f, or a matrix4f. Returns m x obj.

Function: matrix4f-mul! m obj
Obj may be a scalar or a matrix4f. Matrix m is multiplied by obj, and the result is set to m destructively.

Function: matrix4f-transpose m
Function: matrix4f-transpose! m
Returns a transposed matrix of m. The destructive version modifies m.

Function: matrix4f-determinant m
Returns a determinant of m.

Function: matrix4f-inverse m &optional (error-on-singular? #t)
Function: matrix4f-inverse! m &optional (error-on-singular? #t)
Returns a inverse matrix of m. The destructive version modifies m. If given m is a singular matrix, an error is signalled by default. However, if #f is given to the optional error-on-singular? argument, #f is returned in such a case.

Function: translation->matrix4f translation-vector
Function: translation->matrix4f! m translation-vector
Returns a matrix which represents a translation by translation-vector, which must be either a vector4f, a point4f, or a f32vector of length 3 or 4. Only the first three elements in translation-vector is used. The destructive version updates m.

Function: rotation->matrix4f axis angle
Function: rotation->matrix4f! m axis angle
Returns a matrix which represents a rotation around axis by angle radian. Axis must be a vector4f or a f32vector of length 3 or 4, and must be normalized. The result is undefined if anormalized vector is passed as axis. The destructive version updates m.

Function: scale->matrix4f scale-vector
Function: scale->matrix4f! m scale-vector
Returns a matrix which represents a scale by scale-vector, which must be either a vector4f, a point4f, or a f32vector of length 3 or 4. Only the first three elements in scale-vector is used. Each element of scale-vector represents the scale factor along x, y, and z axis. The destructive version updates m.

Function: trs->matrix4f translation rotation-axis rotation-angle scale
Function: trs->matrix4f! m translation rotation-axis rotation-angle scale
This combines above three procedure. Returns a matrix that represents translation, rotation and scale, specified by translation, rotation-axis, rotation-angle and scale. The destructive version updates m.

If T, R and S, are the matrices that represent translation, rotation and scale, respectively, then these procedures effectively calculates a matrix TRS.

Function: tqs->matrix4f translation rotation-quat scale
Function: tqs->matrix4f! m translation rotation-quat scale
A variation of trs->matrix4f. Instead of axis and angle, rotation is represented by a quaternion rotation-quat. See section 7.4 Quaternions, for more details about quaternions.

Function: euler-angle->matrxi4f xangle yangle zangle &optional order
Function: euler-angle->matrxi4f! m xangle yangle zangle &optional order
Returns a matrix that represents rotation along x, y and z axis by xangle, yangle, and zangle, respectively.

The order of rotation can be specified by the optional argument order, which may be one of the symbols xyz, xzy, yzx, yxz, zxy, or zyx. For example, symbol xyz means rotation around x-axis, then y-axis, then z-axis. Thus, if we write each rotation as Rx, Ry, and Rz, the returned matrix is RzRyRx. The default value of order is xyz.

The desrtuctive version modifies m.

Function: matrix4f-decompose m
Matrix m is a composition of translation, rotation, shear and scale. Suppose transformation is applied in the reverse order. This procedure decompose m into each individual transformation.

Returns five values.

If m is singular, certain part of rotation matrix can't be recovered. In such a case, r becomes also singular matrix.

If the original matrix has negative scale factor in any of x, y, or z scale, the decomposed scale factor will have all negative components. The signs of elements of r are adjusted accordingly.

Due to the precision errors, you will see small values appear in shear component even m is pure TRS matrix.

Function: matrix4f-decompose! m t r h s
Linear update version of matrix4f-decompose. The result vectors and matrices are stored in t, r, h and s. The return value is a boolean value indicates m is non-singular or not.

Function: matrix4f->rotation m
From given orthogonal matrix m, extracts and returns and rotation axis and angle, as a vector4f and a real number.

Function: matrix4f->rotation! m v
Same as above, except the storage of vector4f v is reused to store the result axis.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.4 Quaternions

Class: <quatf>
Quaternions. Internally quaternions are represented as just an array of four floats; the first three are the vector component and the last is the scalar component.

Inherits <sequence> and <collection>. When viewed as sequence, it is just like a vector of four floats.

Function: quatf? obj
Returns true iff obj is a quaternion.

Reader syntax: #,(quatf x y z w)
External representation of quaternion xi+yj+zk+w.

Function: make-quatf &optional axis (angle 0)
Returns a new unit quaternion that represents a rotation around vector axis by angle radians. Axis can be a vector4f, a point4f or a f32vector (only first three component is used). Axis must be a unit vector; if axis is anormalized, the result is undefined.

If both axis and angle is omitted, #,(quatf 0 0 0 1) is returned.

Function: quatf x y z w
Returns a new quaternion whose elements are initialized by x, y, z, w.

Function: list->quatf l
Function: quatf->list q
Converts between a list of four real numbers and a quaternion.

Function: f32vector->quatf x &optional start
Returns a new quaternion whose elements are initialized by the first four elements of f32vector x. If start is given, the initial value is taken starting from start-th index in x.

Function: quatf->f32vector q
Returns a new f32vector whose contents is the same as a quaternion q.

Function: quatf-copy q
Returns a fresh copy of a quaternion q.

Function: quatf-copy! dstq srcq
Copies contents of a quaternion srcq to a quaternion dstq.

Function: rotation->quatf! quat axis angle
Sets a quaternion quat so that it represents a rotation around a unit vector axis by angle angle radians. Axis can be a vector4f, a point4f or a f32vector (only first three component is used).

Function: quatf-add p q
Function: quatf-add! p q
Function: quatf-sub p q
Function: quatf-sub! p q
Addition and subtraction of quaternions. The destructive version modifies the first argument.

Function: quatf-scale q s
Function: quatf-scale! q s
Multiplies a quaternion q by a scalar value s. The destructive version modifies q.

Function: quatf-mul p q
Function: quatf-mul! p q
Multiply two quaternions p and q. The destructive version modifies p.

Function: quatf-conjugate q
Returns a conjugate of a quaternion q.

Function: quatf-transform q p
Transforms a vector or a point p by quaternion q, that is, returns qpq*, where q* is a conjugate of q.

This procedure assumes q is normalized.

P can be a vector4f, a point4f or a f32vector (only first three elements are used). Returns the same type of object as p.

Function: quatf-norm q
Returns norm of q.

Function: quatf-normalize q
Function: quatf-normalize! q
Returns normalized quaternion of q. The destructive version modifies q.

Function: quatf->matrix4f q
Function: quatf->matrix4f! m q
Returns a matrix that represents a rotation specified by a unit quaternion q. The behavior is undefined if q is not normalized. The destructive version modifies m.

Function: quatf-slerp p q t
Function: quatf-slerp! r p q t
Returns a quaternion that interpolates between two unit quaternions p and q, by a scalar value t. The destructive version modifies t.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A. Indices

A.1 Function and Syntax Index  
A.2 Module Index  
A.3 Class Index  
A.4 Variable Index  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.1 Function and Syntax Index

Jump to:   E   F   G   L   M   P   Q   R   S   T   V  

Index Entry Section

E
euler-angle->matrxi4f7.3 Matrices
euler-angle->matrxi4f!7.3 Matrices

F
f32vector->matrix4f7.3 Matrices
f32vector->point4f7.1 Vectors and points
f32vector->point4f-array7.2 Vector arrays and point arrays
f32vector->point4f-array/shared7.2 Vector arrays and point arrays
f32vector->quatf7.4 Quaternions
f32vector->vector4f7.1 Vectors and points
f32vector->vector4f-array7.2 Vector arrays and point arrays
f32vector->vector4f-array/shared7.2 Vector arrays and point arrays

G
glut-add-menu-entry6.3 GLUT menu API
glut-add-sub-menu6.3 GLUT menu API
glut-bitmap-character6.7 GLUT font
glut-bitmap-length6.7 GLUT font
glut-bitmap-width6.7 GLUT font
glut-button-box-func6.4 GLUT callbacks
glut-change-to-menu-entry6.3 GLUT menu API
glut-change-to-sub-menu6.3 GLUT menu API
glut-copy-colormap6.5 GLUT colormap
glut-create-menu6.3 GLUT menu API
glut-create-sub-window6.1 GLUT window manipulation
glut-create-widnow6.1 GLUT window manipulation
glut-destroy-menu6.3 GLUT menu API
glut-destroy-window6.1 GLUT window manipulation
glut-detach-menu6.3 GLUT menu API
glut-device-get6.6 GLUT state retrieval
glut-dials-func6.4 GLUT callbacks
glut-display-func6.4 GLUT callbacks
glut-entry-func6.4 GLUT callbacks
glut-establish-overlay6.2 GLUT overlay
glut-extension-supported6.6 GLUT state retrieval
glut-full-screen6.1 GLUT window manipulation
glut-get6.6 GLUT state retrieval
glut-get-color6.5 GLUT colormap
glut-get-emnu6.3 GLUT menu API
glut-get-modifiers6.6 GLUT state retrieval
glut-get-window6.1 GLUT window manipulation
glut-hide-overlay6.2 GLUT overlay
glut-hide-window6.1 GLUT window manipulation
glut-iconify-window6.1 GLUT window manipulation
glut-idle-func6.4 GLUT callbacks
glut-init6.1 GLUT window manipulation
glut-init-display-mode6.1 GLUT window manipulation
glut-init-display-string6.1 GLUT window manipulation
glut-init-window-position6.1 GLUT window manipulation
glut-init-window-size6.1 GLUT window manipulation
glut-joystick-func6.4 GLUT callbacks
glut-keyboard-func6.4 GLUT callbacks
glut-keyboard-up-func6.4 GLUT callbacks
glut-layer-get6.6 GLUT state retrieval
glut-main-loop6.1 GLUT window manipulation
glut-menu-state-func6.4 GLUT callbacks
glut-menu-status-func6.4 GLUT callbacks
glut-motion-func6.4 GLUT callbacks
glut-mouse-func6.4 GLUT callbacks
glut-overlay-dislay-func6.4 GLUT callbacks
glut-passive-motion-func6.4 GLUT callbacks
glut-pop-window6.1 GLUT window manipulation
glut-position-window6.1 GLUT window manipulation
glut-post-overlay-redisplay6.2 GLUT overlay
glut-post-redisplay6.1 GLUT window manipulation
glut-post-window-overlay-redisplay6.2 GLUT overlay
glut-post-window-redisplay6.1 GLUT window manipulation
glut-push-window6.1 GLUT window manipulation
glut-remove-menu-item6.3 GLUT menu API
glut-remove-overlay6.2 GLUT overlay
glut-reshape-func6.4 GLUT callbacks
glut-reshape-window6.1 GLUT window manipulation
glut-set-color6.5 GLUT colormap
glut-set-cursor6.1 GLUT window manipulation
glut-set-icon-title6.1 GLUT window manipulation
glut-set-menu6.3 GLUT menu API
glut-set-window6.1 GLUT window manipulation
glut-set-window-title6.1 GLUT window manipulation
glut-show-overlay6.2 GLUT overlay
glut-show-window6.1 GLUT window manipulation
glut-soild-teapot6.8 GLUT pre-built models
glut-solid-cone6.8 GLUT pre-built models
glut-solid-cube6.8 GLUT pre-built models
glut-solid-dodecahedron6.8 GLUT pre-built models
glut-solid-icosahedron6.8 GLUT pre-built models
glut-solid-octahedron6.8 GLUT pre-built models
glut-solid-sphere6.8 GLUT pre-built models
glut-solid-tetrahedron6.8 GLUT pre-built models
glut-solid-torus6.8 GLUT pre-built models
glut-spaceball-button-func6.4 GLUT callbacks
glut-spaceball-motion-func6.4 GLUT callbacks
glut-spaceball-rotate-func6.4 GLUT callbacks
glut-special-func6.4 GLUT callbacks
glut-special-up-func6.4 GLUT callbacks
glut-stroke-character6.7 GLUT font
glut-stroke-length6.7 GLUT font
glut-stroke-width6.7 GLUT font
glut-swap-buffers6.1 GLUT window manipulation
glut-tablet-button-func6.4 GLUT callbacks
glut-tablet-motion-func6.4 GLUT callbacks
glut-timer-func6.4 GLUT callbacks
glut-use-layer6.2 GLUT overlay
glut-visibility-func6.4 GLUT callbacks
glut-warp-pointer6.1 GLUT window manipulation
glut-window-status-func6.4 GLUT callbacks
glut-wire-cone6.8 GLUT pre-built models
glut-wire-cube6.8 GLUT pre-built models
glut-wire-dodecahedron6.8 GLUT pre-built models
glut-wire-icosahedron6.8 GLUT pre-built models
glut-wire-octahedron6.8 GLUT pre-built models
glut-wire-sphere6.8 GLUT pre-built models
glut-wire-teapot6.8 GLUT pre-built models
glut-wire-tetrahedron6.8 GLUT pre-built models
glut-wire-torus6.8 GLUT pre-built models
gult-attach-menu6.3 GLUT menu API

L
list->matrix4f7.3 Matrices
list->point4f7.1 Vectors and points
list->point4f-array7.2 Vector arrays and point arrays
list->quatf7.4 Quaternions
list->vector4f7.1 Vectors and points
list->vector4f-array7.2 Vector arrays and point arrays

M
make-matrix4f7.3 Matrices
make-point4f7.1 Vectors and points
make-point4f-array7.2 Vector arrays and point arrays
make-quatf7.4 Quaternions
make-vector4f7.1 Vectors and points
make-vector4f-array7.2 Vector arrays and point arrays
matrix4f7.3 Matrices
matrix4f->f32vector7.3 Matrices
matrix4f->list7.3 Matrices
matrix4f->rotation7.3 Matrices
matrix4f->rotation!7.3 Matrices
matrix4f-column7.3 Matrices
matrix4f-column/shared7.3 Matrices
matrix4f-copy7.3 Matrices
matrix4f-copy!7.3 Matrices
matrix4f-decompose7.3 Matrices
matrix4f-decompose!7.3 Matrices
matrix4f-determinant7.3 Matrices
matrix4f-inverse7.3 Matrices
matrix4f-inverse!7.3 Matrices
matrix4f-mul7.3 Matrices
matrix4f-mul!7.3 Matrices
matrix4f-ref7.3 Matrices
matrix4f-ref27.3 Matrices
matrix4f-row7.3 Matrices
matrix4f-set!7.3 Matrices
matrix4f-set2!7.3 Matrices
matrix4f-transpose7.3 Matrices
matrix4f-transpose!7.3 Matrices
matrix4f?7.3 Matrices

P
point4f7.1 Vectors and points
point4f->f32vector7.1 Vectors and points
point4f->list7.1 Vectors and points
point4f-add7.1 Vectors and points
point4f-add!7.1 Vectors and points
point4f-array->f32vector7.2 Vector arrays and point arrays
point4f-array-length7.2 Vector arrays and point arrays
point4f-array-ref7.2 Vector arrays and point arrays
point4f-array-ref/shared7.2 Vector arrays and point arrays
point4f-array-set!7.2 Vector arrays and point arrays
point4f-array?7.2 Vector arrays and point arrays
point4f-copy7.1 Vectors and points
point4f-copy!7.1 Vectors and points
point4f-ref7.1 Vectors and points
point4f-set!7.1 Vectors and points
point4f-sub7.1 Vectors and points
point4f?7.1 Vectors and points

Q
quatf7.4 Quaternions
quatf->f32vector7.4 Quaternions
quatf->list7.4 Quaternions
quatf->matrix4f7.4 Quaternions
quatf->matrix4f!7.4 Quaternions
quatf-add7.4 Quaternions
quatf-add!7.4 Quaternions
quatf-conjugate7.4 Quaternions
quatf-copy7.4 Quaternions
quatf-copy!7.4 Quaternions
quatf-mul7.4 Quaternions
quatf-mul!7.4 Quaternions
quatf-norm7.4 Quaternions
quatf-normalize7.4 Quaternions
quatf-normalize!7.4 Quaternions
quatf-scale7.4 Quaternions
quatf-scale!7.4 Quaternions
quatf-slerp7.4 Quaternions
quatf-slerp!7.4 Quaternions
quatf-sub7.4 Quaternions
quatf-sub!7.4 Quaternions
quatf-transform7.4 Quaternions
quatf?7.4 Quaternions

R
rotation->matrix4f7.3 Matrices
rotation->matrix4f!7.3 Matrices
rotation->quatf!7.4 Quaternions

S
scale->matrix4f7.3 Matrices
scale->matrix4f!7.3 Matrices

T
tqs->matrix4f7.3 Matrices
tqs->matrix4f!7.3 Matrices
translation->matrix4f7.3 Matrices
translation->matrix4f!7.3 Matrices
trs->matrix4f7.3 Matrices
trs->matrix4f!7.3 Matrices

V
vector4f7.1 Vectors and points
vector4f->f32vector7.1 Vectors and points
vector4f->list7.1 Vectors and points
vector4f-add7.1 Vectors and points
vector4f-add!7.1 Vectors and points
vector4f-array->f32vector7.2 Vector arrays and point arrays
vector4f-array-length7.2 Vector arrays and point arrays
vector4f-array-ref7.2 Vector arrays and point arrays
vector4f-array-ref/shared7.2 Vector arrays and point arrays
vector4f-array-set!7.2 Vector arrays and point arrays
vector4f-array?7.2 Vector arrays and point arrays
vector4f-copy7.1 Vectors and points
vector4f-copy!7.1 Vectors and points
vector4f-cross7.1 Vectors and points
vector4f-dot7.1 Vectors and points
vector4f-normalize7.1 Vectors and points
vector4f-normalize!7.1 Vectors and points
vector4f-ref7.1 Vectors and points
vector4f-set!7.1 Vectors and points
vector4f-sub7.1 Vectors and points
vector4f-sub!7.1 Vectors and points
vector4f?7.1 Vectors and points

Jump to:   E   F   G   L   M   P   Q   R   S   T   V  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.2 Module Index

Jump to:   G  

Index Entry Section

G
gl.math3d7. Vectors and matrices

Jump to:   G  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.3 Class Index

For readability, the surrounding < and > are stripped off.

Jump to:   G   M   P   Q   V  

Index Entry Section

G
glut-font6.7 GLUT font

M
matrix4f7.3 Matrices

P
point4f7.1 Vectors and points
point4f-array7.2 Vector arrays and point arrays

Q
quatf7.4 Quaternions

V
vector4f7.1 Vectors and points
vector4f-array7.2 Vector arrays and point arrays

Jump to:   G   M   P   Q   V  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.4 Variable Index

Jump to:   G  

Index Entry Section

G
GLUT_ACCUM6.1 GLUT window manipulation
GLUT_ACTIVE_ALT6.6 GLUT state retrieval
GLUT_ACTIVE_CTRL6.6 GLUT state retrieval
GLUT_ACTIVE_SHIFT6.6 GLUT state retrieval
GLUT_ALPHA6.1 GLUT window manipulation
GLUT_BLUE6.5 GLUT colormap
GLUT_CURSOR_BOTTOM_LEFT_CORNER6.1 GLUT window manipulation
GLUT_CURSOR_BOTTOM_RIGHT_CORNER6.1 GLUT window manipulation
GLUT_CURSOR_BOTTOM_SIDE6.1 GLUT window manipulation
GLUT_CURSOR_CROSSHAIR6.1 GLUT window manipulation
GLUT_CURSOR_CYCLE6.1 GLUT window manipulation
GLUT_CURSOR_DESTROY6.1 GLUT window manipulation
GLUT_CURSOR_FULL_CROSSHAIR6.1 GLUT window manipulation
GLUT_CURSOR_HELP6.1 GLUT window manipulation
GLUT_CURSOR_INFO6.1 GLUT window manipulation
GLUT_CURSOR_INHERIT6.1 GLUT window manipulation
GLUT_CURSOR_LEFT_ARROW6.1 GLUT window manipulation
GLUT_CURSOR_LEFT_RIGHT6.1 GLUT window manipulation
GLUT_CURSOR_LEFT_SIDE6.1 GLUT window manipulation
GLUT_CURSOR_NONE6.1 GLUT window manipulation
GLUT_CURSOR_RIGHT_ARROW6.1 GLUT window manipulation
GLUT_CURSOR_RIGHT_SIDE6.1 GLUT window manipulation
GLUT_CURSOR_SPRAY6.1 GLUT window manipulation
GLUT_CURSOR_TEXT6.1 GLUT window manipulation
GLUT_CURSOR_TOP_LEFT_CORNER6.1 GLUT window manipulation
GLUT_CURSOR_TOP_RIGHT_CORNER6.1 GLUT window manipulation
GLUT_CURSOR_TOP_SIDE6.1 GLUT window manipulation
GLUT_CURSOR_UP_DOWN6.1 GLUT window manipulation
GLUT_CURSOR_WAIT6.1 GLUT window manipulation
GLUT_DEPTH6.1 GLUT window manipulation
GLUT_DEVICE_IGNORE_KEY_REPEAT6.6 GLUT state retrieval
GLUT_DEVICE_KEY_REPEAT6.6 GLUT state retrieval
GLUT_DISPLAY_MODE_POSSIBLE6.6 GLUT state retrieval
GLUT_DOUBLE6.1 GLUT window manipulation
GLUT_DOWN6.4 GLUT callbacks
GLUT_ELAPSED_TIME6.6 GLUT state retrieval
GLUT_ENTERED6.4 GLUT callbacks
GLUT_GREEN6.5 GLUT colormap
GLUT_HAS_DIAL_AND_BUTTON_BOX6.6 GLUT state retrieval
GLUT_HAS_JOYSTICK6.6 GLUT state retrieval
GLUT_HAS_KEYBOARD6.6 GLUT state retrieval
GLUT_HAS_MOUSE6.6 GLUT state retrieval
GLUT_HAS_OVERLAY6.6 GLUT state retrieval
GLUT_HAS_SPACEBALL6.6 GLUT state retrieval
GLUT_HAS_TABLET6.6 GLUT state retrieval
GLUT_INDEX6.1 GLUT window manipulation
GLUT_INIT_DISPLAY_MODE6.6 GLUT state retrieval
GLUT_INIT_WINDOW_HEIGHT6.6 GLUT state retrieval
GLUT_INIT_WINDOW_WIDTH6.6 GLUT state retrieval
GLUT_INIT_WINDOW_X6.6 GLUT state retrieval
GLUT_INIT_WINDOW_Y6.6 GLUT state retrieval
GLUT_JOYSTICK_AXES6.6 GLUT state retrieval
GLUT_JOYSTICK_BUTTONS6.6 GLUT state retrieval
GLUT_JOYSTICK_POLL_RATE6.6 GLUT state retrieval
GLUT_KEY_DOWN6.4 GLUT callbacks
GLUT_KEY_END6.4 GLUT callbacks
GLUT_KEY_F16.4 GLUT callbacks
GLUT_KEY_F106.4 GLUT callbacks
GLUT_KEY_F116.4 GLUT callbacks
GLUT_KEY_F126.4 GLUT callbacks
GLUT_KEY_F26.4 GLUT callbacks
GLUT_KEY_F36.4 GLUT callbacks
GLUT_KEY_F46.4 GLUT callbacks
GLUT_KEY_F56.4 GLUT callbacks
GLUT_KEY_F66.4 GLUT callbacks
GLUT_KEY_F76.4 GLUT callbacks
GLUT_KEY_F86.4 GLUT callbacks
GLUT_KEY_F96.4 GLUT callbacks
GLUT_KEY_HOME6.4 GLUT callbacks
GLUT_KEY_INSERT6.4 GLUT callbacks
GLUT_KEY_LEFT6.4 GLUT callbacks
GLUT_KEY_PAGE_DOWN6.4 GLUT callbacks
GLUT_KEY_PAGE_UP6.4 GLUT callbacks
GLUT_KEY_RIGHT6.4 GLUT callbacks
GLUT_KEY_UP6.4 GLUT callbacks
GLUT_LAYER_IN_USE6.6 GLUT state retrieval
GLUT_LEFT6.4 GLUT callbacks
GLUT_LEFT_BUTTON6.4 GLUT callbacks
GLUT_LUMINANCE6.1 GLUT window manipulation
GLUT_MENU_NUM_ITEMS6.6 GLUT state retrieval
GLUT_MIDDLE_BUTTON6.4 GLUT callbacks
GLUT_MULTISAMPLE6.1 GLUT window manipulation
GLUT_NORMAL_DAMAGED6.6 GLUT state retrieval
GLUT_NOT_VISIBLE6.4 GLUT callbacks
GLUT_NUM_BUTTON_BOX_BUTTONS6.6 GLUT state retrieval
GLUT_NUM_DIALS6.6 GLUT state retrieval
GLUT_NUM_MOUSE_BUTTONS6.6 GLUT state retrieval
GLUT_NUM_SPACEBALL_BUTTONS6.6 GLUT state retrieval
GLUT_NUM_TABLET_BUTTONS6.6 GLUT state retrieval
GLUT_OVERLAY_DAMAGED6.6 GLUT state retrieval
GLUT_OVERLAY_POSSIBLE6.6 GLUT state retrieval
GLUT_OWNS_JOYSTICK6.6 GLUT state retrieval
GLUT_RED6.5 GLUT colormap
GLUT_RGB6.1 GLUT window manipulation
GLUT_RGBA6.1 GLUT window manipulation
GLUT_RIGHT_BUTTON6.4 GLUT callbacks
GLUT_SCREEN_HEIGHT6.6 GLUT state retrieval
GLUT_SCREEN_HEIGHT_MM6.6 GLUT state retrieval
GLUT_SCREEN_WIDTH6.6 GLUT state retrieval
GLUT_SCREEN_WIDTH_MM6.6 GLUT state retrieval
GLUT_SINGLE6.1 GLUT window manipulation
GLUT_STENCIL6.1 GLUT window manipulation
GLUT_STEREO6.1 GLUT window manipulation
GLUT_TRANSPARENT_INDEX6.6 GLUT state retrieval
GLUT_UP6.4 GLUT callbacks
GLUT_VISIBLE6.4 GLUT callbacks
GLUT_WINDOW_ACCUM_ALPHA_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_ACCUM_BLUE_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_ACCUM_GREEN_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_ACCUM_RED_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_ALPHA_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_BLUE_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_BUFFER_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_COLORMAP_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_CURSOR6.6 GLUT state retrieval
GLUT_WINDOW_DEPTH_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_DOUBLEBUFFER6.6 GLUT state retrieval
GLUT_WINDOW_FORMAT_ID6.6 GLUT state retrieval
GLUT_WINDOW_GREEN_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_HEIGHT6.6 GLUT state retrieval
GLUT_WINDOW_NUM_CHILDREN6.6 GLUT state retrieval
GLUT_WINDOW_NUM_SAMPLES6.6 GLUT state retrieval
GLUT_WINDOW_PARENT6.6 GLUT state retrieval
GLUT_WINDOW_RED_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_RGBA6.6 GLUT state retrieval
GLUT_WINDOW_STENCIL_SIZE6.6 GLUT state retrieval
GLUT_WINDOW_STEREO6.6 GLUT state retrieval
GLUT_WINDOW_WIDTH6.6 GLUT state retrieval
GLUT_WINDOW_X6.6 GLUT state retrieval
GLUT_WINDOW_Y6.6 GLUT state retrieval

Jump to:   G  


[Top] [Contents] [Index] [ ? ]

Table of Contents

1. Introduction
2. Installation
3. Getting Started
3.1 GL calls in Scheme
3.2 Using GLUT
3.3 Performance tips
4. OpenGL API
5. GLU API
6. GLUT API
6.1 GLUT window manipulation
6.2 GLUT overlay
6.3 GLUT menu API
6.4 GLUT callbacks
6.5 GLUT colormap
6.6 GLUT state retrieval
6.7 GLUT font
6.8 GLUT pre-built models
7. Vectors and matrices
7.1 Vectors and points
7.2 Vector arrays and point arrays
7.3 Matrices
7.4 Quaternions
A. Indices
A.1 Function and Syntax Index
A.2 Module Index
A.3 Class Index
A.4 Variable Index

[Top] [Contents] [Index] [ ? ]

Short Table of Contents

1. Introduction
2. Installation
3. Getting Started
4. OpenGL API
5. GLU API
6. GLUT API
7. Vectors and matrices
A. Indices

[Top] [Contents] [Index] [ ? ]

About this document

This document was generated by using texi2html

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ < ] Back previous section in reading order 1.2.2
[ > ] Forward next section in reading order 1.2.4
[ << ] FastBack beginning of this chapter or previous chapter 1
[ Up ] Up up section 1.2
[ >> ] FastForward next chapter 2
[Top] Top cover (top) of document  
[Contents] Contents table of contents  
[Index] Index concept index  
[ ? ] About this page  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:



This document was generated by Shiro Kawai on December, 16 2003 using texi2html