AllegroGL 0.4.4

- Main Page
- Related Pages
- Modules
- Files

Functions
Math conversion routines

Routines to convert between OpenGL and Allegro math types. More...

## Functions
| for ()
| Converts an OpenGL floating-point matrix issued from the matrix stack to an Allegro fixed-point matrix. More...

## Matrix conversion routines
void | allegro_gl_MATRIX_to_GLfloat (MATRIX *m, GLfloat gl[16])
| Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations. More...
void | allegro_gl_MATRIX_to_GLdouble (MATRIX *m, GLdouble gl[16])
| Converts an Allegro fixed-point matrix to an array of doubles suitable for OpenGL's matrix operations. More...
void | allegro_gl_MATRIX_f_to_GLfloat (MATRIX_f *m, GLfloat gl[16])
| Converts an Allegro floating-point matrix to an array of floats suitable for OpenGL's matrix operations. More...
void | allegro_gl_MATRIX_f_to_GLdouble (MATRIX_f *m, GLdouble gl[16])
| Converts an Allegro floating-point matrix to an array of doubles suitable for OpenGL's matrix operations. More...
void | allegro_gl_GLfloat_to_MATRIX (GLfloat gl[16], MATRIX *m)
| Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations. More...
void | allegro_gl_GLdouble_to_MATRIX (GLdouble gl[16], MATRIX *m)
| Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations. More...
void | allegro_gl_GLfloat_to_MATRIX_f (GLfloat gl[16], MATRIX_f *m)
| Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations. More...
void | allegro_gl_GLdouble_to_MATRIX_f (GLdouble gl[16], MATRIX_f *m)
| Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations. More...

## Quaternion conversion routines
void | allegro_gl_apply_quat (QUAT *q)
| Converts a quaternion to a vector/angle, which can be used with glRotate*(). More...
void | allegro_gl_quat_to_glrotatef (QUAT *q, float *angle, float *x, float *y, float *z)
| Converts a quaternion to a vector/angle, which can be used with glRotate*(). More...
void | allegro_gl_quat_to_glrotated (QUAT *q, double *angle, double *x, double *y, double *z)
| Converts a quaternion to a vector/angle, which can be used with glRotate*(). More...

## Detailed Description

Routines to convert between OpenGL and Allegro math types.

## Function Documentation

void allegro_gl_MATRIX_to_GLfloat | ( | MATRIX * | m,
|  | GLfloat | gl[16]
| ) |  |

Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations.

Example:

       MATRIX m = identity_matrix;
       GLfloat gl_m[16];
       get_vector_rotation_matrix(&m, itofix(1), 0, itofix(1), ftofix(43.83));
       allegro_gl_MATRIX_to_GLfloat(&m, &gl_m);
       glLoadMatrixf(&gl_m);

See also
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLdouble_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX()

Definition at line 66 of file math.c.

void allegro_gl_MATRIX_to_GLdouble | ( | MATRIX * | m,
|  | GLdouble | gl[16]
| ) |  |

Converts an Allegro fixed-point matrix to an array of doubles suitable for OpenGL's matrix operations.

See also
  allegro_gl_MATRIX_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLdouble_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX()

Definition at line 82 of file math.c.

void allegro_gl_MATRIX_f_to_GLfloat | ( | MATRIX_f * | m,
|  | GLfloat | gl[16]
| ) |  |

Converts an Allegro floating-point matrix to an array of floats suitable for OpenGL's matrix operations.

See also
  allegro_gl_MATRIX_to_GLfloat()
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLdouble_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX()

Definition at line 98 of file math.c.

void allegro_gl_MATRIX_f_to_GLdouble | ( | MATRIX_f * | m,
|  | GLdouble | gl[16]
| ) |  |

Converts an Allegro floating-point matrix to an array of doubles suitable for OpenGL's matrix operations.

See also
  allegro_gl_MATRIX_to_GLfloat()
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLdouble_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX()

Definition at line 110 of file math.c.

void allegro_gl_GLfloat_to_MATRIX | ( | GLfloat | gl[16],
|  | MATRIX * | m
| ) |  |

Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations.

Example:

       MATRIX m = identity_matrix;
       GLfloat gl_m[16];
       get_vector_rotation_matrix(&m, itofix(1), 0, itofix(1), ftofix(43.83));
       allegro_gl_MATRIX_to_GLfloat(&m, &gl_m);
       glLoadMatrixf(&gl_m);

See also
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLdouble_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX()

void allegro_gl_GLdouble_to_MATRIX | ( | GLdouble | gl[16],
|  | MATRIX * | m
| ) |  |

Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations.

Example:

       MATRIX m = identity_matrix;
       GLfloat gl_m[16];
       get_vector_rotation_matrix(&m, itofix(1), 0, itofix(1), ftofix(43.83));
       allegro_gl_MATRIX_to_GLfloat(&m, &gl_m);
       glLoadMatrixf(&gl_m);

See also
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLdouble_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX()

