ReactOS 0.4.15-dev-7788-g1ad9096
matrix.c File Reference
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "context.h"
#include "dlist.h"
#include "macros.h"
#include "matrix.h"
#include "mmath.h"
#include "types.h"
Include dependency graph for matrix.c:

Go to the source code of this file.

Macros

#define A(row, col)   a[(col<<2)+row]
 
#define B(row, col)   b[(col<<2)+row]
 
#define P(row, col)   product[(col<<2)+row]
 
#define MAT(m, r, c)   (m)[(c)*4+(r)]
 
#define m11   MAT(m,0,0)
 
#define m12   MAT(m,0,1)
 
#define m13   MAT(m,0,2)
 
#define m14   MAT(m,0,3)
 
#define m21   MAT(m,1,0)
 
#define m22   MAT(m,1,1)
 
#define m23   MAT(m,1,2)
 
#define m24   MAT(m,1,3)
 
#define m31   MAT(m,2,0)
 
#define m32   MAT(m,2,1)
 
#define m33   MAT(m,2,2)
 
#define m34   MAT(m,2,3)
 
#define m41   MAT(m,3,0)
 
#define m42   MAT(m,3,1)
 
#define m43   MAT(m,3,2)
 
#define m44   MAT(m,3,3)
 
#define M(row, col)   m[col*4+row]
 
#define M(row, col)   m[col*4+row]
 
#define M(row, col)   m[col*4+row]
 
#define M(row, col)   m[col*4+row]
 

Typedefs

typedef GLfloat Mat2[2][2]
 

Enumerations

enum  {
  M00 = 0 , M01 = 4 , M02 = 8 , M03 = 12 ,
  M10 = 1 , M11 = 5 , M12 = 9 , M13 = 13 ,
  M20 = 2 , M21 = 6 , M22 = 10 , M23 = 14 ,
  M30 = 3 , M31 = 7 , M32 = 11 , M33 = 15
}
 

Functions

static void matmul (GLfloat *product, const GLfloat *a, const GLfloat *b)
 
static void invert_matrix_general (const GLfloat *m, GLfloat *out)
 
static void invert_matrix (const GLfloat *m, GLfloat *out)
 
static GLboolean is_identity (const GLfloat m[16])
 
void gl_analyze_modelview_matrix (GLcontext *ctx)
 
void gl_analyze_projection_matrix (GLcontext *ctx)
 
void gl_analyze_texture_matrix (GLcontext *ctx)
 
void gl_Frustum (GLcontext *ctx, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
 
void gl_Ortho (GLcontext *ctx, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
 
void gl_MatrixMode (GLcontext *ctx, GLenum mode)
 
void gl_PushMatrix (GLcontext *ctx)
 
void gl_PopMatrix (GLcontext *ctx)
 
void gl_LoadIdentity (GLcontext *ctx)
 
void gl_LoadMatrixf (GLcontext *ctx, const GLfloat *m)
 
void gl_MultMatrixf (GLcontext *ctx, const GLfloat *m)
 
void gl_rotation_matrix (GLfloat angle, GLfloat x, GLfloat y, GLfloat z, GLfloat m[])
 
void gl_Rotatef (GLcontext *ctx, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
 
void gl_Scalef (GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z)
 
void gl_Translatef (GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z)
 
void gl_Viewport (GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height)
 

Variables

static GLfloat Identity [16]
 

Macro Definition Documentation

◆ A

#define A (   row,
  col 
)    a[(col<<2)+row]

◆ B

#define B (   row,
  col 
)    b[(col<<2)+row]

◆ M [1/4]

#define M (   row,
  col 
)    m[col*4+row]

◆ M [2/4]

#define M (   row,
  col 
)    m[col*4+row]

◆ M [3/4]

#define M (   row,
  col 
)    m[col*4+row]

◆ M [4/4]

#define M (   row,
  col 
)    m[col*4+row]

◆ m11

#define m11   MAT(m,0,0)

◆ m12

#define m12   MAT(m,0,1)

◆ m13

#define m13   MAT(m,0,2)

◆ m14

#define m14   MAT(m,0,3)

◆ m21

#define m21   MAT(m,1,0)

◆ m22

#define m22   MAT(m,1,1)

◆ m23

#define m23   MAT(m,1,2)

◆ m24

#define m24   MAT(m,1,3)

◆ m31

#define m31   MAT(m,2,0)

◆ m32

#define m32   MAT(m,2,1)

◆ m33

#define m33   MAT(m,2,2)

◆ m34

#define m34   MAT(m,2,3)

◆ m41

#define m41   MAT(m,3,0)

◆ m42

#define m42   MAT(m,3,1)

◆ m43

#define m43   MAT(m,3,2)

◆ m44

#define m44   MAT(m,3,3)

◆ MAT

#define MAT (   m,
  r,
  c 
)    (m)[(c)*4+(r)]

◆ P

#define P (   row,
  col 
)    product[(col<<2)+row]

Typedef Documentation

◆ Mat2

typedef GLfloat Mat2[2][2]

Definition at line 190 of file matrix.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M00 
M01 
M02 
M03 
M10 
M11 
M12 
M13 
M20 
M21 
M22 
M23 
M30 
M31 
M32 
M33 

Definition at line 192 of file matrix.c.

192 {
193 M00 = 0, M01 = 4, M02 = 8, M03 = 12,
194 M10 = 1, M11 = 5, M12 = 9, M13 = 13,
195 M20 = 2, M21 = 6, M22 = 10,M23 = 14,
196 M30 = 3, M31 = 7, M32 = 11,M33 = 15
197};
@ M23
Definition: matrix.c:195
@ M21
Definition: matrix.c:195
@ M33
Definition: matrix.c:196
@ M13
Definition: matrix.c:194
@ M20
Definition: matrix.c:195
@ M31
Definition: matrix.c:196
@ M01
Definition: matrix.c:193
@ M03
Definition: matrix.c:193
@ M32
Definition: matrix.c:196
@ M10
Definition: matrix.c:194
@ M12
Definition: matrix.c:194
@ M11
Definition: matrix.c:194
@ M02
Definition: matrix.c:193
@ M30
Definition: matrix.c:196
@ M00
Definition: matrix.c:193
@ M22
Definition: matrix.c:195

