Commit 5c08f57d authored by Gareth Hughes's avatar Gareth Hughes
Browse files

Implementation of GL_EXT_texture_env_dot3.

parent d6540dba
$Id: VERSIONS,v 1.38.2.21 2000/12/08 17:36:27 brianp Exp $
$Id: VERSIONS,v 1.38.2.22 2001/01/06 22:43:00 gareth Exp $
Mesa Version History
......@@ -790,3 +790,4 @@ Mesa Version History
- fixed a glColorMaterial lighting bug
- fixed bad args to Read/WriteStencilSpan in h/w stencil clear function
- glXCopySubBufferMESA() Y position was off by one
- GL_EXT_texture_env_dot3 extension (Gareth Hughes)
/* $Id: gl.h,v 1.44.4.1 2000/09/06 17:47:47 brianp Exp $ */
/* $Id: gl.h,v 1.44.4.2 2001/01/06 22:43:00 gareth Exp $ */
/*
* Mesa 3-D graphics library
......@@ -2228,6 +2228,19 @@ GLAPI void GLAPIENTRY glResizeBuffersMESA( void );
#endif /* GL_MESA_resize_bufffers */
/*
* 220. GL_EXT_texture_env_dot3
*/
#ifndef GL_EXT_texture_env_dot3
#define GL_EXT_texture_env_dot3 1
#define GL_DOT3_RGB_EXT 0x8740
#define GL_DOT3_RGBA_EXT 0x8741
#endif /* GL_EXT_texture_env_dot3 */
#else /* GL_GLEXT_LEGACY */
#include <GL/glext.h>
......
......@@ -13,21 +13,21 @@ extern "C" {
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
**
** http://oss.sgi.com/projects/FreeB
**
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
**
** Additional Notice Provisions: This software was created using the
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
** not been independently verified as being compliant with the OpenGL(R)
......@@ -1419,6 +1419,11 @@ extern "C" {
#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF
#endif
#ifndef GL_EXT_texture_env_dot3
#define GL_DOT3_RGB_EXT 0x8740
#define GL_DOT3_RGBA_EXT 0x8741
#endif
/*************************************************************/
......
/* $Id: osmesa.c,v 1.19.4.2 2000/11/10 17:17:20 brianp Exp $ */
/* $Id: osmesa.c,v 1.19.4.3 2001/01/06 22:43:01 gareth Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
*
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
......@@ -227,6 +227,7 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
gl_extensions_enable(&(osmesa->gl_ctx),"GL_HP_occlusion_test");
gl_extensions_enable(&(osmesa->gl_ctx), "GL_ARB_texture_cube_map");
gl_extensions_enable(&(osmesa->gl_ctx), "GL_EXT_texture_env_combine");
gl_extensions_enable(&(osmesa->gl_ctx), "GL_EXT_texture_env_dot3");
osmesa->gl_buffer = gl_create_framebuffer( osmesa->gl_visual,
osmesa->gl_visual->DepthBits > 0,
......
/* $Id: enums.c,v 1.9.4.1 2000/11/05 21:24:00 brianp Exp $ */
/* $Id: enums.c,v 1.9.4.2 2001/01/06 22:43:00 gareth Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
*
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
......@@ -34,12 +34,12 @@
#endif
typedef struct {
const char *c;
int n;
typedef struct {
const char *c;
int n;
} enum_elt;
enum_elt all_enums[] =
enum_elt all_enums[] =
{
/* Boolean values */
{ "GL_FALSE", 0 },
......@@ -828,7 +828,11 @@ enum_elt all_enums[] =
{ "GL_INTERPOLATE_EXT", 0x8575 },
{ "GL_CONSTANT_EXT", 0x8576 },
{ "GL_PRIMARY_COLOR_EXT", 0x8577 },
{ "GL_PREVIOUS_EXT", 0x8578 }
{ "GL_PREVIOUS_EXT", 0x8578 },
/* GL_EXT_texture_env_dot3 */
{ "GL_DOT3_RGB_EXT", 0x8740 },
{ "GL_DOT3_RGBA_EXT", 0x8741 },
};
......@@ -839,7 +843,7 @@ typedef int (GLWINAPIV *cfunc)(const void *, const void *);
static enum_elt **index1 = 0;
static int sorted = 0;
static int compar_name( const enum_elt *a, const enum_elt *b )
static int compar_name( const enum_elt *a, const enum_elt *b )
{
return strcmp(a->c, b->c);
}
......@@ -847,7 +851,7 @@ static int compar_name( const enum_elt *a, const enum_elt *b )
/* note the extra level of indirection
*/
static int compar_nr( const enum_elt **a, const enum_elt **b )
static int compar_nr( const enum_elt **a, const enum_elt **b )
{
return (*a)->n - (*b)->n;
}
......@@ -859,10 +863,10 @@ static void sort_enums( void )
index1 = (enum_elt **)MALLOC( Elements(all_enums) * sizeof(enum_elt *) );
sorted = 1;
qsort( all_enums, Elements(all_enums), sizeof(*all_enums),
qsort( all_enums, Elements(all_enums), sizeof(*all_enums),
(cfunc) compar_name );
for (i = 0 ; i < Elements(all_enums) ; i++)
for (i = 0 ; i < Elements(all_enums) ; i++)
index1[i] = &all_enums[i];
qsort( index1, Elements(all_enums), sizeof(*index1), (cfunc) compar_nr );
......@@ -875,14 +879,14 @@ int gl_lookup_enum_by_name( const char *symbol )
enum_elt tmp;
enum_elt *e;
if (!sorted)
if (!sorted)
sort_enums();
if (!symbol)
if (!symbol)
return 0;
tmp.c = symbol;
e = (enum_elt *)bsearch( &tmp, all_enums, Elements(all_enums),
e = (enum_elt *)bsearch( &tmp, all_enums, Elements(all_enums),
sizeof(*all_enums), (cfunc) compar_name );
return e ? e->n : -1;
......@@ -893,13 +897,13 @@ const char *gl_lookup_enum_by_nr( int nr )
{
enum_elt tmp, *e, **f;
if (!sorted)
if (!sorted)
sort_enums();
tmp.n = nr;
e = &tmp;
f = (enum_elt **)bsearch( &e, index1, Elements(all_enums),
f = (enum_elt **)bsearch( &e, index1, Elements(all_enums),
sizeof(*index1), (cfunc) compar_nr );
return f ? (*f)->c : "(unknown)";
......@@ -920,6 +924,6 @@ int main()
for (i = 0 ; i < Elements(test) ; i++) {
int d = gl_lookup_enum_by_name( test[i] );
printf("%s --> %d --> %s\n", test[i], d, gl_lookup_enum_by_nr( d ));
}
}
}
#endif
/* $Id: extensions.c,v 1.32.4.1 2000/08/29 22:58:57 brianp Exp $ */
/* $Id: extensions.c,v 1.32.4.2 2001/01/06 22:43:00 gareth Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.4
*
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
......@@ -43,7 +43,7 @@ struct extension {
struct extension *next, *prev;
GLint enabled;
char name[MAX_EXT_NAMELEN+1];
void (*notify)( GLcontext *, GLboolean );
void (*notify)( GLcontext *, GLboolean );
};
......@@ -76,6 +76,7 @@ static struct { int enabled; const char *name; } default_extensions[] = {
{ DEFAULT_OFF, "GL_EXT_texture_env" },
{ DEFAULT_ON, "GL_EXT_texture_env_add" },
{ DEFAULT_OFF, "GL_EXT_texture_env_combine" },
{ DEFAULT_OFF, "GL_EXT_texture_env_dot3" },
{ ALWAYS_ENABLED, "GL_EXT_texture_object" },
{ DEFAULT_ON, "GL_EXT_texture_lod_bias" },
{ ALWAYS_ENABLED, "GL_EXT_vertex_array" },
......@@ -105,6 +106,7 @@ update_extension_flags( GLcontext *ctx )
/* Update flags */
ctx->Extensions.HaveTextureEnvAdd = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add");
ctx->Extensions.HaveTextureEnvCombine = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_combine");
ctx->Extensions.HaveTextureEnvDot3 = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_dot3");
ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias");
ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test");
ctx->Extensions.HaveTextureCubeMap = gl_extension_is_enabled(ctx, "GL_ARB_texture_cube_map");
......@@ -116,14 +118,14 @@ update_extension_flags( GLcontext *ctx )
int gl_extensions_add( GLcontext *ctx,
int state,
const char *name,
int gl_extensions_add( GLcontext *ctx,
int state,
const char *name,
void (*notify)(void) )
{
(void) notify;
if (ctx->Extensions.ext_string == 0)
if (ctx->Extensions.ext_string == 0)
{
struct extension *t = MALLOC_STRUCT(extension);
t->enabled = state;
......@@ -143,27 +145,27 @@ int gl_extensions_add( GLcontext *ctx,
static int set_extension( GLcontext *ctx, const char *name, GLint state )
{
struct extension *i;
foreach( i, ctx->Extensions.ext_list )
if (strncmp(i->name, name, MAX_EXT_NAMELEN) == 0)
foreach( i, ctx->Extensions.ext_list )
if (strncmp(i->name, name, MAX_EXT_NAMELEN) == 0)
break;
if (i == ctx->Extensions.ext_list)
return 1;
if (!(i->enabled & ALWAYS_ENABLED)) {
if (i->notify) i->notify( ctx, state );
if (i->notify) i->notify( ctx, state );
i->enabled = state;
}
update_extension_flags(ctx);
return 0;
}
}
int gl_extensions_enable( GLcontext *ctx, const char *name )
{
if (ctx->Extensions.ext_string == 0)
if (ctx->Extensions.ext_string == 0)
return set_extension( ctx, name, 1 );
return 1;
}
......@@ -171,11 +173,11 @@ int gl_extensions_enable( GLcontext *ctx, const char *name )
int gl_extensions_disable( GLcontext *ctx, const char *name )
{
if (ctx->Extensions.ext_string == 0)
if (ctx->Extensions.ext_string == 0)
return set_extension( ctx, name, 0 );
return 1;
}
/*
* Test if the named extension is enabled in this context.
......@@ -209,10 +211,10 @@ void gl_extensions_dtr( GLcontext *ctx )
remove_from_list( i );
FREE( i );
}
FREE(ctx->Extensions.ext_list);
ctx->Extensions.ext_list = 0;
}
}
}
......@@ -225,7 +227,7 @@ void gl_extensions_ctr( GLcontext *ctx )
make_empty_list( ctx->Extensions.ext_list );
for (i = 0 ; i < Elements(default_extensions) ; i++) {
gl_extensions_add( ctx,
gl_extensions_add( ctx,
default_extensions[i].enabled,
default_extensions[i].name,
0 );
......@@ -236,22 +238,22 @@ void gl_extensions_ctr( GLcontext *ctx )
const char *gl_extensions_get_string( GLcontext *ctx )
{
if (ctx->Extensions.ext_string == 0)
if (ctx->Extensions.ext_string == 0)
{
struct extension *i;
char *str;
GLuint len = 0;
foreach (i, ctx->Extensions.ext_list)
foreach (i, ctx->Extensions.ext_list)
if (i->enabled)
len += strlen(i->name) + 1;
if (len == 0)
if (len == 0)
return "";
str = (char *)MALLOC(len * sizeof(char));
ctx->Extensions.ext_string = str;
foreach (i, ctx->Extensions.ext_list)
foreach (i, ctx->Extensions.ext_list)
if (i->enabled) {
strcpy(str, i->name);
str += strlen(str);
......@@ -260,6 +262,6 @@ const char *gl_extensions_get_string( GLcontext *ctx )
*(str-1) = 0;
}
return ctx->Extensions.ext_string;
}
/* $Id: texstate.c,v 1.15.4.2 2000/11/05 21:24:01 brianp Exp $ */
/* $Id: texstate.c,v 1.15.4.3 2001/01/06 22:43:00 gareth Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.4
*
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
......@@ -118,6 +118,14 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
case GL_ADD:
case GL_ADD_SIGNED_EXT:
case GL_INTERPOLATE_EXT:
case GL_DOT3_RGB_EXT:
case GL_DOT3_RGBA_EXT:
if ((mode == GL_DOT3_RGB_EXT ||
mode == GL_DOT3_RGBA_EXT) &&
!ctx->Extensions.HaveTextureEnvDot3) {
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
return;
}
if (texUnit->CombineModeRGB == mode)
return; /* no change */
texUnit->CombineModeRGB = mode;
......@@ -356,7 +364,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
}
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n",
fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n",
gl_lookup_enum_by_nr(target),
gl_lookup_enum_by_nr(pname),
*param,
......@@ -620,7 +628,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexParameterfv");
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "texPARAM %s %s %d...\n",
fprintf(stderr, "texPARAM %s %s %d...\n",
gl_lookup_enum_by_nr(target),
gl_lookup_enum_by_nr(pname),
eparam);
......@@ -1092,7 +1100,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexGenfv");
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "texGEN %s %s %x...\n",
fprintf(stderr, "texGEN %s %s %x...\n",
gl_lookup_enum_by_nr(coord),
gl_lookup_enum_by_nr(pname),
*(int *)params);
......@@ -1242,7 +1250,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
if (pname==GL_TEXTURE_GEN_MODE) {
GLenum mode = (GLenum) (GLint) *params;
switch (mode) {
case GL_OBJECT_LINEAR:
case GL_OBJECT_LINEAR:
texUnit->GenModeQ = GL_OBJECT_LINEAR;
texUnit->GenBitQ = TEXGEN_OBJ_LINEAR;
break;
......@@ -1597,7 +1605,7 @@ _mesa_ActiveTextureARB( GLenum target )
ASSERT_OUTSIDE_BEGIN_END( ctx, "glActiveTextureARB" );
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glActiveTexture %s\n",
fprintf(stderr, "glActiveTexture %s\n",
gl_lookup_enum_by_nr(target));
if (target >= GL_TEXTURE0_ARB && target < GL_TEXTURE0_ARB + maxUnits) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment