▼ |  | GL: 3-D Graphics

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

On this page:

gl-vector?
gl-vector->vector
gl-vector->list
gl-vector-length
gl-vector-ref
gl-vector-set!
gl-byte-vector?
make-gl-byte-vector
gl-byte-vector
vector->gl-byte-vector
list->gl-byte-vector
gl-byte-vector+
gl-byte-vector-
gl-byte-vector*
gl-ubyte-vector?
make-gl-ubyte-vector
gl-ubyte-vector
vector->gl-ubyte-vector
list->gl-ubyte-vector
gl-ubyte-vector+
gl-ubyte-vector-
gl-ubyte-vector*
gl-short-vector?
make-gl-short-vector
gl-short-vector
vector->gl-short-vector
list->gl-short-vector
gl-short-vector+
gl-short-vector-
gl-short-vector*
gl-ushort-vector?
make-gl-ushort-vector
gl-ushort-vector
vector->gl-ushort-vector
list->gl-ushort-vector
gl-ushort-vector+
gl-ushort-vector-
gl-ushort-vector*
gl-int-vector?
make-gl-int-vector
gl-int-vector
vector->gl-int-vector
list->gl-int-vector
gl-int-vector+
gl-int-vector-
gl-int-vector*
gl-uint-vector?
make-gl-uint-vector
gl-uint-vector
vector->gl-uint-vector
list->gl-uint-vector
gl-uint-vector+
gl-uint-vector-
gl-uint-vector*
gl-float-vector?
make-gl-float-vector
gl-float-vector
vector->gl-float-vector
list->gl-float-vector
gl-float-vector+
gl-float-vector-
gl-float-vector*
gl-double-vector?
make-gl-double-vector
gl-double-vector
vector->gl-double-vector
list->gl-double-vector
gl-double-vector+
gl-double-vector-
gl-double-vector*
gl-boolean-vector?
make-gl-boolean-vector
gl-boolean-vector
vector->gl-boolean-vector
list->gl-boolean-vector
gl-boolean-vector+
gl-boolean-vector-
gl-boolean-vector*
gl-vector-norm

top ← prev up next →

### 4`` OpenGL Vectors

(require sgl/gl-vectors) | package: sgl

The sgl/gl-vectors module supports OpenGL programming with cvectors. In this document and in the error messages, a “gl-vector” is just a cvector, while a “gl-‹type›-vector” is a cvector with an appropriate type. Use the sgl/gl-vectors module vectors instead of a Racket cvector directly, because they are specialized to handle the OpenGL types correctly.

> > procedure

> > (gl-vector? v) → boolean?

> v : any/c

> > procedure

> > (gl-vector->vector vec) → vector?

> vec : cvector?

> > procedure

> > (gl-vector->list vec) → list?

> vec : cvector?

> > procedure

> > (gl-vector-length vec) → exact-nonnegative-integer?

> vec : cvector?

> > procedure

> > (gl-vector-ref vec pos) → any/v

> vec : cvector?
> pos : exact-nonnegative-integer?

> > procedure

> > (gl-vector-set! vec pos v) → void?

> vec : cvector?
> pos : exact-nonnegative-integer?
> v : any/v

Synonyms for cvector?, cvector->vector, cvector-length, etc.

> > procedure

> > (gl-byte-vector? v) → boolean?

> v : any/c

> > procedure

> > (make-gl-byte-vector pos) → gl-byte-vector?

> pos : exact-nonnegative-integer?

> > procedure

> > (gl-byte-vector v ...) → gl-byte-vector?

> v : byte?

> > procedure

> > (vector->gl-byte-vector v ...) → gl-byte-vector?

> v : (vectorof byte?)

> > procedure

> > (list->gl-byte-vector v ...) → gl-byte-vector?

> v : (listof byte?)

> > procedure

> > (gl-byte-vector+ vec ...+) → gl-byte-vector?

> vec : gl-byte-vector?

> > procedure

> > (gl-byte-vector- vec ...+) → gl-byte-vector?

> vec : gl-byte-vector?

> > procedure

> > (gl-byte-vector* x vec) → gl-byte-vector?

> x : real?
> vec : gl-byte-vector?

Operations on vectors of byte elements. The gl-byte-vector+ and gl-byte-vector- functions compute the element-by-element sum and difference of the given vectors, respectively. The gl-byte-vector* function multiplies each element of vec by x.

> > procedure

> > (gl-ubyte-vector? v) → boolean?

> v : any/c

> > procedure

> > (make-gl-ubyte-vector pos) → gl-ubyte-vector?

