On this page:
gl-vector?
gl-pointer?
gl-type?
gl-vector->type
gl-vector->cpointer
gl-vector->length
gl-vector->type/  cpointer
gl-vector->type/  cpointer/  length
gl-vector-sizeof
gl-vector-alignof
gl-type->ctype
gl-type-sizeof
gl-type-alignof

22 Utility functions for homogenous vectors

These functions are not part of the OpenGL API but are provided to make working with glVertexPointer and similar procedures easier.

procedure

(gl-vector? v)  boolean?

  v : any/c
Returns #t if v belongs to one of the homogenous vector types which can be used with OpenGL, #f otherwise. These vector types are: u8vector, s8vector, u16vector, s16vector, u32vector, s32vector, f32vector and f64vector.

procedure

(gl-pointer? v)  boolean?

  v : any/c
Returns #t iff v satisfies either gl-vector?, cpointer? or exact-nonnegative-integer?. This defines a very liberal "pointer-to-anything" type. Typically, OpenGL procedures which accept gl-pointer? have additional requirements based on the context. In other words, the fact that the contract suggests that they accept such a wide range of values doesn’t mean that in any particular context all values are legal.

procedure

(gl-type? v)  boolean?

  v : any/c
Return #t iff v is one of the constants GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, GL_FLOAT, or GL_DOUBLE.

procedure

(gl-vector->type v)  gl-type?

  v : gl-vector?
Determine the OpenGL type of v. This returns a numerical value such as GL_SHORT, GL_FLOAT, etc., which can be passed into glVertexPointer and similar procedures.

procedure

(gl-vector->cpointer v)  cpointer?

  v : gl-vector?
Get a C pointer to v.

procedure

(gl-vector->length v)  exact-nonnegative-integer?

  v : gl-vector?
Get the length of v.

procedure

(gl-vector->type/cpointer v)  
gl-type? cpointer?
  v : gl-vector?
Get the OpenGL type and C pointer of v. This is slightly more efficient than getting them each individually.

procedure

(gl-vector->type/cpointer/length v)

  
gl-type?
cpointer?
exact-nonnegative-integer?
  v : gl-vector?
Get the OpenGL type, C pointer and length of v. This is slightly more efficient than getting them each individually.

procedure

(gl-vector-sizeof v)  exact-nonnegative-integer?

  v : gl-vector?
Get the length of v in bytes.

procedure

(gl-vector-alignof v)  exact-nonnegative-integer?

  v : gl-vector?
Get the alignment requirement of v.

procedure

(gl-type->ctype type)  ctype?

  type : gl-type?
Get the C type associated with the given OpenGL type.

procedure

(gl-type-sizeof type)  exact-nonnegative-integer?

  type : gl-type?
Get the length in bytes of values of type type.

procedure

(gl-type-alignof type)  exact-nonnegative-integer?

  type : gl-type?
Get the alignment requirement of values of type type.