Function Documentation

◆ gl_analyze_modelview_matrix()

void gl_analyze_modelview_matrix ( GLcontext ctx)

Definition at line 420 of file matrix.c.

421{
422 const GLfloat *m = ctx->ModelViewMatrix;
423 if (is_identity(m)) {
424 ctx->ModelViewMatrixType = MATRIX_IDENTITY;
425 }
426 else if ( m[4]==0.0F && m[ 8]==0.0F
427 && m[1]==0.0F && m[ 9]==0.0F
428 && m[2]==0.0F && m[6]==0.0F && m[10]==1.0F && m[14]==0.0F
429 && m[3]==0.0F && m[7]==0.0F && m[11]==0.0F && m[15]==1.0F) {
430 ctx->ModelViewMatrixType = MATRIX_2D_NO_ROT;
431 }
432 else if ( m[ 8]==0.0F
433 && m[ 9]==0.0F
434 && m[2]==0.0F && m[6]==0.0F && m[10]==1.0F && m[14]==0.0F
435 && m[3]==0.0F && m[7]==0.0F && m[11]==0.0F && m[15]==1.0F) {
436 ctx->ModelViewMatrixType = MATRIX_2D;
437 }
438 else if (m[3]==0.0F && m[7]==0.0F && m[11]==0.0F && m[15]==1.0F) {
439 ctx->ModelViewMatrixType = MATRIX_3D;
440 }
441 else {
442 ctx->ModelViewMatrixType = MATRIX_GENERAL;
443 }
444
445 invert_matrix( ctx->ModelViewMatrix, ctx->ModelViewInv );
446 ctx->NewModelViewMatrix = GL_FALSE;
447}
static void invert_matrix(const GLfloat *m, GLfloat *out)
Definition: matrix.c:290
static GLboolean is_identity(const GLfloat m[16])
Definition: matrix.c:402
#define MATRIX_GENERAL
Definition: types.h:1242
#define MATRIX_2D_NO_ROT
Definition: types.h:1247
#define MATRIX_3D
Definition: types.h:1248
#define MATRIX_IDENTITY
Definition: types.h:1243
#define MATRIX_2D
Definition: types.h:1246
float GLfloat
Definition: gl.h:161
#define GL_FALSE
Definition: gl.h:173
const GLfloat * m
Definition: glext.h:10848

Referenced by gl_Begin(), gl_ClipPlane(), gl_Lightfv(), gl_RasterPos4f(), gl_TexGenfv(), and gl_windowpos().

◆ gl_analyze_projection_matrix()

void gl_analyze_projection_matrix ( GLcontext ctx)

Definition at line 455 of file matrix.c.

456{
457 /* look for common-case ortho and perspective matrices */
458 const GLfloat *m = ctx->ProjectionMatrix;
459 if (is_identity(m)) {
460 ctx->ProjectionMatrixType = MATRIX_IDENTITY;
461 }
462 else if ( m[4]==0.0F && m[8] ==0.0F
463 && m[1]==0.0F && m[9] ==0.0F
464 && m[2]==0.0F && m[6]==0.0F
465 && m[3]==0.0F && m[7]==0.0F && m[11]==0.0F && m[15]==1.0F) {
466 ctx->ProjectionMatrixType = MATRIX_ORTHO;
467 }
468 else if ( m[4]==0.0F && m[12]==0.0F
469 && m[1]==0.0F && m[13]==0.0F
470 && m[2]==0.0F && m[6]==0.0F
471 && m[3]==0.0F && m[7]==0.0F && m[11]==-1.0F && m[15]==0.0F) {
472 ctx->ProjectionMatrixType = MATRIX_PERSPECTIVE;
473 }
474 else {
475 ctx->ProjectionMatrixType = MATRIX_GENERAL;
476 }
477
478 ctx->NewProjectionMatrix = GL_FALSE;
479}
#define MATRIX_ORTHO
Definition: types.h:1244
#define MATRIX_PERSPECTIVE
Definition: types.h:1245

Referenced by gl_Begin(), and gl_RasterPos4f().

◆ gl_analyze_texture_matrix()

void gl_analyze_texture_matrix ( GLcontext ctx)

Definition at line 487 of file matrix.c.

488{
489 const GLfloat *m = ctx->TextureMatrix;
490 if (is_identity(m)) {
491 ctx->TextureMatrixType = MATRIX_IDENTITY;
492 }
493 else if ( m[ 8]==0.0F
494 && m[ 9]==0.0F
495 && m[2]==0.0F && m[6]==0.0F && m[10]==1.0F && m[14]==0.0F
496 && m[3]==0.0F && m[7]==0.0F && m[11]==0.0F && m[15]==1.0F) {
497 ctx->TextureMatrixType = MATRIX_2D;
498 }
499 else if (m[3]==0.0F && m[7]==0.0F && m[11]==0.0F && m[15]==1.0F) {
500 ctx->TextureMatrixType = MATRIX_3D;
501 }
502 else {
503 ctx->TextureMatrixType = MATRIX_GENERAL;
504 }
505
506 ctx->NewTextureMatrix = GL_FALSE;
507}

Referenced by gl_RasterPos4f(), and gl_transform_vb_part2().

◆ gl_Frustum()

void gl_Frustum ( GLcontext ctx,
GLdouble  left,
GLdouble  right,
GLdouble  bottom,
GLdouble  top,
GLdouble  nearval,
GLdouble  farval 
)

Definition at line 511 of file matrix.c.

