-/* $Id: glapi.c,v 1.10 1999/11/27 21:30:40 brianp Exp $ */
+/* $Id: glapi.c,v 1.11 1999/12/10 20:01:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
{ "glResizeBuffersMESA", (GLvoid *) glResizeBuffersMESA },
#endif
+#ifdef _GLAPI_ARB_transpose_matrix
+ { "glLoadTransposeMatrixdARB", (GLvoid *) glLoadTransposeMatrixdARB },
+ { "glLoadTransposeMatrixfARB", (GLvoid *) glLoadTransposeMatrixfARB },
+ { "glMultTransposeMatrixdARB", (GLvoid *) glMultTransposeMatrixdARB },
+ { "glMultTransposeMatrixfARB", (GLvoid *) glMultTransposeMatrixfARB },
+#endif
+
{ NULL, NULL } /* end of list marker */
};
#ifdef _GLAPI_MESA_resize_buffers
assert(table->ResizeBuffersMESA);
#endif
+
+#ifdef _GLAPI_ARB_transpose_matrix
+ assert(table->LoadTransposeMatrixdARB);
+ assert(table->LoadTransposeMatrixfARB);
+ assert(table->MultTransposeMatrixdARB);
+ assert(table->MultTransposeMatrixfARB);
+#endif
}
-/* $Id: glapitable.h,v 1.2 1999/11/27 21:30:10 brianp Exp $ */
+/* $Id: glapitable.h,v 1.3 1999/12/10 20:01:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define _GLAPI_INGR_blend_func_separate 1
#define _GLAPI_MESA_window_pos 1
#define _GLAPI_MESA_resize_buffers 1
+#define _GLAPI_ARB_transpose_matrix 1
void (*ResizeBuffersMESA)(void);
#endif
+#ifdef _GLAPI_ARB_transpose_matrix
+ void (*LoadTransposeMatrixdARB)(const GLdouble m[16]);
+ void (*LoadTransposeMatrixfARB)(const GLfloat m[16]);
+ void (*MultTransposeMatrixdARB)(const GLdouble m[16]);
+ void (*MultTransposeMatrixfARB)(const GLfloat m[16]);
+#endif
void *ExtensionFuncs[_GLAPI_EXTRA_SLOTS];
};
-/* $Id: glapitemp.h,v 1.1 1999/11/25 18:16:13 brianp Exp $ */
+/* $Id: glapitemp.h,v 1.2 1999/12/10 20:01:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
#endif /* GL_MESA_resize_buffers */
+#ifdef _GLAPI_ARB_transpose_matrix
+KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble m[16])
+{
+ DISPATCH_SETUP;
+ DISPATCH(LoadTransposeMatrixdARB, (m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixfARB)(const GLfloat m[16])
+{
+ DISPATCH_SETUP;
+ DISPATCH(LoadTransposeMatrixfARB, (m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixdARB)(const GLdouble m[16])
+{
+ DISPATCH_SETUP;
+ DISPATCH(MultTransposeMatrixdARB, (m));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat m[16])
+{
+ DISPATCH_SETUP;
+ DISPATCH(MultTransposeMatrixfARB, (m));
+}
+
+#endif
+
+
#undef KEYWORD1
#undef KEYWORD2
-/* $Id: dispatch.c,v 1.5 1999/11/27 21:42:12 brianp Exp $ */
+/* $Id: dispatch.c,v 1.6 1999/12/10 20:01:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
#ifdef _GLAPI_MESA_resize_buffers
exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA;
#endif
+
+#ifdef _GLAPI_ARB_transpose_matrix
+ exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB;
+ exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB;
+ exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB;
+ exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB;
+#endif
+
}
-/* $Id: dlist.c,v 1.20 1999/11/27 21:40:42 brianp Exp $ */
+/* $Id: dlist.c,v 1.21 1999/12/10 20:01:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
+static void save_LoadTransposeMatrixdARB( const GLdouble m[16] )
+{
+ GLdouble tm[16];
+ gl_matrix_transposed(tm, m);
+ save_LoadMatrixd(tm);
+}
+
+
+static void save_LoadTransposeMatrixfARB( const GLfloat m[16] )
+{
+ GLfloat tm[16];
+ gl_matrix_transposef(tm, m);
+ save_LoadMatrixf(tm);
+}
+
+
+static void save_MultTransposeMatrixdARB( const GLdouble m[16] )
+{
+ GLdouble tm[16];
+ gl_matrix_transposed(tm, m);
+ save_MultMatrixd(tm);
+}
+
+
+static void save_MultTransposeMatrixfARB( const GLfloat m[16] )
+{
+ GLfloat tm[16];
+ gl_matrix_transposef(tm, m);
+ save_MultMatrixf(tm);
+}
+
+
+
void gl_compile_cassette( GLcontext *ctx )
{
Node *n = alloc_instruction( ctx, OPCODE_VERTEX_CASSETTE, 8 );
#ifdef _GLAPI_MESA_resize_buffers
table->ResizeBuffersMESA = _mesa_ResizeBuffersMESA;
#endif
+
+#ifdef _GLAPI_ARB_transpose_matrix
+ table->LoadTransposeMatrixdARB = save_LoadTransposeMatrixdARB;
+ table->LoadTransposeMatrixfARB = save_LoadTransposeMatrixfARB;
+ table->MultTransposeMatrixdARB = save_MultTransposeMatrixdARB;
+ table->MultTransposeMatrixfARB = save_MultTransposeMatrixfARB;
+#endif
+
}
-/* $Id: extensions.c,v 1.15 1999/12/10 15:13:57 brianp Exp $ */
+/* $Id: extensions.c,v 1.16 1999/12/10 20:01:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
{ DEFAULT_OFF, "GL_EXT_vertex_array_set" },
{ DEFAULT_ON, "GL_EXT_clip_volume_hint" },
{ DEFAULT_ON, "GL_EXT_texture_env_add" },
+ { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" },
};
-/* $Id: get.c,v 1.6 1999/11/11 01:22:26 brianp Exp $ */
+/* $Id: get.c,v 1.7 1999/12/10 20:01:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "extensions.h"
#include "get.h"
#include "macros.h"
+#include "matrix.h"
#include "mmath.h"
#include "types.h"
#include "vb.h"
case GL_NATIVE_GRAPHICS_HANDLE_PGI:
*params = 0;
break;
+
+ /* GL_ARB_transpose_matrix */
+ case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+ /* don't have a color matrix */
+ break;
+ case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->ModelView.m);
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(tm[i]);
+ }
+ }
+ break;
+ case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->ProjectionMatrix.m);
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(tm[i]);
+ }
+ }
+ break;
+ case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->TextureMatrix[texTransformUnit].m);
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(tm[i]);
+ }
+ }
+ break;
+
default:
printf("invalid enum: %x\n", pname);
gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
*params = 0;
break;
-
+ /* GL_ARB_transpose_matrix */
+ case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+ /* don't have a color matrix */
+ break;
+ case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->ModelView.m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) tm[i];
+ }
+ }
+ break;
+ case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->ProjectionMatrix.m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) tm[i];
+ }
+ }
+ break;
+ case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->TextureMatrix[texTransformUnit].m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) tm[i];
+ }
+ }
+ break;
default:
printf("invalid enum: %x\n", pname);
*params = 0;
break;
+ /* GL_ARB_transpose_matrix */
+ case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+ /* don't have a color matrix */
+ break;
+ case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+ gl_matrix_transposef(params, ctx->ModelView.m);
+ break;
+ case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+ gl_matrix_transposef(params, ctx->ProjectionMatrix.m);
+ break;
+ case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+ gl_matrix_transposef(params, ctx->TextureMatrix[texTransformUnit].m);
+ break;
+
default:
printf("invalid enum: %x\n", pname);
gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
*params = ctx->Array.LockCount;
break;
+ /* GL_ARB_transpose_matrix */
+ case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+ /* don't have a color matrix */
+ break;
+ case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->ModelView.m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) tm[i];
+ }
+ }
+ break;
+ case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->ProjectionMatrix.m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) tm[i];
+ }
+ }
+ break;
+ case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->TextureMatrix[texTransformUnit].m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) tm[i];
+ }
+ }
+ break;
+
default:
printf("invalid enum: %x\n", pname);
gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
-/* $Id: matrix.c,v 1.11 1999/11/24 18:48:31 brianp Exp $ */
+/* $Id: matrix.c,v 1.12 1999/12/10 20:01:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
+void gl_matrix_transposef( GLfloat to[16], const GLfloat from[16] )
+{
+ to[0] = from[0];
+ to[1] = from[4];
+ to[2] = from[8];
+ to[3] = from[12];
+ to[4] = from[1];
+ to[5] = from[5];
+ to[6] = from[9];
+ to[7] = from[13];
+ to[8] = from[2];
+ to[9] = from[6];
+ to[10] = from[10];
+ to[11] = from[14];
+ to[12] = from[3];
+ to[13] = from[7];
+ to[14] = from[11];
+ to[15] = from[15];
+}
+
+
+
+void gl_matrix_transposed( GLdouble to[16], const GLdouble from[16] )
+{
+ to[0] = from[0];
+ to[1] = from[4];
+ to[2] = from[8];
+ to[3] = from[12];
+ to[4] = from[1];
+ to[5] = from[5];
+ to[6] = from[9];
+ to[7] = from[13];
+ to[8] = from[2];
+ to[9] = from[6];
+ to[10] = from[10];
+ to[11] = from[14];
+ to[12] = from[3];
+ to[13] = from[7];
+ to[14] = from[11];
+ to[15] = from[15];
+}
+
+
+
/*
* Generate a 4x4 transformation matrix from glRotate parameters.
*/
+void
+_mesa_LoadTransposeMatrixfARB( const GLfloat *m )
+{
+ GLfloat tm[16];
+ gl_matrix_transposef(tm, m);
+ _mesa_LoadMatrixf(tm);
+}
+
+
+void
+_mesa_LoadTransposeMatrixdARB( const GLdouble *m )
+{
+ GLdouble tm[16];
+ gl_matrix_transposed(tm, m);
+ _mesa_LoadMatrixd(tm);
+}
+
+
+void
+_mesa_MultTransposeMatrixfARB( const GLfloat *m )
+{
+ GLfloat tm[16];
+ gl_matrix_transposef(tm, m);
+ _mesa_MultMatrixf(tm);
+}
+
+
+void
+_mesa_MultTransposeMatrixdARB( const GLdouble *m )
+{
+ GLdouble tm[16];
+ gl_matrix_transposed(tm, m);
+ _mesa_MultMatrixd(tm);
+}
+
+
/*
* Called via glViewport or display list execution.
*/
-/* $Id: matrix.h,v 1.4 1999/11/12 18:10:47 brianp Exp $ */
+/* $Id: matrix.h,v 1.5 1999/12/10 20:01:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
#endif
+extern void gl_matrix_transposef( GLfloat to[16], const GLfloat from[16] );
+
+extern void gl_matrix_transposed( GLdouble to[16], const GLdouble from[16] );
+
+
extern void gl_rotation_matrix( GLfloat angle, GLfloat x, GLfloat y, GLfloat z,
GLfloat m[] );
extern void gl_calculate_model_project_matrix( GLcontext *ctx );
+extern void gl_matrix_copy( GLmatrix *to, const GLmatrix *from );
+
extern void gl_matrix_ctr( GLmatrix *m );
extern void gl_matrix_dtr( GLmatrix *m );
extern void gl_matrix_alloc_inv( GLmatrix *m );
-extern void gl_matrix_copy( GLmatrix *to, const GLmatrix *from );
-
extern void gl_matrix_mul( GLmatrix *dest,
const GLmatrix *a,
const GLmatrix *b );
extern void
_mesa_Translated( GLdouble x, GLdouble y, GLdouble z );
+extern void
+_mesa_LoadTransposeMatrixfARB( const GLfloat *m );
+
+extern void
+_mesa_LoadTransposeMatrixdARB( const GLdouble *m );
+
+extern void
+_mesa_MultTransposeMatrixfARB( const GLfloat *m );
+
+extern void
+_mesa_MultTransposeMatrixdARB( const GLdouble *m );
+
extern void
_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height );