Home | History | Annotate | Download | only in glx
      1 /*
      2  * (C) Copyright IBM Corporation 2004
      3  * All Rights Reserved.
      4  *
      5  * Permission is hereby granted, free of charge, to any person obtaining a
      6  * copy of this software and associated documentation files (the "Software"),
      7  * to deal in the Software without restriction, including without limitation
      8  * on the rights to use, copy, modify, merge, publish, distribute, sub
      9  * license, and/or sell copies of the Software, and to permit persons to whom
     10  * the Software is furnished to do so, subject to the following conditions:
     11  *
     12  * The above copyright notice and this permission notice (including the next
     13  * paragraph) shall be included in all copies or substantial portions of the
     14  * Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
     19  * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
     20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
     21  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
     22  * USE OR OTHER DEALINGS IN THE SOFTWARE.
     23  */
     24 
     25 #include <GL/gl.h>
     26 #include "indirect.h"
     27 
     28 static void
     29 TransposeMatrixf(const GLfloat s[16], GLfloat d[16])
     30 {
     31    int i, j;
     32    for (i = 0; i < 4; i++) {
     33       for (j = 0; j < 4; j++) {
     34          d[i * 4 + j] = s[j * 4 + i];
     35       }
     36    }
     37 }
     38 
     39 static void
     40 TransposeMatrixd(const GLdouble s[16], GLdouble d[16])
     41 {
     42    int i, j;
     43    for (i = 0; i < 4; i++) {
     44       for (j = 0; j < 4; j++) {
     45          d[i * 4 + j] = s[j * 4 + i];
     46       }
     47    }
     48 }
     49 
     50 
     51 void
     52 __indirect_glLoadTransposeMatrixdARB(const GLdouble * m)
     53 {
     54    GLdouble mt[16];
     55 
     56    TransposeMatrixd(m, mt);
     57    __indirect_glLoadMatrixd(mt);
     58 }
     59 
     60 void
     61 __indirect_glLoadTransposeMatrixfARB(const GLfloat * m)
     62 {
     63    GLfloat mt[16];
     64 
     65    TransposeMatrixf(m, mt);
     66    __indirect_glLoadMatrixf(mt);
     67 }
     68 
     69 void
     70 __indirect_glMultTransposeMatrixdARB(const GLdouble * m)
     71 {
     72    GLdouble mt[16];
     73 
     74    TransposeMatrixd(m, mt);
     75    __indirect_glMultMatrixd(mt);
     76 }
     77 
     78 void
     79 __indirect_glMultTransposeMatrixfARB(const GLfloat * m)
     80 {
     81    GLfloat mt[16];
     82 
     83    TransposeMatrixf(m, mt);
     84    __indirect_glMultMatrixf(mt);
     85 }
     86