void GLAPIENTRY _mesa_TexEnvi( GLenum target, GLenum pname, GLint param ) { GLfloat p[4]; p[0] = (GLfloat) param; p[1] = p[2] = p[3] = 0.0; _mesa_TexEnvfv( target, pname, p ); }
void GL_APIENTRY _mesa_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params) { switch(target) { case GL_POINT_SPRITE: case GL_TEXTURE_FILTER_CONTROL_EXT: case GL_TEXTURE_ENV: break; default: _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, "glTexEnvxv(target=0x%x)", target); return; } switch(pname) { case GL_COORD_REPLACE: case GL_TEXTURE_ENV_MODE: case GL_COMBINE_RGB: case GL_COMBINE_ALPHA: case GL_SRC0_RGB: case GL_SRC1_RGB: case GL_SRC2_RGB: case GL_SRC0_ALPHA: case GL_SRC1_ALPHA: case GL_SRC2_ALPHA: case GL_OPERAND0_RGB: case GL_OPERAND1_RGB: case GL_OPERAND2_RGB: case GL_OPERAND0_ALPHA: case GL_OPERAND1_ALPHA: case GL_OPERAND2_ALPHA: _mesa_TexEnvf(target, pname, (GLfloat) params[0]); break; case GL_TEXTURE_LOD_BIAS_EXT: case GL_RGB_SCALE: case GL_ALPHA_SCALE: _mesa_TexEnvf(target, pname, (GLfloat) (params[0] / 65536.0f)); break; case GL_TEXTURE_ENV_COLOR: { unsigned int i; GLfloat converted_params[4]; for (i = 0; i < ARRAY_SIZE(converted_params); i++) { converted_params[i] = (GLfloat) (params[i] / 65536.0f); } _mesa_TexEnvfv(target, pname, converted_params); break; } default: _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, "glTexEnvxv(pname=0x%x)", pname); return; } }
void GLAPIENTRY _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ) { GLfloat p[4]; if (pname == GL_TEXTURE_ENV_COLOR) { p[0] = INT_TO_FLOAT( param[0] ); p[1] = INT_TO_FLOAT( param[1] ); p[2] = INT_TO_FLOAT( param[2] ); p[3] = INT_TO_FLOAT( param[3] ); } else { p[0] = (GLfloat) param[0]; p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */ } _mesa_TexEnvfv( target, pname, p ); }
void GLAPIENTRY _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ) { _mesa_TexEnvfv( target, pname, ¶m ); }
static void pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) { GLuint u; for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { const struct gl_texture_unit *unit = &texAttrib->Unit[u]; GLuint i; _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + u); _mesa_set_enable(ctx, GL_TEXTURE_1D, (GLboolean) (unit->Enabled & TEXTURE0_1D ? GL_TRUE : GL_FALSE)); _mesa_set_enable(ctx, GL_TEXTURE_2D, (GLboolean) (unit->Enabled & TEXTURE0_2D ? GL_TRUE : GL_FALSE)); _mesa_set_enable(ctx, GL_TEXTURE_3D, (GLboolean) (unit->Enabled & TEXTURE0_3D ? GL_TRUE : GL_FALSE)); if (ctx->Extensions.ARB_texture_cube_map) { _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB, (GLboolean) (unit->Enabled & TEXTURE0_CUBE ? GL_TRUE : GL_FALSE)); } if (ctx->Extensions.NV_texture_rectangle) { _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV, (GLboolean) (unit->Enabled & TEXTURE0_RECT ? GL_TRUE : GL_FALSE)); } _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode); _mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor); _mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenModeS); _mesa_TexGeni(GL_T, GL_TEXTURE_GEN_MODE, unit->GenModeT); _mesa_TexGeni(GL_R, GL_TEXTURE_GEN_MODE, unit->GenModeR); _mesa_TexGeni(GL_Q, GL_TEXTURE_GEN_MODE, unit->GenModeQ); _mesa_TexGenfv(GL_S, GL_OBJECT_PLANE, unit->ObjectPlaneS); _mesa_TexGenfv(GL_T, GL_OBJECT_PLANE, unit->ObjectPlaneT); _mesa_TexGenfv(GL_R, GL_OBJECT_PLANE, unit->ObjectPlaneR); _mesa_TexGenfv(GL_Q, GL_OBJECT_PLANE, unit->ObjectPlaneQ); _mesa_TexGenfv(GL_S, GL_EYE_PLANE, unit->EyePlaneS); _mesa_TexGenfv(GL_T, GL_EYE_PLANE, unit->EyePlaneT); _mesa_TexGenfv(GL_R, GL_EYE_PLANE, unit->EyePlaneR); _mesa_TexGenfv(GL_Q, GL_EYE_PLANE, unit->EyePlaneQ); if (ctx->Extensions.EXT_texture_lod_bias) { _mesa_TexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, unit->LodBias); } if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, unit->CombineModeRGB); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, unit->CombineModeA); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, unit->CombineSourceRGB[0]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, unit->CombineSourceRGB[1]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, unit->CombineSourceRGB[2]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, unit->CombineSourceA[0]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, unit->CombineSourceA[1]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA_EXT, unit->CombineSourceA[2]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, unit->CombineOperandRGB[0]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, unit->CombineOperandRGB[1]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, unit->CombineOperandRGB[2]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_EXT, unit->CombineOperandA[0]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_EXT, unit->CombineOperandA[1]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA_EXT, unit->CombineOperandA[2]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1 << unit->CombineScaleShiftRGB); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, 1 << unit->CombineScaleShiftA); } /* Restore texture object state */ for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { GLenum target = 0; const struct gl_texture_object *obj = NULL; GLfloat bordColor[4]; switch (i) { case 0: target = GL_TEXTURE_1D; obj = &unit->Saved1D; break; case 1: target = GL_TEXTURE_2D; obj = &unit->Saved2D; break; case 2: target = GL_TEXTURE_3D; obj = &unit->Saved3D; break; case 3: if (!ctx->Extensions.ARB_texture_cube_map) continue; target = GL_TEXTURE_CUBE_MAP_ARB; obj = &unit->SavedCubeMap; break; case 4: if (!ctx->Extensions.NV_texture_rectangle) continue; target = GL_TEXTURE_RECTANGLE_NV; obj = &unit->SavedRect; break; default: ; /* silence warnings */ } _mesa_BindTexture(target, obj->Name); bordColor[0] = CHAN_TO_FLOAT(obj->BorderColor[0]); bordColor[1] = CHAN_TO_FLOAT(obj->BorderColor[1]); bordColor[2] = CHAN_TO_FLOAT(obj->BorderColor[2]); bordColor[3] = CHAN_TO_FLOAT(obj->BorderColor[3]); _mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Priority); _mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, bordColor); _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, obj->WrapS); _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, obj->WrapT); _mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, obj->WrapR); _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, obj->MinFilter); _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, obj->MagFilter); _mesa_TexParameterf(target, GL_TEXTURE_MIN_LOD, obj->MinLod); _mesa_TexParameterf(target, GL_TEXTURE_MAX_LOD, obj->MaxLod); _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, obj->BaseLevel); _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel); if (ctx->Extensions.EXT_texture_filter_anisotropic) { _mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, obj->MaxAnisotropy); } if (ctx->Extensions.SGIX_shadow) { _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_SGIX, obj->CompareFlag); _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_OPERATOR_SGIX, obj->CompareOperator); } if (ctx->Extensions.SGIX_shadow_ambient) { _mesa_TexParameterf(target, GL_SHADOW_AMBIENT_SGIX, CHAN_TO_FLOAT(obj->ShadowAmbient)); } } } _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + texAttrib->CurrentUnit); /* "un-bump" the texture object reference counts. We did that so they * wouldn't inadvertantly get deleted while they were still referenced * inside the attribute state stack. */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { ctx->Texture.Unit[u].Current1D->RefCount--; ctx->Texture.Unit[u].Current2D->RefCount--; ctx->Texture.Unit[u].Current3D->RefCount--; ctx->Texture.Unit[u].CurrentCubeMap->RefCount--; ctx->Texture.Unit[u].CurrentRect->RefCount--; } }