515{
516 GLfloat x, y, a, b, c, d;
517 GLfloat m[16];
518
519 if (nearval<=0.0 || farval<=0.0) {
520 gl_error( ctx, GL_INVALID_VALUE, "glFrustum(near or far)" );
521 }
522
523 x = (2.0*nearval) / (right-left);
524 y = (2.0*nearval) / (top-bottom);
525 a = (right+left) / (right-left);
526 b = (top+bottom) / (top-bottom);
527 c = -(farval+nearval) / ( farval-nearval);
528 d = -(2.0*farval*nearval) / (farval-nearval); /* error? */
529
530#define M(row,col) m[col*4+row]
531 M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F;
532 M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F;
533 M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d;
534 M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F;
535#undef M
536
537 gl_MultMatrixf( ctx, m );
538
539
540 /* Need to keep a stack of near/far values in case the user push/pops
541 * the projection matrix stack so that we can call Driver.NearFar()
542 * after a pop.
543 */
544 ctx->NearFarStack[ctx->ProjectionStackDepth][0] = nearval;
545 ctx->NearFarStack[ctx->ProjectionStackDepth][1] = farval;
546
547 if (ctx->Driver.NearFar) {
548 (*ctx->Driver.NearFar)( ctx, nearval, farval );
549 }
550}
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
void gl_MultMatrixf(GLcontext *ctx, const GLfloat *m)
Definition: matrix.c:785
#define M(row, col)
#define GL_INVALID_VALUE
Definition: gl.h:695
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
const GLubyte * c
Definition: glext.h:8905
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
#define a
Definition: ke_i.h:78
#define c
Definition: ke_i.h:80
#define b
Definition: ke_i.h:79

Referenced by execute_list(), and init_exec_pointers().

◆ gl_LoadIdentity()

void gl_LoadIdentity ( GLcontext ctx)

Definition at line 709 of file matrix.c.

710{
711 if (INSIDE_BEGIN_END(ctx)) {
712 gl_error( ctx, GL_INVALID_OPERATION, "glLoadIdentity" );
713 return;
714 }
715 switch (ctx->Transform.MatrixMode) {
716 case GL_MODELVIEW:
717 MEMCPY( ctx->ModelViewMatrix, Identity, 16*sizeof(GLfloat) );
718 MEMCPY( ctx->ModelViewInv, Identity, 16*sizeof(GLfloat) );
719 ctx->ModelViewMatrixType = MATRIX_IDENTITY;
720 ctx->NewModelViewMatrix = GL_FALSE;
721 break;
722 case GL_PROJECTION:
723 MEMCPY( ctx->ProjectionMatrix, Identity, 16*sizeof(GLfloat) );
724 ctx->ProjectionMatrixType = MATRIX_IDENTITY;
725 ctx->NewProjectionMatrix = GL_FALSE;
726 break;
727 case GL_TEXTURE:
728 MEMCPY( ctx->TextureMatrix, Identity, 16*sizeof(GLfloat) );
729 ctx->TextureMatrixType = MATRIX_IDENTITY;
730 ctx->NewTextureMatrix = GL_FALSE;
731 break;
732 default:
733 gl_problem(ctx, "Bad matrix mode in gl_LoadIdentity");
734 }
735}
void gl_problem(const GLcontext *ctx, const char *s)
Definition: context.c:1394
static GLfloat Identity[16]
Definition: matrix.c:127
#define GL_TEXTURE
Definition: gl.h:247
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_PROJECTION
Definition: gl.h:246
#define GL_MODELVIEW
Definition: gl.h:245
#define MEMCPY(DST, SRC, BYTES)
Definition: macros.h:231
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135

Referenced by execute_list(), and init_exec_pointers().

◆ gl_LoadMatrixf()

void gl_LoadMatrixf ( GLcontext ctx,
const GLfloat m 
)

Definition at line 738 of file matrix.c.

739{
740 if (INSIDE_BEGIN_END(ctx)) {
741 gl_error( ctx, GL_INVALID_OPERATION, "glLoadMatrix" );
742 return;
743 }
744 switch (ctx->Transform.MatrixMode) {
745 case GL_MODELVIEW:
746 MEMCPY( ctx->ModelViewMatrix, m, 16*sizeof(GLfloat) );
747 ctx->NewModelViewMatrix = GL_TRUE;
748 break;
749 case GL_PROJECTION:
750 MEMCPY( ctx->ProjectionMatrix, m, 16*sizeof(GLfloat) );
751 ctx->NewProjectionMatrix = GL_TRUE;
752 {
753 float n,f,c,d;
754
755#define M(row,col) m[col*4+row]
756 c = M(2,2);
757 d = M(2,3);
758#undef M
759 n = d / (c-1);
760 f = d / (c+1);
761
762 /* Need to keep a stack of near/far values in case the user
763 * push/pops the projection matrix stack so that we can call
764 * Driver.NearFar() after a pop.
765 */
766 ctx->NearFarStack[ctx->ProjectionStackDepth][0] = n;
767 ctx->NearFarStack[ctx->ProjectionStackDepth][1] = f;
768
769 if (ctx->Driver.NearFar) {
770 (*ctx->Driver.NearFar)( ctx, n, f );
771 }
772 }
773 break;
774 case GL_TEXTURE:
775 MEMCPY( ctx->TextureMatrix, m, 16*sizeof(GLfloat) );
776 ctx->NewTextureMatrix = GL_TRUE;
777 break;
778 default:
779 gl_problem(ctx, "Bad matrix mode in gl_LoadMatrixf");
780 }
781}
#define GL_TRUE
Definition: gl.h:174
GLdouble n
Definition: glext.h:7729
GLfloat f
Definition: glext.h:7540
#define f
Definition: ke_i.h:83

Referenced by execute_list(), and init_exec_pointers().

◆ gl_MatrixMode()

void gl_MatrixMode ( GLcontext ctx,
GLenum  mode 
)

Definition at line 584 of file matrix.c.

