-/* $Id: texstate.c,v 1.43 2001/04/16 21:06:54 brianp Exp $ */
+/* $Id: texstate.c,v 1.44 2001/04/17 21:25:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define GL_CLAMP_TO_BORDER_ARB 0x812D
#endif
+#ifndef GL_SUBTRACT_ARB
+#define GL_SUBTRACT_ARB 0x84E7
+#endif
+
/**********************************************************************/
/* Texture Environment */
}
break;
case GL_COMBINE_EXT:
- if (!ctx->Extensions.EXT_texture_env_combine) {
+ if (!ctx->Extensions.EXT_texture_env_combine &&
+ !ctx->Extensions.ARB_texture_env_combine) {
ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
break;
}
case GL_COMBINE_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- GLenum mode = (GLenum) (GLint) *param;
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum mode = (GLenum) (GLint) *param;
switch (mode) {
case GL_REPLACE:
case GL_MODULATE:
case GL_ADD:
case GL_ADD_SIGNED_EXT:
case GL_INTERPOLATE_EXT:
+ /* OK */
break;
+ case GL_SUBTRACT_ARB:
+ if (!ctx->Extensions.ARB_texture_env_combine) {
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
case GL_DOT3_RGB_EXT:
case GL_DOT3_RGBA_EXT:
+ if (!ctx->Extensions.EXT_texture_env_dot3) {
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
case GL_DOT3_RGB_ARB:
case GL_DOT3_RGBA_ARB:
- if (!ctx->Extensions.EXT_texture_env_dot3) {
+ if (!ctx->Extensions.ARB_texture_env_dot3) {
ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
}
break;
case GL_COMBINE_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- GLenum mode = (GLenum) (GLint) *param;
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum mode = (GLenum) (GLint) *param;
switch (mode) {
case GL_REPLACE:
case GL_MODULATE:
case GL_ADD:
case GL_ADD_SIGNED_EXT:
case GL_INTERPOLATE_EXT:
- if (texUnit->CombineModeA == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->CombineModeA = mode;
+ /* OK */
break;
+ case GL_SUBTRACT_ARB:
+ if (!ctx->Extensions.ARB_texture_env_combine) {
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
default:
ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
+ if (texUnit->CombineModeA == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineModeA = mode;
}
else {
ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
case GL_SOURCE0_RGB_EXT:
case GL_SOURCE1_RGB_EXT:
case GL_SOURCE2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
GLenum source = (GLenum) (GLint) *param;
GLuint s = pname - GL_SOURCE0_RGB_EXT;
switch (source) {
case GL_SOURCE0_ALPHA_EXT:
case GL_SOURCE1_ALPHA_EXT:
case GL_SOURCE2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
GLenum source = (GLenum) (GLint) *param;
GLuint s = pname - GL_SOURCE0_ALPHA_EXT;
switch (source) {
break;
case GL_OPERAND0_RGB_EXT:
case GL_OPERAND1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
GLenum operand = (GLenum) (GLint) *param;
GLuint s = pname - GL_OPERAND0_RGB_EXT;
switch (operand) {
break;
case GL_OPERAND0_ALPHA_EXT:
case GL_OPERAND1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
GLenum operand = (GLenum) (GLint) *param;
switch (operand) {
case GL_SRC_ALPHA:
}
break;
case GL_OPERAND2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
GLenum operand = (GLenum) (GLint) *param;
switch (operand) {
case GL_SRC_COLOR: /* ARB combine only */
}
break;
case GL_OPERAND2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
GLenum operand = (GLenum) (GLint) *param;
switch (operand) {
case GL_SRC_ALPHA:
}
break;
case GL_RGB_SCALE_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
GLuint newshift;
if (*param == 1.0) {
newshift = 0;
}
break;
case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
GLuint newshift;
if (*param == 1.0) {
newshift = 0;
COPY_4FV( params, texUnit->EnvColor );
break;
case GL_RGB_SCALE_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
if (texUnit->CombineScaleShiftRGB == 0)
*params = 1.0;
else if (texUnit->CombineScaleShiftRGB == 1)
}
break;
case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
if (texUnit->CombineScaleShiftA == 0)
*params = 1.0;
else if (texUnit->CombineScaleShiftA == 1)
params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
break;
case GL_COMBINE_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineModeRGB;
}
else {
}
break;
case GL_COMBINE_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineModeA;
}
else {
}
break;
case GL_SOURCE0_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceRGB[0];
}
else {
}
break;
case GL_SOURCE1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceRGB[1];
}
else {
}
break;
case GL_SOURCE2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceRGB[2];
}
else {
}
break;
case GL_SOURCE0_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceA[0];
}
else {
}
break;
case GL_SOURCE1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceA[1];
}
else {
}
break;
case GL_SOURCE2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceA[2];
}
else {
}
break;
case GL_OPERAND0_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandRGB[0];
}
else {
}
break;
case GL_OPERAND1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandRGB[1];
}
else {
}
break;
case GL_OPERAND2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandRGB[2];
}
else {
}
break;
case GL_OPERAND0_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandA[0];
}
else {
}
break;
case GL_OPERAND1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandA[1];
}
else {
}
break;
case GL_OPERAND2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandA[2];
}
else {