void allegro_gl_GLfloat_to_MATRIX_f | ( | GLfloat | gl[16],
|  | MATRIX_f * | m
| ) |  |

Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations.

Example:

       MATRIX m = identity_matrix;
       GLfloat gl_m[16];
       get_vector_rotation_matrix(&m, itofix(1), 0, itofix(1), ftofix(43.83));
       allegro_gl_MATRIX_to_GLfloat(&m, &gl_m);
       glLoadMatrixf(&gl_m);

See also
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLdouble_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX()

void allegro_gl_GLdouble_to_MATRIX_f | ( | GLdouble | gl[16],
|  | MATRIX_f * | m
| ) |  |

Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations.

Example:

       MATRIX m = identity_matrix;
       GLfloat gl_m[16];
       get_vector_rotation_matrix(&m, itofix(1), 0, itofix(1), ftofix(43.83));
       allegro_gl_MATRIX_to_GLfloat(&m, &gl_m);
       glLoadMatrixf(&gl_m);

See also
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLdouble_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX()

void allegro_gl_apply_quat | ( | QUAT * | q | ) |

Converts a quaternion to a vector/angle, which can be used with glRotate*().

Values are returned in the parameters.

Example:

       QUAT q = identity_quat;
       float x, y, z, angle;
       allegro_gl_quat_to_glrotatef(&q, &angle, &x, &y, &z);
       glRotatef(angle, x, y, z);

See also
  allegro_gl_quat_to_glrotated(), allegro_gl_apply_quat()

Parameters

  q | The Quaternion to convert.
  angle | The angle of rotation, in degrees.
  x | The rotation vector's x-axis component.
  y | The rotation vector's y-axis component.
  z | The rotation vector's z-axis component.

void allegro_gl_quat_to_glrotatef | ( | QUAT * | q,
|  | float * | angle,
|  | float * | x,
|  | float * | y,
|  | float * | z
| ) |  |

Converts a quaternion to a vector/angle, which can be used with glRotate*().

Values are returned in the parameters.

Example:

       QUAT q = identity_quat;
       float x, y, z, angle;
       allegro_gl_quat_to_glrotatef(&q, &angle, &x, &y, &z);
       glRotatef(angle, x, y, z);

See also
  allegro_gl_quat_to_glrotated(), allegro_gl_apply_quat()

Parameters

  q | The Quaternion to convert.
  angle | The angle of rotation, in degrees.
  x | The rotation vector's x-axis component.
  y | The rotation vector's y-axis component.
  z | The rotation vector's z-axis component.

Definition at line 250 of file math.c.

Referenced by for().

void allegro_gl_quat_to_glrotated | ( | QUAT * | q,
|  | double * | angle,
|  | double * | x,
|  | double * | y,
|  | double * | z
| ) |  |

Converts a quaternion to a vector/angle, which can be used with glRotate*().

Values are returned in the parameters. See allegro_gl_quat_to_rotatef() for an example.

See also
  allegro_gl_quat_to_glrotatef(), allegro_gl_apply_quat()

Parameters

  q | The Quaternion to convert.
  angle | The angle of rotation, in degrees.
  x | The rotation vector's x-axis component.
  y | The rotation vector's y-axis component.
  z | The rotation vector's z-axis component.

Definition at line 282 of file math.c.

Referenced by for().

for | ( |  | ) |

Converts an OpenGL floating-point matrix issued from the matrix stack to an Allegro fixed-point matrix.

See also
  allegro_gl_MATRIX_to_GLfloat()
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLdouble_to_MATRIX_f() Converts an OpenGL double precision floating-point matrix issued from the matrix stack to an Allegro fixed-point matrix.
  allegro_gl_MATRIX_to_GLfloat()
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLdouble_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX() Converts an OpenGL floating-point matrix issued from the matrix stack to an Allegro floating-point matrix.
  allegro_gl_MATRIX_to_GLfloat()
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLdouble_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX() Converts an OpenGL double precision floating-point matrix issued from the matrix stack to an Allegro single-precision floating-point matrix.
  allegro_gl_MATRIX_to_GLfloat()
  allegro_gl_MATRIX_to_GLdouble()
  allegro_gl_MATRIX_f_to_GLfloat()
  allegro_gl_MATRIX_f_to_GLdouble()
  allegro_gl_GLdouble_to_MATRIX()
  allegro_gl_GLfloat_to_MATRIX_f()
  allegro_gl_GLfloat_to_MATRIX() Multiplies the Quaternion to the current transformation matrix, by converting it to a call to glRotatef()

Example:

       QUAT q = identity_quat;
       get_vector_rotation_quat(&q, itofix(1), 0, itofix(1), ftofix(43.83));
       glLoadIdentity();
       allegro_gl_apply_quat(&q);

See also
  allegro_gl_quat_to_glrotatef(), allegro_gl_quat_to_glrotated()

Parameters

  q | The Quaternion to apply.

Definition at line 114 of file math.c.

References allegro_gl_quat_to_glrotated(), and allegro_gl_quat_to_glrotatef().