585{
586 if (INSIDE_BEGIN_END(ctx)) {
587 gl_error( ctx, GL_INVALID_OPERATION, "glMatrixMode" );
588 return;
589 }
590 switch (mode) {
591 case GL_MODELVIEW:
592 case GL_PROJECTION:
593 case GL_TEXTURE:
594 ctx->Transform.MatrixMode = mode;
595 break;
596 default:
597 gl_error( ctx, GL_INVALID_ENUM, "glMatrixMode" );
598 }
599}
#define GL_INVALID_ENUM
Definition: gl.h:694
GLenum mode
Definition: glext.h:6217

Referenced by execute_list(), and init_exec_pointers().

◆ gl_MultMatrixf()

void gl_MultMatrixf ( GLcontext ctx,
const GLfloat m 
)

Definition at line 785 of file matrix.c.

786{
787 if (INSIDE_BEGIN_END(ctx)) {
788 gl_error( ctx, GL_INVALID_OPERATION, "glMultMatrix" );
789 return;
790 }
791 switch (ctx->Transform.MatrixMode) {
792 case GL_MODELVIEW:
793 matmul( ctx->ModelViewMatrix, ctx->ModelViewMatrix, m );
794 ctx->NewModelViewMatrix = GL_TRUE;
795 break;
796 case GL_PROJECTION:
797 matmul( ctx->ProjectionMatrix, ctx->ProjectionMatrix, m );
798 ctx->NewProjectionMatrix = GL_TRUE;
799 break;
800 case GL_TEXTURE:
801 matmul( ctx->TextureMatrix, ctx->TextureMatrix, m );
802 ctx->NewTextureMatrix = GL_TRUE;
803 break;
804 default:
805 gl_problem(ctx, "Bad matrix mode in gl_MultMatrixf");
806 }
807}
static void matmul(GLfloat *product, const GLfloat *a, const GLfloat *b)
Definition: matrix.c:154

Referenced by execute_list(), gl_Frustum(), gl_Ortho(), gl_Rotatef(), and init_exec_pointers().

◆ gl_Ortho()

void gl_Ortho ( GLcontext ctx,
GLdouble  left,
GLdouble  right,
GLdouble  bottom,
GLdouble  top,
GLdouble  nearval,
GLdouble  farval 
)

Definition at line 553 of file matrix.c.

557{
558 GLfloat x, y, z;
559 GLfloat tx, ty, tz;
560 GLfloat m[16];
561
562 x = 2.0 / (right-left);
563 y = 2.0 / (top-bottom);
564 z = -2.0 / (farval-nearval);
565 tx = -(right+left) / (right-left);
566 ty = -(top+bottom) / (top-bottom);
567 tz = -(farval+nearval) / (farval-nearval);
568
569#define M(row,col) m[col*4+row]
570 M(0,0) = x; M(0,1) = 0.0F; M(0,2) = 0.0F; M(0,3) = tx;
571 M(1,0) = 0.0F; M(1,1) = y; M(1,2) = 0.0F; M(1,3) = ty;
572 M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = z; M(2,3) = tz;
573 M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = 0.0F; M(3,3) = 1.0F;
574#undef M
575
576 gl_MultMatrixf( ctx, m );
577
578 if (ctx->Driver.NearFar) {
579 (*ctx->Driver.NearFar)( ctx, nearval, farval );
580 }
581}
GLbyte GLbyte tz
Definition: glext.h:8756
GLbyte ty
Definition: glext.h:8756
GLdouble GLdouble z
Definition: glext.h:5874

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PopMatrix()

void gl_PopMatrix ( GLcontext ctx)

Definition at line 653 of file matrix.c.

654{
655 if (INSIDE_BEGIN_END(ctx)) {
656 gl_error( ctx, GL_INVALID_OPERATION, "glPopMatrix" );
657 return;
658 }
659 switch (ctx->Transform.MatrixMode) {
660 case GL_MODELVIEW:
661 if (ctx->ModelViewStackDepth==0) {
662 gl_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix");
663 return;
664 }
665 ctx->ModelViewStackDepth--;
666 MEMCPY( ctx->ModelViewMatrix,
667 ctx->ModelViewStack[ctx->ModelViewStackDepth],
668 16*sizeof(GLfloat) );
669 ctx->NewModelViewMatrix = GL_TRUE;
670 break;
671 case GL_PROJECTION:
672 if (ctx->ProjectionStackDepth==0) {
673 gl_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix");
674 return;
675 }
676 ctx->ProjectionStackDepth--;
677 MEMCPY( ctx->ProjectionMatrix,
678 ctx->ProjectionStack[ctx->ProjectionStackDepth],
679 16*sizeof(GLfloat) );
680 ctx->NewProjectionMatrix = GL_TRUE;
681
682 /* Device driver near/far values */
683 {
684 GLfloat nearVal = ctx->NearFarStack[ctx->ProjectionStackDepth][0];
685 GLfloat farVal = ctx->NearFarStack[ctx->ProjectionStackDepth][1];
686 if (ctx->Driver.NearFar) {
687 (*ctx->Driver.NearFar)( ctx, nearVal, farVal );
688 }
689 }
690 break;
691 case GL_TEXTURE:
692 if (ctx->TextureStackDepth==0) {
693 gl_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix");
694 return;
695 }
696 ctx->TextureStackDepth--;
697 MEMCPY( ctx->TextureMatrix,
698 ctx->TextureStack[ctx->TextureStackDepth],
699 16*sizeof(GLfloat) );
700 ctx->NewTextureMatrix = GL_TRUE;
701 break;
702 default:
703 gl_problem(ctx, "Bad matrix mode in gl_PopMatrix");
704 }
705}
#define GL_STACK_UNDERFLOW
Definition: gl.h:698

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PushMatrix()

void gl_PushMatrix ( GLcontext ctx)

Definition at line 603 of file matrix.c.

