Skip to content
Snippets Groups Projects
Commit 1c5036b7 authored by slevy's avatar slevy
Browse files

More 3-D texture hooks -- we might have GL_TEXTURE_3D instead of GL_TEXTURE_3D_EXT.

parent 0214106a
No related branches found
No related tags found
No related merge requests found
......@@ -84,15 +84,23 @@ int txbind( Texture *tx, int *enabled )
int mustload;
int wanted, wantenv;
if(tx == NULL || txload(tx) == 0) {
if(tx == NULL || txload(tx) == 0
#ifndef GL_TEXTURE_3D
|| tx->flags & TXF_3D
#endif
) {
/* reset state, invalidate cache */
if(enabled == NULL || *enabled != 0) {
glBindTexture( GL_TEXTURE_2D, 0 );
glDisable( GL_TEXTURE_2D );
#ifdef GL_TEXTURE_3D
if(any3d) {
glDisable( GL_TEXTURE_3D );
glBindTexture( GL_TEXTURE_3D, 0 );
}
#endif
glDisable( GL_ALPHA_TEST );
}
txenv = -1;
......@@ -100,9 +108,14 @@ int txbind( Texture *tx, int *enabled )
return 0;
}
txtarget = (tx->flags & TXF_3D) ? GL_TEXTURE_3D : GL_TEXTURE_2D;
#ifdef GL_TEXTURE_3D
txtarget = (tx->flags & TXF_3D) ? GL_TEXTURE_3D_EXT : GL_TEXTURE_2D;
if(txtarget == GL_TEXTURE_3D)
#else
txtarget = GL_TEXTURE_2D;
#endif
if(tx->flags & TXF_3D)
any3d = 1;
if(ctx < 0)
......@@ -193,6 +206,7 @@ int txbind( Texture *tx, int *enabled )
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
if(tx->flags & TXF_3D) {
#ifdef GL_TEXTURE_3D
tx->qualflags &= ~TXQ_MIPMAP;
glTexImage3D( GL_TEXTURE_3D, 0, channels,
......@@ -202,6 +216,7 @@ int txbind( Texture *tx, int *enabled )
? GL_ALPHA : format[channels],
GL_UNSIGNED_BYTE,
txdata );
#endif
} else {
......@@ -260,7 +275,9 @@ int txbind( Texture *tx, int *enabled )
glEnable(txtarget);
} else {
glDisable(GL_TEXTURE_2D);
#ifdef GL_TEXTURE_3D
if(any3d) glDisable(GL_TEXTURE_3D);
#endif
}
*enabled = wanted = tx->txid[ctx] | wantblend;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment