diff options
author | Brian Paul <[email protected]> | 2001-11-18 23:52:37 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-11-18 23:52:37 +0000 |
commit | 5b7dab2e4c7df1fde0a7fcf28b8b54745b9fcd2e (patch) | |
tree | 05ce265fc4b97cfb18e32b20eefd6c05cfbad42a /src/mesa/main | |
parent | 17fe22d3bfcce0471ab9ae638cc6b0c91f7d8e65 (diff) |
added test implementation of GL_ARB_window_pos
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/dlist.c | 126 | ||||
-rw-r--r-- | src/mesa/main/glprocs.h | 16 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 5 | ||||
-rw-r--r-- | src/mesa/main/rastpos.c | 138 | ||||
-rw-r--r-- | src/mesa/main/rastpos.h | 39 | ||||
-rw-r--r-- | src/mesa/main/state.c | 21 |
6 files changed, 337 insertions, 8 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 0f4d7d875cd..ea6d6d76639 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,8 +1,8 @@ -/* $Id: dlist.c,v 1.77 2001/11/18 22:48:11 brianp Exp $ */ +/* $Id: dlist.c,v 1.78 2001/11/18 23:52:37 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -242,6 +242,8 @@ typedef enum { OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, /* GL_ARB_multisample */ OPCODE_SAMPLE_COVERAGE, + /* GL_ARB_window_pos */ + OPCODE_WINDOW_POS_ARB, /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_CONTINUE, @@ -627,6 +629,8 @@ void _mesa_init_lists( void ) InstSize[OPCODE_SAMPLE_COVERAGE] = 3; /* GL_ARB_multitexture */ InstSize[OPCODE_ACTIVE_TEXTURE] = 2; + /* GL_ARB_window_pos */ + InstSize[OPCODE_WINDOW_POS_ARB] = 4; } init_flag = 1; } @@ -3546,6 +3550,103 @@ static void save_WindowPos4svMESA(const GLshort *v) +/* + * GL_ARB_window_pos + */ + +static void save_WindowPos3fARB( GLfloat x, GLfloat y, GLfloat z ) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + n = ALLOC_INSTRUCTION( ctx, OPCODE_WINDOW_POS_ARB, 3 ); + if (n) { + n[1].f = x; + n[2].f = y; + n[3].f = z; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->WindowPos3fMESA)( x, y, z ); + } +} + +static void save_WindowPos2dARB(GLdouble x, GLdouble y) +{ + save_WindowPos3fARB((GLfloat) x, (GLfloat) y, 0.0F); +} + +static void save_WindowPos2fARB(GLfloat x, GLfloat y) +{ + save_WindowPos3fARB(x, y, 0.0F); +} + +static void save_WindowPos2iARB(GLint x, GLint y) +{ + save_WindowPos3fARB((GLfloat) x, (GLfloat) y, 0.0F); +} + +static void save_WindowPos2sARB(GLshort x, GLshort y) +{ + save_WindowPos3fARB(x, y, 0.0F); +} + +static void save_WindowPos3dARB(GLdouble x, GLdouble y, GLdouble z) +{ + save_WindowPos3fARB((GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +static void save_WindowPos3iARB(GLint x, GLint y, GLint z) +{ + save_WindowPos3fARB((GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +static void save_WindowPos3sARB(GLshort x, GLshort y, GLshort z) +{ + save_WindowPos3fARB(x, y, z); +} + +static void save_WindowPos2dvARB(const GLdouble *v) +{ + save_WindowPos3fARB((GLfloat) v[0], (GLfloat) v[1], 0.0F); +} + +static void save_WindowPos2fvARB(const GLfloat *v) +{ + save_WindowPos3fARB(v[0], v[1], 0.0F); +} + +static void save_WindowPos2ivARB(const GLint *v) +{ + save_WindowPos3fARB((GLfloat) v[0], (GLfloat) v[1], 0.0F); +} + +static void save_WindowPos2svARB(const GLshort *v) +{ + save_WindowPos3fARB(v[0], v[1], 0.0F); +} + +static void save_WindowPos3dvARB(const GLdouble *v) +{ + save_WindowPos3fARB((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void save_WindowPos3fvARB(const GLfloat *v) +{ + save_WindowPos3fARB(v[0], v[1], v[2]); +} + +static void save_WindowPos3ivARB(const GLint *v) +{ + save_WindowPos3fARB((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void save_WindowPos3svARB(const GLshort *v) +{ + save_WindowPos3fARB(v[0], v[1], v[2]); +} + + /* GL_ARB_multitexture */ static void save_ActiveTextureARB( GLenum target ) { @@ -4611,6 +4712,9 @@ execute_list( GLcontext *ctx, GLuint list ) case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */ (*ctx->Exec->SampleCoverage)(n[1].f, n[2].b); break; + case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */ + (*ctx->Exec->WindowPos3fARB)( n[1].f, n[2].f, n[3].f ); + break; case OPCODE_CONTINUE: n = (Node *) n[1].next; break; @@ -5898,6 +6002,24 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) /* GL_EXT_fog_coord */ table->FogCoordPointerEXT = exec_FogCoordPointerEXT; + + /* GL_ARB_window_pos */ + table->WindowPos2dARB = save_WindowPos2dARB; + table->WindowPos2dvARB = save_WindowPos2dvARB; + table->WindowPos2fARB = save_WindowPos2fARB; + table->WindowPos2fvARB = save_WindowPos2fvARB; + table->WindowPos2iARB = save_WindowPos2iARB; + table->WindowPos2ivARB = save_WindowPos2ivARB; + table->WindowPos2sARB = save_WindowPos2sARB; + table->WindowPos2svARB = save_WindowPos2svARB; + table->WindowPos3dARB = save_WindowPos3dARB; + table->WindowPos3dvARB = save_WindowPos3dvARB; + table->WindowPos3fARB = save_WindowPos3fARB; + table->WindowPos3fvARB = save_WindowPos3fvARB; + table->WindowPos3iARB = save_WindowPos3iARB; + table->WindowPos3ivARB = save_WindowPos3ivARB; + table->WindowPos3sARB = save_WindowPos3sARB; + table->WindowPos3svARB = save_WindowPos3svARB; } diff --git a/src/mesa/main/glprocs.h b/src/mesa/main/glprocs.h index ca60e2cb655..f79083c9ba0 100644 --- a/src/mesa/main/glprocs.h +++ b/src/mesa/main/glprocs.h @@ -673,5 +673,21 @@ static struct name_address_offset static_functions[] = { { "glTbufferMask3DFX", (GLvoid *) glTbufferMask3DFX, _gloffset_TbufferMask3DFX }, { "glSampleMaskEXT", (GLvoid *) glSampleMaskEXT, _gloffset_SampleMaskSGIS }, { "glSamplePatternEXT", (GLvoid *) glSamplePatternEXT, _gloffset_SamplePatternSGIS }, + { "glWindowPos2dARB", (GLvoid *) glWindowPos2dARB, _gloffset_WindowPos2dARB }, + { "glWindowPos2fARB", (GLvoid *) glWindowPos2fARB, _gloffset_WindowPos2fARB }, + { "glWindowPos2iARB", (GLvoid *) glWindowPos2iARB, _gloffset_WindowPos2iARB }, + { "glWindowPos2sARB", (GLvoid *) glWindowPos2sARB, _gloffset_WindowPos2sARB }, + { "glWindowPos2dvARB", (GLvoid *) glWindowPos2dvARB, _gloffset_WindowPos2dvARB }, + { "glWindowPos2fvARB", (GLvoid *) glWindowPos2fvARB, _gloffset_WindowPos2fvARB }, + { "glWindowPos2ivARB", (GLvoid *) glWindowPos2ivARB, _gloffset_WindowPos2ivARB }, + { "glWindowPos2svARB", (GLvoid *) glWindowPos2svARB, _gloffset_WindowPos2svARB }, + { "glWindowPos3dARB", (GLvoid *) glWindowPos3dARB, _gloffset_WindowPos3dARB }, + { "glWindowPos3fARB", (GLvoid *) glWindowPos3fARB, _gloffset_WindowPos3fARB }, + { "glWindowPos3iARB", (GLvoid *) glWindowPos3iARB, _gloffset_WindowPos3iARB }, + { "glWindowPos3sARB", (GLvoid *) glWindowPos3sARB, _gloffset_WindowPos3sARB }, + { "glWindowPos3dvARB", (GLvoid *) glWindowPos3dvARB, _gloffset_WindowPos3dvARB }, + { "glWindowPos3fvARB", (GLvoid *) glWindowPos3fvARB, _gloffset_WindowPos3fvARB }, + { "glWindowPos3ivARB", (GLvoid *) glWindowPos3ivARB, _gloffset_WindowPos3ivARB }, + { "glWindowPos3svARB", (GLvoid *) glWindowPos3svARB, _gloffset_WindowPos3svARB }, { NULL, NULL } /* end of list marker */ }; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b4853f64e66..f8d330b75ce 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,8 +1,8 @@ -/* $Id: mtypes.h,v 1.52 2001/11/06 15:53:00 brianp Exp $ */ +/* $Id: mtypes.h,v 1.53 2001/11/18 23:52:37 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -1204,6 +1204,7 @@ struct gl_extensions { GLboolean ARB_texture_env_combine; GLboolean ARB_texture_env_dot3; GLboolean ARB_texture_mirrored_repeat; + GLboolean ARB_window_pos; GLboolean EXT_blend_color; GLboolean EXT_blend_func_separate; GLboolean EXT_blend_logic_op; diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 716bef2302d..a7b4e16a41a 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -1,4 +1,4 @@ -/* $Id: rastpos.c,v 1.31 2001/09/18 23:06:14 kschultz Exp $ */ +/* $Id: rastpos.c,v 1.32 2001/11/18 23:52:38 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -764,3 +764,139 @@ void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) } #endif + + +/**********************************************************************/ +/*** GL_ARB_window_pos ***/ +/**********************************************************************/ + +void _mesa_WindowPos2dARB(GLdouble x, GLdouble y) +{ + _mesa_WindowPos3fARB((GLfloat) x, (GLfloat) y, 0.0F); +} + +void _mesa_WindowPos2fARB(GLfloat x, GLfloat y) +{ + _mesa_WindowPos3fARB(x, y, 0.0F); +} + +void _mesa_WindowPos2iARB(GLint x, GLint y) +{ + _mesa_WindowPos3fARB((GLfloat) x, (GLfloat) y, 0.0F); +} + +void _mesa_WindowPos2sARB(GLshort x, GLshort y) +{ + _mesa_WindowPos3fARB((GLfloat) x, (GLfloat) y, 0.0F); +} + +void _mesa_WindowPos2dvARB(const GLdouble *p) +{ + _mesa_WindowPos3fARB((GLfloat) p[0], (GLfloat) p[1], 0.0F); +} + +void _mesa_WindowPos2fvARB(const GLfloat *p) +{ + _mesa_WindowPos3fARB((GLfloat) p[0], (GLfloat) p[1], 0.0F); +} + +void _mesa_WindowPos2ivARB(const GLint *p) +{ + _mesa_WindowPos3fARB((GLfloat) p[0], (GLfloat) p[1], 0.0F); +} + +void _mesa_WindowPos2svARB(const GLshort *p) +{ + _mesa_WindowPos3fARB((GLfloat) p[0], (GLfloat) p[1], 0.0F); +} + +void _mesa_WindowPos3dARB(GLdouble x, GLdouble y, GLdouble z) +{ + _mesa_WindowPos3fARB((GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +void _mesa_WindowPos3fARB(GLfloat x, GLfloat y, GLfloat z) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat z2; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + + z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near) + + ctx->Viewport.Near; + + /* set raster position */ + ctx->Current.RasterPos[0] = x; + ctx->Current.RasterPos[1] = y; + ctx->Current.RasterPos[2] = z2; + ctx->Current.RasterPos[3] = 0.0F; + + ctx->Current.RasterPosValid = GL_TRUE; + /* XXX might have to change this */ + ctx->Current.RasterDistance = ctx->Current.FogCoord; + ctx->Current.RasterFogCoord = ctx->Current.FogCoord; + + /* raster color = current color or index */ + if (ctx->Visual.rgbMode) { + ctx->Current.RasterColor[0] = CLAMP(ctx->Current.Color[0], 0.0F, 1.0F); + ctx->Current.RasterColor[1] = CLAMP(ctx->Current.Color[1], 0.0F, 1.0F); + ctx->Current.RasterColor[2] = CLAMP(ctx->Current.Color[2], 0.0F, 1.0F); + ctx->Current.RasterColor[3] = CLAMP(ctx->Current.Color[3], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[0] + = CLAMP(ctx->Current.SecondaryColor[0], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[1] + = CLAMP(ctx->Current.SecondaryColor[1], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[2] + = CLAMP(ctx->Current.SecondaryColor[2], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[3] + = CLAMP(ctx->Current.SecondaryColor[3], 0.0F, 1.0F); + } + else { + ctx->Current.RasterIndex = ctx->Current.Index; + } + + /* raster texcoord = current texcoord */ + { + GLuint texSet; + for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) { + COPY_4FV( ctx->Current.RasterMultiTexCoord[texSet], + ctx->Current.Texcoord[texSet] ); + } + } + + if (ctx->RenderMode==GL_SELECT) { + _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); + } +} + +void _mesa_WindowPos3iARB(GLint x, GLint y, GLint z) +{ + _mesa_WindowPos3fARB((GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +void _mesa_WindowPos3sARB(GLshort x, GLshort y, GLshort z) +{ + _mesa_WindowPos3fARB((GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +void _mesa_WindowPos3dvARB(const GLdouble *p) +{ + _mesa_WindowPos3fARB((GLfloat) p[0], (GLfloat) p[1], (GLfloat) p[2]); +} + +void _mesa_WindowPos3fvARB(const GLfloat *p) +{ + _mesa_WindowPos3fARB(p[0], p[1], p[2]); +} + +void _mesa_WindowPos3ivARB(const GLint *p) +{ + _mesa_WindowPos3fARB((GLfloat) p[0], (GLfloat) p[1], (GLfloat) p[2]); +} + +void _mesa_WindowPos3svARB(const GLshort *p) +{ + _mesa_WindowPos3fARB((GLfloat) p[0], (GLfloat) p[1], (GLfloat) p[2]); +} + diff --git a/src/mesa/main/rastpos.h b/src/mesa/main/rastpos.h index 234eb76ce1d..62779443c0d 100644 --- a/src/mesa/main/rastpos.h +++ b/src/mesa/main/rastpos.h @@ -1,4 +1,4 @@ -/* $Id: rastpos.h,v 1.4 2001/06/18 17:26:08 brianp Exp $ */ +/* $Id: rastpos.h,v 1.5 2001/11/18 23:52:38 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -182,4 +182,41 @@ extern void _mesa_WindowPos4svMESA(const GLshort *v); +/**********************************************************************/ +/*** GL_ARB_window_pos ***/ +/**********************************************************************/ + +extern void _mesa_WindowPos2dARB(GLdouble x, GLdouble y); + +extern void _mesa_WindowPos2fARB(GLfloat x, GLfloat y); + +extern void _mesa_WindowPos2iARB(GLint x, GLint y); + +extern void _mesa_WindowPos2sARB(GLshort x, GLshort y); + +extern void _mesa_WindowPos2dvARB(const GLdouble *p); + +extern void _mesa_WindowPos2fvARB(const GLfloat *p); + +extern void _mesa_WindowPos2ivARB(const GLint *p); + +extern void _mesa_WindowPos2svARB(const GLshort *p); + +extern void _mesa_WindowPos3dARB(GLdouble x, GLdouble y, GLdouble z); + +extern void _mesa_WindowPos3fARB(GLfloat x, GLfloat y, GLfloat z); + +extern void _mesa_WindowPos3iARB(GLint x, GLint y, GLint z); + +extern void _mesa_WindowPos3sARB(GLshort x, GLshort y, GLshort z); + +extern void _mesa_WindowPos3dvARB(const GLdouble *p); + +extern void _mesa_WindowPos3fvARB(const GLfloat *p); + +extern void _mesa_WindowPos3ivARB(const GLint *p); + +extern void _mesa_WindowPos3svARB(const GLshort *p); + + #endif diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 0c884e19599..66d862286eb 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,8 +1,8 @@ -/* $Id: state.c,v 1.70 2001/11/18 22:48:13 brianp Exp $ */ +/* $Id: state.c,v 1.71 2001/11/18 23:52:38 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -478,6 +478,23 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) exec->CompressedTexSubImage1D = _mesa_CompressedTexSubImage1DARB; exec->GetCompressedTexImage = _mesa_GetCompressedTexImageARB; + /* GL_ARB_window_pos */ + exec->WindowPos2dARB = _mesa_WindowPos2dARB; + exec->WindowPos2dvARB = _mesa_WindowPos2dvARB; + exec->WindowPos2fARB = _mesa_WindowPos2fARB; + exec->WindowPos2fvARB = _mesa_WindowPos2fvARB; + exec->WindowPos2iARB = _mesa_WindowPos2iARB; + exec->WindowPos2ivARB = _mesa_WindowPos2ivARB; + exec->WindowPos2sARB = _mesa_WindowPos2sARB; + exec->WindowPos2svARB = _mesa_WindowPos2svARB; + exec->WindowPos3dARB = _mesa_WindowPos3dARB; + exec->WindowPos3dvARB = _mesa_WindowPos3dvARB; + exec->WindowPos3fARB = _mesa_WindowPos3fARB; + exec->WindowPos3fvARB = _mesa_WindowPos3fvARB; + exec->WindowPos3iARB = _mesa_WindowPos3iARB; + exec->WindowPos3ivARB = _mesa_WindowPos3ivARB; + exec->WindowPos3sARB = _mesa_WindowPos3sARB; + exec->WindowPos3svARB = _mesa_WindowPos3svARB; } |