604{
605 if (INSIDE_BEGIN_END(ctx)) {
606 gl_error( ctx, GL_INVALID_OPERATION, "glPushMatrix" );
607 return;
608 }
609 switch (ctx->Transform.MatrixMode) {
610 case GL_MODELVIEW:
611 if (ctx->ModelViewStackDepth>=MAX_MODELVIEW_STACK_DEPTH-1) {
612 gl_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix");
613 return;
614 }
615 MEMCPY( ctx->ModelViewStack[ctx->ModelViewStackDepth],
616 ctx->ModelViewMatrix,
617 16*sizeof(GLfloat) );
618 ctx->ModelViewStackDepth++;
619 break;
620 case GL_PROJECTION:
621 if (ctx->ProjectionStackDepth>=MAX_PROJECTION_STACK_DEPTH) {
622 gl_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix");
623 return;
624 }
625 MEMCPY( ctx->ProjectionStack[ctx->ProjectionStackDepth],
626 ctx->ProjectionMatrix,
627 16*sizeof(GLfloat) );
628 ctx->ProjectionStackDepth++;
629
630 /* Save near and far projection values */
631 ctx->NearFarStack[ctx->ProjectionStackDepth][0]
632 = ctx->NearFarStack[ctx->ProjectionStackDepth-1][0];
633 ctx->NearFarStack[ctx->ProjectionStackDepth][1]
634 = ctx->NearFarStack[ctx->ProjectionStackDepth-1][1];
635 break;
636 case GL_TEXTURE:
637 if (ctx->TextureStackDepth>=MAX_TEXTURE_STACK_DEPTH) {
638 gl_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix");
639 return;
640 }
641 MEMCPY( ctx->TextureStack[ctx->TextureStackDepth],
642 ctx->TextureMatrix,
643 16*sizeof(GLfloat) );
644 ctx->TextureStackDepth++;
645 break;
646 default:
647 gl_problem(ctx, "Bad matrix mode in gl_PushMatrix");
648 }
649}
#define MAX_MODELVIEW_STACK_DEPTH
Definition: config.h:66
#define MAX_TEXTURE_STACK_DEPTH
Definition: config.h:72
#define MAX_PROJECTION_STACK_DEPTH
Definition: config.h:69
#define GL_STACK_OVERFLOW
Definition: gl.h:697

Referenced by execute_list(), and init_exec_pointers().

◆ gl_Rotatef()

void gl_Rotatef ( GLcontext ctx,
GLfloat  angle,
GLfloat  x,
GLfloat  y,
GLfloat  z 
)

Definition at line 927 of file matrix.c.

929{
930 GLfloat m[16];
931 gl_rotation_matrix( angle, x, y, z, m );
932 gl_MultMatrixf( ctx, m );
933}
void gl_rotation_matrix(GLfloat angle, GLfloat x, GLfloat y, GLfloat z, GLfloat m[])
Definition: matrix.c:814
GLfloat angle
Definition: glext.h:10853

Referenced by init_exec_pointers().

◆ gl_rotation_matrix()

void gl_rotation_matrix ( GLfloat  angle,
GLfloat  x,
GLfloat  y,
GLfloat  z,
GLfloat  m[] 
)

Definition at line 814 of file matrix.c.

816{
817 /* This function contributed by Erich Boleyn (erich@uruk.org) */
818 GLfloat mag, s, c;
819 GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c;
820
821 s = sin( angle * DEG2RAD );
822 c = cos( angle * DEG2RAD );
823
824 mag = GL_SQRT( x*x + y*y + z*z );
825
826 if (mag == 0.0) {
827 /* generate an identity matrix and return */
828 MEMCPY(m, Identity, sizeof(GLfloat)*16);
829 return;
830 }
831
832 x /= mag;
833 y /= mag;
834 z /= mag;
835
836#define M(row,col) m[col*4+row]
837
838 /*
839 * Arbitrary axis rotation matrix.
840 *
841 * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied
842 * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation
843 * (which is about the X-axis), and the two composite transforms
844 * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary
845 * from the arbitrary axis to the X-axis then back. They are
846 * all elementary rotations.
847 *
848 * Rz' is a rotation about the Z-axis, to bring the axis vector
849 * into the x-z plane. Then Ry' is applied, rotating about the
850 * Y-axis to bring the axis vector parallel with the X-axis. The
851 * rotation about the X-axis is then performed. Ry and Rz are
852 * simply the respective inverse transforms to bring the arbitrary
853 * axis back to it's original orientation. The first transforms
854 * Rz' and Ry' are considered inverses, since the data from the
855 * arbitrary axis gives you info on how to get to it, not how
856 * to get away from it, and an inverse must be applied.
857 *
858 * The basic calculation used is to recognize that the arbitrary
859 * axis vector (x, y, z), since it is of unit length, actually
860 * represents the sines and cosines of the angles to rotate the
861 * X-axis to the same orientation, with theta being the angle about
862 * Z and phi the angle about Y (in the order described above)
863 * as follows:
864 *
865 * cos ( theta ) = x / sqrt ( 1 - z^2 )
866 * sin ( theta ) = y / sqrt ( 1 - z^2 )
867 *
868 * cos ( phi ) = sqrt ( 1 - z^2 )
869 * sin ( phi ) = z
870 *
871 * Note that cos ( phi ) can further be inserted to the above
872 * formulas:
873 *
874 * cos ( theta ) = x / cos ( phi )
875 * sin ( theta ) = y / sin ( phi )
876 *
877 * ...etc. Because of those relations and the standard trigonometric
878 * relations, it is pssible to reduce the transforms down to what
879 * is used below. It may be that any primary axis chosen will give the
880 * same results (modulo a sign convention) using thie method.
881 *
882 * Particularly nice is to notice that all divisions that might
883 * have caused trouble when parallel to certain planes or
884 * axis go away with care paid to reducing the expressions.
885 * After checking, it does perform correctly under all cases, since
886 * in all the cases of division where the denominator would have
887 * been zero, the numerator would have been zero as well, giving
888 * the expected result.
889 */
890
891 xx = x * x;
892 yy = y * y;
893 zz = z * z;
894 xy = x * y;
895 yz = y * z;
896 zx = z * x;
897 xs = x * s;
898 ys = y * s;
899 zs = z * s;
900 one_c = 1.0F - c;
901
902 M(0,0) = (one_c * xx) + c;
903 M(0,1) = (one_c * xy) - zs;
904 M(0,2) = (one_c * zx) + ys;
905 M(0,3) = 0.0F;
906
907 M(1,0) = (one_c * xy) + zs;
908 M(1,1) = (one_c * yy) + c;
909 M(1,2) = (one_c * yz) - xs;
910 M(1,3) = 0.0F;
911
912 M(2,0) = (one_c * zx) - ys;
913 M(2,1) = (one_c * yz) + xs;
914 M(2,2) = (one_c * zz) + c;
915 M(2,3) = 0.0F;
916
917 M(3,0) = 0.0F;
918 M(3,1) = 0.0F;
919 M(3,2) = 0.0F;
920 M(3,3) = 1.0F;
921
922#undef M
923}
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
#define DEG2RAD(degree)
Definition: precomp.h:76
GLdouble s
Definition: gl.h:2039
#define GL_SQRT(X)
Definition: mmath.h:63
int xx
Definition: npserver.c:29

