added GL_ARB_texture_border_clamp

This commit is contained in:
Brian Paul
2001-03-26 19:42:40 +00:00
parent 425fea1c34
commit 2bb04cad14
7 changed files with 111 additions and 35 deletions

View File

@@ -69,6 +69,21 @@ GL_EXT_secondary_color
instead of getting it only from lighting in GL_SEPARATE_SPECULAR_COLOR instead of getting it only from lighting in GL_SEPARATE_SPECULAR_COLOR
mode. mode.
GL_ARB_texture_env_combine
Basically the same as GL_EXT_texture_env_combine
GL_ARB_texture_env_add extension
Texture addition mode.
GL_ARB_texture_env_dot3 extension
Dot product texture environment.
GL_ARB_texture_border_clamp
Adds GL_CLAMP_TO_BORDER_ARB texture wrap mode
GL_SGIX_depth_texture, GL_SGIX_shadow and GL_SGIX_shadow_ambient
Implements a shadow casting algorithm based on depth map textures
libOSMesa.so libOSMesa.so
@@ -168,4 +183,4 @@ interface structures like __GLimports and __GLexports.
---------------------------------------------------------------------- ----------------------------------------------------------------------
$Id: RELNOTES-3.5,v 1.9 2001/03/17 00:47:19 brianp Exp $ $Id: RELNOTES-3.5,v 1.10 2001/03/26 19:45:08 brianp Exp $

View File

@@ -1,4 +1,4 @@
$Id: VERSIONS,v 1.52 2001/03/22 04:55:48 brianp Exp $ $Id: VERSIONS,v 1.53 2001/03/26 19:45:08 brianp Exp $
Mesa Version History Mesa Version History
@@ -823,6 +823,7 @@ Mesa Version History
- demos/shadowtex.c demo of GL_SGIX_depth_texture and GL_SGIX_shadow - demos/shadowtex.c demo of GL_SGIX_depth_texture and GL_SGIX_shadow
- GL_ARB_texture_env_combine extension - GL_ARB_texture_env_combine extension
- GL_ARB_texture_env_dot3 extension - GL_ARB_texture_env_dot3 extension
- GL_ARB_texture_border_clamp (aka GL_SGIS_texture_border_clamp)
- OSMesaCreateContextExt() function - OSMesaCreateContextExt() function
- libOSMesa.so library, contains the OSMesa driver interface - libOSMesa.so library, contains the OSMesa driver interface
- GL/glxext.h header file for GLX extensions - GL/glxext.h header file for GLX extensions

View File

@@ -1,4 +1,4 @@
/* $Id: enums.c,v 1.15 2001/03/22 04:57:09 brianp Exp $ */ /* $Id: enums.c,v 1.16 2001/03/26 19:42:40 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -841,6 +841,8 @@ enum_elt all_enums[] =
{ "GL_DOT3_RGB_EXT", 0x86ae }, { "GL_DOT3_RGB_EXT", 0x86ae },
{ "GL_DOT3_RGBA_EXT", 0x86af }, { "GL_DOT3_RGBA_EXT", 0x86af },
/* GL_ARB_texture_border_clamp */
{ "GL_CLAMP_TO_BORDER_ARB", 0x812D },
}; };
#define Elements(x) sizeof(x)/sizeof(*x) #define Elements(x) sizeof(x)/sizeof(*x)

View File