> pos : exact-nonnegative-integer?

> > procedure

> > (gl-ubyte-vector v ...) → gl-ubyte-vector?

> v : ubyte?

> > procedure

> > (vector->gl-ubyte-vector v ...) → gl-ubyte-vector?

> v : (vectorof ubyte?)

> > procedure

> > (list->gl-ubyte-vector v ...) → gl-ubyte-vector?

> v : (listof ubyte?)

> > procedure

> > (gl-ubyte-vector+ vec ...+) → gl-ubyte-vector?

> vec : gl-ubyte-vector?

> > procedure

> > (gl-ubyte-vector- vec ...+) → gl-ubyte-vector?

> vec : gl-ubyte-vector?

> > procedure

> > (gl-ubyte-vector* x vec) → gl-ubyte-vector?

> x : real?
> vec : gl-ubyte-vector?

Operations on vectors of ubyte elements. The gl-ubyte-vector+ and gl-ubyte-vector- functions compute the element-by-element sum and difference of the given vectors, respectively. The gl-ubyte-vector* function multiplies each element of vec by x.

> > procedure

> > (gl-short-vector? v) → boolean?

> v : any/c

> > procedure

> > (make-gl-short-vector pos) → gl-short-vector?

> pos : exact-nonnegative-integer?

> > procedure

> > (gl-short-vector v ...) → gl-short-vector?

> v : short?

> > procedure

> > (vector->gl-short-vector v ...) → gl-short-vector?

> v : (vectorof short?)

> > procedure

> > (list->gl-short-vector v ...) → gl-short-vector?

> v : (listof short?)

> > procedure

> > (gl-short-vector+ vec ...+) → gl-short-vector?

> vec : gl-short-vector?

> > procedure

> > (gl-short-vector- vec ...+) → gl-short-vector?

> vec : gl-short-vector?

> > procedure

> > (gl-short-vector* x vec) → gl-short-vector?

> x : real?
> vec : gl-short-vector?

Operations on vectors of short elements. The gl-short-vector+ and gl-short-vector- functions compute the element-by-element sum and difference of the given vectors, respectively. The gl-short-vector* function multiplies each element of vec by x.

> > procedure

> > (gl-ushort-vector? v) → boolean?

> v : any/c

> > procedure

> > (make-gl-ushort-vector pos) → gl-ushort-vector?

> pos : exact-nonnegative-integer?

> > procedure

> > (gl-ushort-vector v ...) → gl-ushort-vector?

> v : ushort?

> > procedure

> > (vector->gl-ushort-vector v ...) → gl-ushort-vector?

> v : (vectorof ushort?)

> > procedure

> > (list->gl-ushort-vector v ...) → gl-ushort-vector?

> v : (listof ushort?)

> > procedure

> > (gl-ushort-vector+ vec ...+) → gl-ushort-vector?

> vec : gl-ushort-vector?

> > procedure

> > (gl-ushort-vector- vec ...+) → gl-ushort-vector?

> vec : gl-ushort-vector?

> > procedure

> > (gl-ushort-vector* x vec) → gl-ushort-vector?

> x : real?
> vec : gl-ushort-vector?

Operations on vectors of ushort elements. The gl-ushort-vector+ and gl-ushort-vector- functions compute the element-by-element sum and difference of the given vectors, respectively. The gl-ushort-vector* function multiplies each element of vec by x.

> > procedure

> > (gl-int-vector? v) → boolean?

> v : any/c

> > procedure

> > (make-gl-int-vector pos) → gl-int-vector?

> pos : exact-nonnegative-integer?

> > procedure

> > (gl-int-vector v ...) → gl-int-vector?

> v : int?

> > procedure

> > (vector->gl-int-vector v ...) → gl-int-vector?

> v : (vectorof int?)

> > procedure

> > (list->gl-int-vector v ...) → gl-int-vector?

> v : (listof int?)

> > procedure

> > (gl-int-vector+ vec ...+) → gl-int-vector?

> vec : gl-int-vector?

> > procedure

> > (gl-int-vector- vec ...+) → gl-int-vector?

> vec : gl-int-vector?

> > procedure

> > (gl-int-vector* x vec) → gl-int-vector?

> x : real?
> vec : gl-int-vector?

Operations on vectors of int elements. The gl-int-vector+ and gl-int-vector- functions compute the element-by-element sum and difference of the given vectors, respectively. The gl-int-vector* function multiplies each element of vec by x.

> > procedure

> > (gl-uint-vector? v) → boolean?

> v : any/c

> > procedure