Referenced by gl_Rotatef(), and gl_save_Rotatef().

◆ gl_Scalef()

void gl_Scalef ( GLcontext ctx,
GLfloat  x,
GLfloat  y,
GLfloat  z 
)

Definition at line 940 of file matrix.c.

941{
942 GLfloat *m;
943
944 if (INSIDE_BEGIN_END(ctx)) {
945 gl_error( ctx, GL_INVALID_OPERATION, "glScale" );
946 return;
947 }
948 switch (ctx->Transform.MatrixMode) {
949 case GL_MODELVIEW:
950 m = ctx->ModelViewMatrix;
951 ctx->NewModelViewMatrix = GL_TRUE;
952 break;
953 case GL_PROJECTION:
954 m = ctx->ProjectionMatrix;
955 ctx->NewProjectionMatrix = GL_TRUE;
956 break;
957 case GL_TEXTURE:
958 m = ctx->TextureMatrix;
959 ctx->NewTextureMatrix = GL_TRUE;
960 break;
961 default:
962 gl_problem(ctx, "Bad matrix mode in gl_Scalef");
963 return;
964 }
965 m[0] *= x; m[4] *= y; m[8] *= z;
966 m[1] *= x; m[5] *= y; m[9] *= z;
967 m[2] *= x; m[6] *= y; m[10] *= z;
968 m[3] *= x; m[7] *= y; m[11] *= z;
969}

Referenced by execute_list(), and init_exec_pointers().

◆ gl_Translatef()

void gl_Translatef ( GLcontext ctx,
GLfloat  x,
GLfloat  y,
GLfloat  z 
)

Definition at line 976 of file matrix.c.

977{
978 GLfloat *m;
979 if (INSIDE_BEGIN_END(ctx)) {
980 gl_error( ctx, GL_INVALID_OPERATION, "glTranslate" );
981 return;
982 }
983 switch (ctx->Transform.MatrixMode) {
984 case GL_MODELVIEW:
985 m = ctx->ModelViewMatrix;
986 ctx->NewModelViewMatrix = GL_TRUE;
987 break;
988 case GL_PROJECTION:
989 m = ctx->ProjectionMatrix;
990 ctx->NewProjectionMatrix = GL_TRUE;
991 break;
992 case GL_TEXTURE:
993 m = ctx->TextureMatrix;
994 ctx->NewTextureMatrix = GL_TRUE;
995 break;
996 default:
997 gl_problem(ctx, "Bad matrix mode in gl_Translatef");
998 return;
999 }
1000
1001 m[12] = m[0] * x + m[4] * y + m[8] * z + m[12];
1002 m[13] = m[1] * x + m[5] * y + m[9] * z + m[13];
1003 m[14] = m[2] * x + m[6] * y + m[10] * z + m[14];
1004 m[15] = m[3] * x + m[7] * y + m[11] * z + m[15];
1005}

Referenced by execute_list(), and init_exec_pointers().

◆ gl_Viewport()

void gl_Viewport ( GLcontext ctx,
GLint  x,
GLint  y,
GLsizei  width,
GLsizei  height 
)

Definition at line 1014 of file matrix.c.

1016{
1017 if (width<0 || height<0) {
1018 gl_error( ctx, GL_INVALID_VALUE, "glViewport" );
1019 return;
1020 }
1021 if (INSIDE_BEGIN_END(ctx)) {
1022 gl_error( ctx, GL_INVALID_OPERATION, "glViewport" );
1023 return;
1024 }
1025
1026 /* clamp width, and height to implementation dependent range */
1027 width = CLAMP( width, 1, MAX_WIDTH );
1028 height = CLAMP( height, 1, MAX_HEIGHT );
1029
1030 /* Save viewport */
1031 ctx->Viewport.X = x;
1032 ctx->Viewport.Width = width;
1033 ctx->Viewport.Y = y;
1034 ctx->Viewport.Height = height;
1035
1036 /* compute scale and bias values */
1037 ctx->Viewport.Sx = (GLfloat) width / 2.0F;
1038 ctx->Viewport.Tx = ctx->Viewport.Sx + x;
1039 ctx->Viewport.Sy = (GLfloat) height / 2.0F;
1040 ctx->Viewport.Ty = ctx->Viewport.Sy + y;
1041
1042 ctx->NewState |= NEW_ALL; /* just to be safe */
1043
1044 /* Check if window/buffer has been resized and if so, reallocate the
1045 * ancillary buffers.
1046 */
1048}
#define MAX_WIDTH
Definition: config.h:130
#define MAX_HEIGHT
Definition: config.h:131
void gl_ResizeBuffersMESA(GLcontext *ctx)
Definition: context.c:1497
#define NEW_ALL
Definition: types.h:1236
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
#define CLAMP(f, min, max)
Definition: tif_color.c:177

