<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>AllegroGL: math.c File Reference</title> <link href="alleggl.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.2 --> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <h1>math.c File Reference</h1>Converting mathematical structures from Allegro to OpenGL. <a href="#_details">More...</a> <p> <code>#include <math.h></code><br> <code>#include <allegro.h></code><br> <code>#include "<a class="el" href="alleggl_8h-source.html">alleggl.h</a>"</code><br> <code>#include "allglint.h"</code><br> <p> <a href="math_8c-source.html">Go to the source code of this file.</a><h2>Defines</h2> <ul> <li><a class="anchor" name="e71449b1cc6e6250b91f539153a7a0d3"></a><!-- doxytag: member="math.c::M_PI" ref="e71449b1cc6e6250b91f539153a7a0d3" args="" --> #define <a class="el" href="math_8c.html#e71449b1cc6e6250b91f539153a7a0d3">M_PI</a> 3.14159265358979323846 <li><a class="anchor" name="33706d38f2836132b07580c38541b0ba"></a><!-- doxytag: member="math.c::ALGL_NOCONV" ref="33706d38f2836132b07580c38541b0ba" args="(x)" --> #define <a class="el" href="math_8c.html#33706d38f2836132b07580c38541b0ba">ALGL_NOCONV</a>(x) x <li>#define <a class="el" href="math_8c.html#25e8baba5630176200a8cfa8a6fdd1e0">TRANSLATE_AL_TO_GL</a>(al_type, gl_type, convertor) <li>#define <a class="el" href="math_8c.html#69497b942cb028426171b3ca81bf2598">TRANSLATE_GL_TO_AL</a>(gl_type, al_type, convertor) <li><a class="anchor" name="779175036d19925ff6aa6469c2926b00"></a><!-- doxytag: member="math.c::RAD_2_DEG" ref="779175036d19925ff6aa6469c2926b00" args="(a)" --> #define <a class="el" href="math_8c.html#779175036d19925ff6aa6469c2926b00">RAD_2_DEG</a>(a) ((a) * 180 / M_PI) </ul> <h2>Functions</h2> <tr><td colspan="2"><div class="groupHeader">Matrix conversion routines</div></td></tr> <ul> <li>void <a class="el" href="group__math.html#g4cf4f453cb3f95a1e7e861a7401b4a8d">allegro_gl_MATRIX_to_GLfloat</a> (MATRIX *m, GLfloat gl[16]) <dl class="el"><dd class="mdescRight">Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations. <a href="group__math.html#g4cf4f453cb3f95a1e7e861a7401b4a8d"></a><br></dl><li>void <a class="el" href="group__math.html#gee6cb48f8e3e70abecc6c282a8ea1edc">allegro_gl_MATRIX_to_GLdouble</a> (MATRIX *m, GLdouble gl[16]) <dl class="el"><dd class="mdescRight">Converts an Allegro fixed-point matrix to an array of doubles suitable for OpenGL's matrix operations. <a href="group__math.html#gee6cb48f8e3e70abecc6c282a8ea1edc"></a><br></dl><li>void <a class="el" href="group__math.html#ge8e0ee18b9aeca955402be16de6ca79d">allegro_gl_MATRIX_f_to_GLfloat</a> (MATRIX_f *m, GLfloat gl[16]) <dl class="el"><dd class="mdescRight">Converts an Allegro floating-point matrix to an array of floats suitable for OpenGL's matrix operations. <a href="group__math.html#ge8e0ee18b9aeca955402be16de6ca79d"></a><br></dl><li>void <a class="el" href="group__math.html#gb93f3588ea08b048f418023aa76cb3fc">allegro_gl_MATRIX_f_to_GLdouble</a> (MATRIX_f *m, GLdouble gl[16]) <dl class="el"><dd class="mdescRight">Converts an Allegro floating-point matrix to an array of doubles suitable for OpenGL's matrix operations. <a href="group__math.html#gb93f3588ea08b048f418023aa76cb3fc"></a><br></dl><li>void <a class="el" href="group__math.html#g468e83ca4de52ed839978d48f5dbe111">allegro_gl_GLfloat_to_MATRIX</a> (GLfloat gl[16], MATRIX *m) <dl class="el"><dd class="mdescRight">Converts an OpenGL floating-point matrix issued from the matrix stack to an Allegro fixed-point matrix. <a href="group__math.html#g468e83ca4de52ed839978d48f5dbe111"></a><br></dl><li>void <a class="el" href="group__math.html#g68e2e0e9dcdba42004070a5f8f547994">allegro_gl_GLdouble_to_MATRIX</a> (GLdouble gl[16], MATRIX *m) <dl class="el"><dd class="mdescRight">Converts an OpenGL double precision floating-point matrix issued from the matrix stack to an Allegro fixed-point matrix. <a href="group__math.html#g68e2e0e9dcdba42004070a5f8f547994"></a><br></dl><li>void <a class="el" href="group__math.html#g08692466ae37d7888bbd5f5ee5aa9268">allegro_gl_GLfloat_to_MATRIX_f</a> (GLfloat gl[16], MATRIX_f *m) <dl class="el"><dd class="mdescRight">Converts an OpenGL floating-point matrix issued from the matrix stack to an Allegro floating-point matrix. <a href="group__math.html#g08692466ae37d7888bbd5f5ee5aa9268"></a><br></dl><li>void <a class="el" href="group__math.html#ga6b729a9e93e249a8a76e078e94a2b44">allegro_gl_GLdouble_to_MATRIX_f</a> (GLdouble gl[16], MATRIX_f *m) <dl class="el"><dd class="mdescRight">Converts an OpenGL double precision floating-point matrix issued from the matrix stack to an Allegro single-precision floating-point matrix. <a href="group__math.html#ga6b729a9e93e249a8a76e078e94a2b44"></a><br></dl></ul> <tr><td colspan="2"><div class="groupHeader">Quaternion conversion routines</div></td></tr> <ul> <li>void <a class="el" href="group__math.html#ga83a678516d8a7a5503a2b0c9014cb64">allegro_gl_apply_quat</a> (QUAT *q) <dl class="el"><dd class="mdescRight">Multiplies the Quaternion to the current transformation matrix, by converting it to a call to glRotatef(). <a href="group__math.html#ga83a678516d8a7a5503a2b0c9014cb64"></a><br></dl><li>void <a class="el" href="group__math.html#gb00b667363181a8f0853121170bebaca">allegro_gl_quat_to_glrotatef</a> (QUAT *q, float *angle, float *x, float *y, float *z) <dl class="el"><dd class="mdescRight">Converts a quaternion to a vector/angle, which can be used with glRotate*(). <a href="group__math.html#gb00b667363181a8f0853121170bebaca"></a><br></dl><li>void <a class="el" href="group__math.html#g956160418e1c0c37143dd3cee54477ce">allegro_gl_quat_to_glrotated</a> (QUAT *q, double *angle, double *x, double *y, double *z) <dl class="el"><dd class="mdescRight">Converts a quaternion to a vector/angle, which can be used with glRotate*(). <a href="group__math.html#g956160418e1c0c37143dd3cee54477ce"></a><br></dl></ul> <hr><a name="_details"></a><h2>Detailed Description</h2> Converting mathematical structures from Allegro to OpenGL. <p> This file provides routines to make Allegro matrices from GL-style matrices, and vice versa. This also provides a QUAT to glRotate converter.<p> Note that Allegro matrices can only store affine transformations. <p> Definition in file <a class="el" href="math_8c-source.html">math.c</a>.<hr><h2>Define Documentation</h2> <a class="anchor" name="25e8baba5630176200a8cfa8a6fdd1e0"></a><!-- doxytag: member="math.c::TRANSLATE_AL_TO_GL" ref="25e8baba5630176200a8cfa8a6fdd1e0" args="(al_type, gl_type, convertor)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define TRANSLATE_AL_TO_GL </td> <td>(</td> <td class="paramtype">al_type, <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">gl_type, <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">convertor </td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> <b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> allegro_gl_##al_type##_to_##gl_type (al_type *m, gl_type gl[16]) \ { \ <span class="keywordtype">int</span> col, row; \ <span class="keywordflow">for</span> (col = 0; col < 3; col++) \ <span class="keywordflow">for</span> (row = 0; row < 3; row++) \ gl[col*4+row] = convertor (m->v[col][row]); \ for (row = 0; row < 3; row++) \ gl[12+row] = convertor (m->t[row]); \ for (col = 0; col < 3; col++) \ gl[4*col + 3] = 0; \ gl[15] = 1; \ } </pre></div> <p> Definition at line <a class="el" href="math_8c-source.html#l00028">28</a> of file <a class="el" href="math_8c-source.html">math.c</a>. </div> </div><p> <a class="anchor" name="69497b942cb028426171b3ca81bf2598"></a><!-- doxytag: member="math.c::TRANSLATE_GL_TO_AL" ref="69497b942cb028426171b3ca81bf2598" args="(gl_type, al_type, convertor)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define TRANSLATE_GL_TO_AL </td> <td>(</td> <td class="paramtype">gl_type, <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">al_type, <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">convertor </td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> <b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> allegro_gl_##gl_type##_to_##al_type (gl_type gl[16], al_type *m) \ { \ <span class="keywordtype">int</span> col, row; \ <span class="keywordflow">for</span> (col = 0; col < 3; col++) \ <span class="keywordflow">for</span> (row = 0; row < 3; row++) \ m->v[col][row] = convertor (gl[col*4+row]); \ <span class="keywordflow">for</span> (row = 0; row < 3; row++) \ m->t[row] = convertor (gl[12+row]); \ } </pre></div> <p> Definition at line <a class="el" href="math_8c-source.html#l00118">118</a> of file <a class="el" href="math_8c-source.html">math.c</a>. </div> </div><p> <hr size="1"><address style="text-align: right;"><small>Generated on Mon Nov 12 11:05:32 2007 for AllegroGL by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address> </body> </html>