> > (make-gl-uint-vector pos) → gl-uint-vector?

> pos : exact-nonnegative-integer?

> > procedure

> > (gl-uint-vector v ...) → gl-uint-vector?

> v : uint?

> > procedure

> > (vector->gl-uint-vector v ...) → gl-uint-vector?

> v : (vectorof uint?)

> > procedure

> > (list->gl-uint-vector v ...) → gl-uint-vector?

> v : (listof uint?)

> > procedure

> > (gl-uint-vector+ vec ...+) → gl-uint-vector?

> vec : gl-uint-vector?

> > procedure

> > (gl-uint-vector- vec ...+) → gl-uint-vector?

> vec : gl-uint-vector?

> > procedure

> > (gl-uint-vector* x vec) → gl-uint-vector?

> x : real?
> vec : gl-uint-vector?

Operations on vectors of uint elements. The gl-uint-vector+ and gl-uint-vector- functions compute the element-by-element sum and difference of the given vectors, respectively. The gl-uint-vector* function multiplies each element of vec by x.

> > procedure

> > (gl-float-vector? v) → boolean?

> v : any/c

> > procedure

> > (make-gl-float-vector pos) → gl-float-vector?

> pos : exact-nonnegative-integer?

> > procedure

> > (gl-float-vector v ...) → gl-float-vector?

> v : float?

> > procedure

> > (vector->gl-float-vector v ...) → gl-float-vector?

> v : (vectorof float?)

> > procedure

> > (list->gl-float-vector v ...) → gl-float-vector?

> v : (listof float?)

> > procedure

> > (gl-float-vector+ vec ...+) → gl-float-vector?

> vec : gl-float-vector?

> > procedure

> > (gl-float-vector- vec ...+) → gl-float-vector?

> vec : gl-float-vector?

> > procedure

> > (gl-float-vector* x vec) → gl-float-vector?

> x : real?
> vec : gl-float-vector?

Operations on vectors of float elements. The gl-float-vector+ and gl-float-vector- functions compute the element-by-element sum and difference of the given vectors, respectively. The gl-float-vector* function multiplies each element of vec by x.

> > procedure

> > (gl-double-vector? v) → boolean?

> v : any/c

> > procedure

> > (make-gl-double-vector pos) → gl-double-vector?

> pos : exact-nonnegative-integer?

> > procedure

> > (gl-double-vector v ...) → gl-double-vector?

> v : double?

> > procedure

> > (vector->gl-double-vector v ...) → gl-double-vector?

> v : (vectorof double?)

> > procedure

> > (list->gl-double-vector v ...) → gl-double-vector?

> v : (listof double?)

> > procedure

> > (gl-double-vector+ vec ...+) → gl-double-vector?

> vec : gl-double-vector?

> > procedure

> > (gl-double-vector- vec ...+) → gl-double-vector?

> vec : gl-double-vector?

> > procedure

> > (gl-double-vector* x vec) → gl-double-vector?

> x : real?
> vec : gl-double-vector?

Operations on vectors of double elements. The gl-double-vector+ and gl-double-vector- functions compute the element-by-element sum and difference of the given vectors, respectively. The gl-double-vector* function multiplies each element of vec by x.

> > procedure

> > (gl-boolean-vector? v) → boolean?

> v : any/c

> > procedure

> > (make-gl-boolean-vector pos) → gl-boolean-vector?

> pos : exact-nonnegative-integer?

> > procedure

> > (gl-boolean-vector v ...) → gl-boolean-vector?

> v : boolean?

> > procedure

> > (vector->gl-boolean-vector v ...) → gl-boolean-vector?

> v : (vectorof boolean?)

> > procedure

> > (list->gl-boolean-vector v ...) → gl-boolean-vector?

> v : (listof boolean?)

> > procedure

> > (gl-boolean-vector+ vec ...+) → gl-boolean-vector?

> vec : gl-boolean-vector?

> > procedure

> > (gl-boolean-vector- vec ...+) → gl-boolean-vector?

> vec : gl-boolean-vector?

> > procedure

> > (gl-boolean-vector* x vec) → gl-boolean-vector?

> x : real?
> vec : gl-boolean-vector?

Operations on vectors of boolean elements. The gl-boolean-vector+ and gl-boolean-vector- functions compute the element-by-element sum and difference of the given vectors, respectively. The gl-boolean-vector* function multiplies each element of vec by x.

> > procedure

> > (gl-vector-norm vec) → real?

> vec : gl-vector?

Returns the square root of the sum of the squares of the elements of vec.
top ← prev up next →