Referenced by execute_list(), init_exec_pointers(), and sw_SetContext().

◆ invert_matrix()

static void invert_matrix ( const GLfloat m,
GLfloat out 
)
static

Definition at line 290 of file matrix.c.

291{
292/* NB. OpenGL Matrices are COLUMN major. */
293#define MAT(m,r,c) (m)[(c)*4+(r)]
294
295/* Here's some shorthand converting standard (row,column) to index. */
296#define m11 MAT(m,0,0)
297#define m12 MAT(m,0,1)
298#define m13 MAT(m,0,2)
299#define m14 MAT(m,0,3)
300#define m21 MAT(m,1,0)
301#define m22 MAT(m,1,1)
302#define m23 MAT(m,1,2)
303#define m24 MAT(m,1,3)
304#define m31 MAT(m,2,0)
305#define m32 MAT(m,2,1)
306#define m33 MAT(m,2,2)
307#define m34 MAT(m,2,3)
308#define m41 MAT(m,3,0)
309#define m42 MAT(m,3,1)
310#define m43 MAT(m,3,2)
311#define m44 MAT(m,3,3)
312
313 register GLfloat det;
314 GLfloat tmp[16]; /* Allow out == in. */
315
316 if( m41 != 0. || m42 != 0. || m43 != 0. || m44 != 1. ) {
318 return;
319 }
320
321 /* Inverse = adjoint / det. (See linear algebra texts.)*/
322
323 tmp[0]= m22 * m33 - m23 * m32;
324 tmp[1]= m23 * m31 - m21 * m33;
325 tmp[2]= m21 * m32 - m22 * m31;
326
327 /* Compute determinant as early as possible using these cofactors. */
328 det= m11 * tmp[0] + m12 * tmp[1] + m13 * tmp[2];
329
330 /* Run singularity test. */
331 if (det == 0.0F) {
332 /* printf("invert_matrix: Warning: Singular matrix.\n"); */
333 MEMCPY( out, Identity, 16*sizeof(GLfloat) );
334 }
335 else {
336 GLfloat d12, d13, d23, d24, d34, d41;
337 register GLfloat im11, im12, im13, im14;
338
339 det= 1. / det;
340
341 /* Compute rest of inverse. */
342 tmp[0] *= det;
343 tmp[1] *= det;
344 tmp[2] *= det;
345 tmp[3] = 0.;
346
347 im11= m11 * det;
348 im12= m12 * det;
349 im13= m13 * det;
350 im14= m14 * det;
351 tmp[4] = im13 * m32 - im12 * m33;
352 tmp[5] = im11 * m33 - im13 * m31;
353 tmp[6] = im12 * m31 - im11 * m32;
354 tmp[7] = 0.;
355
356 /* Pre-compute 2x2 dets for first two rows when computing */
357 /* cofactors of last two rows. */
358 d12 = im11*m22 - m21*im12;
359 d13 = im11*m23 - m21*im13;
360 d23 = im12*m23 - m22*im13;
361 d24 = im12*m24 - m22*im14;
362 d34 = im13*m24 - m23*im14;
363 d41 = im14*m21 - m24*im11;
364
365 tmp[8] = d23;
366 tmp[9] = -d13;
367 tmp[10] = d12;
368 tmp[11] = 0.;
369
370 tmp[12] = -(m32 * d34 - m33 * d24 + m34 * d23);
371 tmp[13] = (m31 * d34 + m33 * d41 + m34 * d13);
372 tmp[14] = -(m31 * d24 + m32 * d41 + m34 * d12);
373 tmp[15] = 1.;
374
375 MEMCPY(out, tmp, 16*sizeof(GLfloat));
376 }
377
378#undef m11
379#undef m12
380#undef m13
381#undef m14
382#undef m21
383#undef m22
384#undef m23
385#undef m24
386#undef m31
387#undef m32
388#undef m33
389#undef m34
390#undef m41
391#undef m42
392#undef m43
393#undef m44
394#undef MAT
395}
static void invert_matrix_general(const GLfloat *m, GLfloat *out)
Definition: matrix.c:199
#define m32
#define m34
#define m33
#define m14
#define m31
#define m22
#define m11
#define m43
#define m42
#define m13
#define m24
#define m23
#define m12
#define m21
#define m41
#define m44
static FILE * out
Definition: regtests2xml.c:44

Referenced by gl_analyze_modelview_matrix().

◆ invert_matrix_general()

static void invert_matrix_general ( const GLfloat m,
GLfloat out 
)
static

Definition at line 199 of file matrix.c.