@@ -1,4 +1,4 @@
/* $Id: extensions.c,v 1.55 2001/03/22 14:42:24 brianp Exp $ */ /* $Id: extensions.c,v 1.56 2001/03/26 19:42:40 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -58,6 +58,7 @@ static struct {
} default_extensions[] = { } default_extensions[] = {
{ OFF, "GL_ARB_imaging", F(ARB_imaging) }, { OFF, "GL_ARB_imaging", F(ARB_imaging) },
{ OFF, "GL_ARB_multitexture", F(ARB_multitexture) }, { OFF, "GL_ARB_multitexture", F(ARB_multitexture) },
{ OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) },
{ OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) }, { OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) },
{ OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) },
{ OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) }, { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) },
@@ -106,6 +107,7 @@ static struct {
{ OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) }, { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) },
{ OFF, "GL_SGI_color_table", F(SGI_color_table) }, { OFF, "GL_SGI_color_table", F(SGI_color_table) },
{ OFF, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) }, { OFF, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) },
{ OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) },
{ OFF, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { OFF, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
{ OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) }, { OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) },
{ OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) }, { OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) },
@@ -127,6 +129,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
const char *extensions[] = { const char *extensions[] = {
"GL_ARB_imaging", "GL_ARB_imaging",
"GL_ARB_multitexture", "GL_ARB_multitexture",
"GL_ARB_texture_border_clamp",
"GL_ARB_texture_cube_map", "GL_ARB_texture_cube_map",
"GL_ARB_texture_env_add", "GL_ARB_texture_env_add",
"GL_ARB_texture_env_combine", "GL_ARB_texture_env_combine",
@@ -157,6 +160,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
"GL_SGI_color_table", "GL_SGI_color_table",
"GL_SGIS_pixel_texture", "GL_SGIS_pixel_texture",
"GL_SGIS_texture_edge_clamp", "GL_SGIS_texture_edge_clamp",
"GL_SGIS_texture_border_clamp",
"GL_SGIX_depth_texture", "GL_SGIX_depth_texture",
"GL_SGIX_pixel_texture", "GL_SGIX_pixel_texture",
"GL_SGIX_shadow", "GL_SGIX_shadow",

View File

@@ -1,4 +1,4 @@
/* $Id: mtypes.h,v 1.31 2001/03/24 06:01:27 gareth Exp $ */ /* $Id: mtypes.h,v 1.32 2001/03/26 19:42:40 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -798,8 +798,8 @@ struct gl_texture_format {
/* Texture image record */ /* Texture image record */
struct gl_texture_image { struct gl_texture_image {
GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
* GL_INTENSITY, GL_RGB, GL_RGBA, or * GL_INTENSITY, GL_RGB, GL_RGBA,
* GL_COLOR_INDEX only * GL_COLOR_INDEX or GL_DEPTH_COMPONENT only.
*/ */
GLenum Type; /* Texel type: GL_UNSIGNED_BYTE, etc. */ GLenum Type; /* Texel type: GL_UNSIGNED_BYTE, etc. */
GLenum IntFormat; /* Internal format as given by the user */ GLenum IntFormat; /* Internal format as given by the user */
@@ -836,9 +836,9 @@ struct gl_texture_object {
GLuint Dimensions; /* 1 or 2 or 3 or 6 (cube map) */ GLuint Dimensions; /* 1 or 2 or 3 or 6 (cube map) */
GLfloat Priority; /* in [0,1] */ GLfloat Priority; /* in [0,1] */
GLchan BorderColor[4]; GLchan BorderColor[4];
GLenum WrapS; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ GLenum WrapS; /* Wrap modes are: GL_CLAMP, REPEAT */
GLenum WrapT; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ GLenum WrapT; /* GL_CLAMP_TO_EDGE, and */
GLenum WrapR; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ GLenum WrapR; /* GL_CLAMP_TO_BORDER_ARB */
GLenum MinFilter; /* minification filter */ GLenum MinFilter; /* minification filter */
GLenum MagFilter; /* magnification filter */ GLenum MagFilter; /* magnification filter */
GLfloat MinLod; /* min lambda, OpenGL 1.2 */ GLfloat MinLod; /* min lambda, OpenGL 1.2 */
@@ -1203,6 +1203,7 @@ struct gl_extensions {
*/ */
GLboolean ARB_imaging; GLboolean ARB_imaging;
GLboolean ARB_multitexture; GLboolean ARB_multitexture;
GLboolean ARB_texture_border_clamp;
GLboolean ARB_texture_compression; GLboolean ARB_texture_compression;
GLboolean ARB_texture_cube_map; GLboolean ARB_texture_cube_map;
GLboolean EXT_blend_color; GLboolean EXT_blend_color;

View File

@@ -1,4 +1,4 @@
/* $Id: texstate.c,v 1.38 2001/03/22 04:54:58 brianp Exp $ */ /* $Id: texstate.c,v 1.39 2001/03/26 19:42:40 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -63,6 +63,10 @@
#define GL_DOT3_RGBA_ARB 0x86AF #define GL_DOT3_RGBA_ARB 0x86AF
#endif #endif
/* XXX this is temporary, until GL/glext.h is updated. */
#ifndef GL_CLAMP_TO_BORDER_ARB
#define GL_CLAMP_TO_BORDER_ARB 0x812D
#endif
/**********************************************************************/ /**********************************************************************/
@@ -722,8 +726,11 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_S:
if (texObj->WrapS == eparam) if (texObj->WrapS == eparam)
return; return;
if (eparam==GL_CLAMP ||
if (eparam==GL_CLAMP || eparam==GL_REPEAT || eparam==GL_CLAMP_TO_EDGE) { eparam==GL_REPEAT ||
eparam==GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
ctx->Extensions.ARB_texture_border_clamp)) {
texObj->WrapS = eparam; texObj->WrapS = eparam;
} }
else { else {
@@ -734,8 +741,11 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_T: case GL_TEXTURE_WRAP_T:
if (texObj->WrapT == eparam) if (texObj->WrapT == eparam)
return; return;
if (eparam==GL_CLAMP ||
if (eparam==GL_CLAMP || eparam==GL_REPEAT || eparam==GL_CLAMP_TO_EDGE) { eparam==GL_REPEAT ||
eparam==GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
ctx->Extensions.ARB_texture_border_clamp)) {
texObj->WrapT = eparam; texObj->WrapT = eparam;
} }
else { else {
@@ -746,8 +756,11 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_R_EXT: case GL_TEXTURE_WRAP_R_EXT:
if (texObj->WrapR == eparam) if (texObj->WrapR == eparam)
return; return;
if (eparam==GL_CLAMP ||
if (eparam==GL_CLAMP || eparam==GL_REPEAT || eparam==GL_CLAMP_TO_EDGE) { eparam==GL_REPEAT ||
eparam==GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
ctx->Extensions.ARB_texture_border_clamp)) {
texObj->WrapR = eparam; texObj->WrapR = eparam;
} }
else { else {

View File

@@ -1,4 +1,4 @@
/* $Id: s_texture.c,v 1.19 2001/03/23 18:53:26 brianp Exp $ */ /* $Id: s_texture.c,v 1.20 2001/03/26 19:42:40 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -46,6 +46,11 @@
#define GL_DOT3_RGBA_ARB 0x86AF #define GL_DOT3_RGBA_ARB 0x86AF
#endif #endif
/* XXX this is temporary, until GL/glext.h is updated. */
#ifndef GL_CLAMP_TO_BORDER_ARB
#define GL_CLAMP_TO_BORDER_ARB 0x812D
#endif
/* /*
* These values are used in the fixed-point arithmetic used * These values are used in the fixed-point arithmetic used
@@ -58,7 +63,7 @@
/* /*
* Used to compute texel locations for linear sampling. * Used to compute texel locations for linear sampling.
* Input: * Input:
* wrapMode = GL_REPEAT, GL_CLAMP or GL_CLAMP_TO_EDGE * wrapMode = GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER_ARB
* S = texcoord in [0,1] * S = texcoord in [0,1]
* SIZE = width (or height or depth) of texture * SIZE = width (or height or depth) of texture
* Output: * Output:
@@ -72,22 +77,45 @@
I0 = IFLOOR(U) & (SIZE - 1); \ I0 = IFLOOR(U) & (SIZE - 1); \
I1 = (I0 + 1) & (SIZE - 1); \ I1 = (I0 + 1) & (SIZE - 1); \
} \ } \
else { \ else if (wrapMode == GL_CLAMP_TO_EDGE) { \
if (S <= 0.0F) \ if (S <= 0.0F) \
U = 0.0F; \ U = 0.0F; \
else if (S >= 1.0F) \ else if (S >= 1.0F) \
U = SIZE; \ U = SIZE; \
else \ else \
U = S * SIZE; \ U = S * SIZE; \
U -= 0.5F; \
I0 = IFLOOR(U); \
I1 = I0 + 1; \
if (I0 < 0) \
I0 = 0; \
if (I1 >= (GLint) SIZE) \
I1 = SIZE - 1; \
} \
else if (wrapMode == GL_CLAMP_TO_BORDER_ARB) { \
const GLfloat min = -1.0F / (2.0F * SIZE); \
const GLfloat max = 1.0F - min; \
if (S <= min) \
U = min * SIZE; \
else if (S >= max) \
U = max * SIZE; \
else \
U = S * SIZE; \
U -= 0.5F; \
I0 = IFLOOR(U); \
I1 = I0 + 1; \
} \
else { \
ASSERT(wrapMode == GL_CLAMP); \
if (S <= 0.0F) \
U = 0.0F; \
else if (S >= 1.0F) \
U = SIZE; \
else \
U = S * SIZE; \
U -= 0.5F; \ U -= 0.5F; \
I0 = IFLOOR(U); \ I0 = IFLOOR(U); \
I1 = I0 + 1; \ I1 = I0 + 1; \
if (wrapMode == GL_CLAMP_TO_EDGE) { \
if (I0 < 0) \
I0 = 0; \
if (I1 >= (GLint) SIZE) \
I1 = SIZE - 1; \
} \
} \ } \
} }
@@ -99,13 +127,13 @@
{ \ { \
if (wrapMode == GL_REPEAT) { \ if (wrapMode == GL_REPEAT) { \
/* s limited to [0,1) */ \ /* s limited to [0,1) */ \
/* i limited to [0,width-1] */ \ /* i limited to [0,size-1] */ \
I = (GLint) (S * SIZE); \ I = IFLOOR(S * SIZE); \
if (S < 0.0F) \
I -= 1; \
I &= (SIZE - 1); \ I &= (SIZE - 1); \
} \ } \
else if (wrapMode == GL_CLAMP_TO_EDGE) { \ else if (wrapMode == GL_CLAMP_TO_EDGE) { \
/* s limited to [min,max] */ \
/* i limited to [0, size-1] */ \
const GLfloat min = 1.0F / (2.0F * SIZE); \ const GLfloat min = 1.0F / (2.0F * SIZE); \
const GLfloat max = 1.0F - min; \ const GLfloat max = 1.0F - min; \
if (S < min) \ if (S < min) \
@@ -113,18 +141,30 @@
else if (S > max) \ else if (S > max) \
I = SIZE - 1; \ I = SIZE - 1; \
else \ else \
I = (GLint) (S * SIZE); \ I = IFLOOR(S * SIZE); \
} \
else if (wrapMode == GL_CLAMP_TO_BORDER_ARB) { \
/* s limited to [min,max] */ \
/* i limited to [-1, size] */ \
const GLfloat min = -1.0F / (2.0F * SIZE); \
const GLfloat max = 1.0F - min; \
if (S <= min) \
I = -1; \
else if (S >= max) \
I = SIZE; \
else \
I = IFLOOR(S * SIZE); \
} \ } \
else { \ else { \
ASSERT(wrapMode == GL_CLAMP); \ ASSERT(wrapMode == GL_CLAMP); \
/* s limited to [0,1] */ \ /* s limited to [0,1] */ \
/* i limited to [0,width-1] */ \ /* i limited to [0,size-1] */ \
if (S <= 0.0F) \ if (S <= 0.0F) \
I = 0; \ I = 0; \
else if (S >= 1.0F) \ else if (S >= 1.0F) \
I = SIZE - 1; \ I = SIZE - 1; \
else \ else \
I = (GLint) (S * SIZE); \ I = IFLOOR(S * SIZE); \
} \ } \
} }