fixed a texture enable bug
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
/* $Id: enable.c,v 1.25 2000/10/05 23:10:42 brianp Exp $ */
|
/* $Id: enable.c,v 1.26 2000/10/21 01:29:12 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 3.3
|
* Version: 3.5
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -357,48 +357,39 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
|
|||||||
case GL_TEXTURE_1D:
|
case GL_TEXTURE_1D:
|
||||||
if (ctx->Visual.RGBAflag) {
|
if (ctx->Visual.RGBAflag) {
|
||||||
const GLuint curr = ctx->Texture.CurrentUnit;
|
const GLuint curr = ctx->Texture.CurrentUnit;
|
||||||
const GLuint flag = TEXTURE0_1D << (curr * 4);
|
|
||||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
|
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
|
||||||
ctx->NewState |= NEW_TEXTURE_ENABLE;
|
ctx->NewState |= NEW_TEXTURE_ENABLE;
|
||||||
if (state) {
|
if (state) {
|
||||||
texUnit->Enabled |= TEXTURE0_1D;
|
texUnit->Enabled |= TEXTURE0_1D;
|
||||||
ctx->Enabled |= flag;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
texUnit->Enabled &= ~TEXTURE0_1D;
|
texUnit->Enabled &= ~TEXTURE0_1D;
|
||||||
ctx->Enabled &= ~flag;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_2D:
|
case GL_TEXTURE_2D:
|
||||||
if (ctx->Visual.RGBAflag) {
|
if (ctx->Visual.RGBAflag) {
|
||||||
const GLuint curr = ctx->Texture.CurrentUnit;
|
const GLuint curr = ctx->Texture.CurrentUnit;
|
||||||
const GLuint flag = TEXTURE0_2D << (curr * 4);
|
|
||||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
|
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
|
||||||
ctx->NewState |= NEW_TEXTURE_ENABLE;
|
ctx->NewState |= NEW_TEXTURE_ENABLE;
|
||||||
if (state) {
|
if (state) {
|
||||||
texUnit->Enabled |= TEXTURE0_2D;
|
texUnit->Enabled |= TEXTURE0_2D;
|
||||||
ctx->Enabled |= flag;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
texUnit->Enabled &= ~TEXTURE0_2D;
|
texUnit->Enabled &= ~TEXTURE0_2D;
|
||||||
ctx->Enabled &= ~flag;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_3D:
|
case GL_TEXTURE_3D:
|
||||||
if (ctx->Visual.RGBAflag) {
|
if (ctx->Visual.RGBAflag) {
|
||||||
const GLuint curr = ctx->Texture.CurrentUnit;
|
const GLuint curr = ctx->Texture.CurrentUnit;
|
||||||
const GLuint flag = TEXTURE0_3D << (curr * 4);
|
|
||||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
|
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
|
||||||
ctx->NewState |= NEW_TEXTURE_ENABLE;
|
ctx->NewState |= NEW_TEXTURE_ENABLE;
|
||||||
if (state) {
|
if (state) {
|
||||||
texUnit->Enabled |= TEXTURE0_3D;
|
texUnit->Enabled |= TEXTURE0_3D;
|
||||||
ctx->Enabled |= flag;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
texUnit->Enabled &= ~TEXTURE0_3D;
|
texUnit->Enabled &= ~TEXTURE0_3D;
|
||||||
ctx->Enabled &= ~flag;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -528,35 +519,24 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
|
|||||||
if (ctx->Extensions.HaveTextureCubeMap) {
|
if (ctx->Extensions.HaveTextureCubeMap) {
|
||||||
if (ctx->Visual.RGBAflag) {
|
if (ctx->Visual.RGBAflag) {
|
||||||
const GLuint curr = ctx->Texture.CurrentUnit;
|
const GLuint curr = ctx->Texture.CurrentUnit;
|
||||||
const GLuint flag = TEXTURE0_CUBE << (curr * 4);
|
|
||||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
|
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
|
||||||
ctx->NewState |= NEW_TEXTURE_ENABLE;
|
ctx->NewState |= NEW_TEXTURE_ENABLE;
|
||||||
if (state) {
|
if (state) {
|
||||||
texUnit->Enabled |= TEXTURE0_CUBE;
|
texUnit->Enabled |= TEXTURE0_CUBE;
|
||||||
ctx->Enabled |= flag;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
texUnit->Enabled &= ~TEXTURE0_CUBE;
|
texUnit->Enabled &= ~TEXTURE0_CUBE;
|
||||||
ctx->Enabled &= ~flag;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (state)
|
gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
|
||||||
gl_error(ctx, GL_INVALID_ENUM, "glEnable");
|
|
||||||
else
|
|
||||||
gl_error(ctx, GL_INVALID_ENUM, "glDisable");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (state) {
|
gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
|
||||||
gl_error( ctx, GL_INVALID_ENUM, "glEnable" );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gl_error( ctx, GL_INVALID_ENUM, "glDisable" );
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: state.c,v 1.32 2000/10/20 19:54:49 brianp Exp $ */
|
/* $Id: state.c,v 1.33 2000/10/21 01:29:12 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -883,8 +883,11 @@ void gl_update_state( GLcontext *ctx )
|
|||||||
ctx->Texture.MultiTextureEnabled = GL_TRUE;
|
ctx->Texture.MultiTextureEnabled = GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ctx->Texture.Unit[i].ReallyEnabled = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
ctx->Enabled = (ctx->Enabled & ~ENABLE_TEX_ANY) | ctx->Texture.ReallyEnabled;
|
||||||
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
|
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user