200{
201 Mat2 r1, r2, r3, r4, r5, r6, r7;
202 const GLfloat * A = m;
203 GLfloat * C = out;
204 GLfloat one_over_det;
205
206 /*
207 * A is the 4x4 source matrix (to be inverted).
208 * C is the 4x4 destination matrix
209 * a11 is the 2x2 matrix in the upper left quadrant of A
210 * a12 is the 2x2 matrix in the upper right quadrant of A
211 * a21 is the 2x2 matrix in the lower left quadrant of A
212 * a22 is the 2x2 matrix in the lower right quadrant of A
213 * similarly, cXX are the 2x2 quadrants of the destination matrix
214 */
215
216 /* R1 = inverse( a11 ) */
217 one_over_det = 1.0f / ( ( A[M00] * A[M11] ) - ( A[M10] * A[M01] ) );
218 r1[0][0] = one_over_det * A[M11];
219 r1[0][1] = one_over_det * -A[M01];
220 r1[1][0] = one_over_det * -A[M10];
221 r1[1][1] = one_over_det * A[M00];
222
223 /* R2 = a21 x R1 */
224 r2[0][0] = A[M20] * r1[0][0] + A[M21] * r1[1][0];
225 r2[0][1] = A[M20] * r1[0][1] + A[M21] * r1[1][1];
226 r2[1][0] = A[M30] * r1[0][0] + A[M31] * r1[1][0];
227 r2[1][1] = A[M30] * r1[0][1] + A[M31] * r1[1][1];
228
229 /* R3 = R1 x a12 */
230 r3[0][0] = r1[0][0] * A[M02] + r1[0][1] * A[M12];
231 r3[0][1] = r1[0][0] * A[M03] + r1[0][1] * A[M13];
232 r3[1][0] = r1[1][0] * A[M02] + r1[1][1] * A[M12];
233 r3[1][1] = r1[1][0] * A[M03] + r1[1][1] * A[M13];
234
235 /* R4 = a21 x R3 */
236 r4[0][0] = A[M20] * r3[0][0] + A[M21] * r3[1][0];
237 r4[0][1] = A[M20] * r3[0][1] + A[M21] * r3[1][1];
238 r4[1][0] = A[M30] * r3[0][0] + A[M31] * r3[1][0];
239 r4[1][1] = A[M30] * r3[0][1] + A[M31] * r3[1][1];
240
241 /* R5 = R4 - a22 */
242 r5[0][0] = r4[0][0] - A[M22];
243 r5[0][1] = r4[0][1] - A[M23];
244 r5[1][0] = r4[1][0] - A[M32];
245 r5[1][1] = r4[1][1] - A[M33];
246
247 /* R6 = inverse( R5 ) */
248 one_over_det = 1.0f / ( ( r5[0][0] * r5[1][1] ) - ( r5[1][0] * r5[0][1] ) );
249 r6[0][0] = one_over_det * r5[1][1];
250 r6[0][1] = one_over_det * -r5[0][1];
251 r6[1][0] = one_over_det * -r5[1][0];
252 r6[1][1] = one_over_det * r5[0][0];
253
254 /* c12 = R3 x R6 */
255 C[M02] = r3[0][0] * r6[0][0] + r3[0][1] * r6[1][0];
256 C[M03] = r3[0][0] * r6[0][1] + r3[0][1] * r6[1][1];
257 C[M12] = r3[1][0] * r6[0][0] + r3[1][1] * r6[1][0];
258 C[M13] = r3[1][0] * r6[0][1] + r3[1][1] * r6[1][1];
259
260 /* c21 = R6 x R2 */
261 C[M20] = r6[0][0] * r2[0][0] + r6[0][1] * r2[1][0];
262 C[M21] = r6[0][0] * r2[0][1] + r6[0][1] * r2[1][1];
263 C[M30] = r6[1][0] * r2[0][0] + r6[1][1] * r2[1][0];
264 C[M31] = r6[1][0] * r2[0][1] + r6[1][1] * r2[1][1];
265
266 /* R7 = R3 x c21 */
267 r7[0][0] = r3[0][0] * C[M20] + r3[0][1] * C[M30];
268 r7[0][1] = r3[0][0] * C[M21] + r3[0][1] * C[M31];
269 r7[1][0] = r3[1][0] * C[M20] + r3[1][1] * C[M30];
270 r7[1][1] = r3[1][0] * C[M21] + r3[1][1] * C[M31];
271
272 /* c11 = R1 - R7 */
273 C[M00] = r1[0][0] - r7[0][0];
274 C[M01] = r1[0][1] - r7[0][1];
275 C[M10] = r1[1][0] - r7[1][0];
276 C[M11] = r1[1][1] - r7[1][1];
277
278 /* c22 = -R6 */
279 C[M22] = -r6[0][0];
280 C[M23] = -r6[0][1];
281 C[M32] = -r6[1][0];
282 C[M33] = -r6[1][1];
283}
Definition: ehthrow.cxx:93
Definition: terminate.cpp:24
GLfloat Mat2[2][2]
Definition: matrix.c:190
static DNS_RECORDW r3
Definition: record.c:39
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38

Referenced by invert_matrix().

◆ is_identity()

static GLboolean is_identity ( const GLfloat  m[16])
static

Definition at line 402 of file matrix.c.

403{
404 if ( m[0]==1.0F && m[4]==0.0F && m[ 8]==0.0F && m[12]==0.0F
405 && m[1]==0.0F && m[5]==1.0F && m[ 9]==0.0F && m[13]==0.0F
406 && m[2]==0.0F && m[6]==0.0F && m[10]==1.0F && m[14]==0.0F
407 && m[3]==0.0F && m[7]==0.0F && m[11]==0.0F && m[15]==1.0F) {
408 return GL_TRUE;
409 }
410 else {
411 return GL_FALSE;
412 }
413}

Referenced by brush_fill_pixels(), gl_analyze_modelview_matrix(), gl_analyze_projection_matrix(), and gl_analyze_texture_matrix().

◆ matmul()

static void matmul ( GLfloat product,
const GLfloat a,
const GLfloat b 
)
static

Definition at line 154 of file matrix.c.

155{
156 /* This matmul was contributed by Thomas Malik */
157 GLint i;
158
159#define A(row,col) a[(col<<2)+row]
160#define B(row,col) b[(col<<2)+row]
161#define P(row,col) product[(col<<2)+row]
162
163 /* i-te Zeile */
164 for (i = 0; i < 4; i++) {
165 GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3);
166 P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0);
167 P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1);
168 P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2);
169 P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3);
170 }
171
172#undef A
173#undef B
174#undef P
175}
#define P(row, col)
#define A(row, col)
#define B(row, col)
int GLint
Definition: gl.h:156
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by gl_MultMatrixf().

Variable Documentation

◆ Identity

GLfloat Identity[16]
static
Initial value:
= {
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
}

Definition at line 127 of file matrix.c.

Referenced by gl_LoadIdentity(), gl_rotation_matrix(), and invert_matrix().