more work on GL_ARB_texture_cube_map
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: osmesa.c,v 1.16 2000/04/22 01:05:40 brianp Exp $ */
|
/* $Id: osmesa.c,v 1.17 2000/05/26 14:44:59 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -226,6 +226,7 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
gl_extensions_enable(&(osmesa->gl_ctx),"GL_HP_occlusion_test");
|
gl_extensions_enable(&(osmesa->gl_ctx),"GL_HP_occlusion_test");
|
||||||
|
gl_extensions_enable(&(osmesa->gl_ctx), "GL_ARB_texture_cube_map");
|
||||||
|
|
||||||
osmesa->gl_buffer = gl_create_framebuffer( osmesa->gl_visual,
|
osmesa->gl_buffer = gl_create_framebuffer( osmesa->gl_visual,
|
||||||
osmesa->gl_visual->DepthBits > 0,
|
osmesa->gl_visual->DepthBits > 0,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: context.c,v 1.69 2000/05/24 15:04:45 brianp Exp $ */
|
/* $Id: context.c,v 1.70 2000/05/26 14:44:59 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -467,6 +467,14 @@ alloc_shared_state( void )
|
|||||||
ss->DefaultD[d]->RefCount++; /* don't free if not in use */
|
ss->DefaultD[d]->RefCount++; /* don't free if not in use */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ss->DefaultCubeMap = gl_alloc_texture_object(ss, 0, 6);
|
||||||
|
if (!ss->DefaultCubeMap) {
|
||||||
|
outOfMemory = GL_TRUE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ss->DefaultCubeMap->RefCount++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ss->DisplayList || !ss->TexObjects || outOfMemory) {
|
if (!ss->DisplayList || !ss->TexObjects || outOfMemory) {
|
||||||
/* Ran out of memory at some point. Free everything and return NULL */
|
/* Ran out of memory at some point. Free everything and return NULL */
|
||||||
if (ss->DisplayList)
|
if (ss->DisplayList)
|
||||||
@@ -479,6 +487,8 @@ alloc_shared_state( void )
|
|||||||
gl_free_texture_object(ss, ss->DefaultD[2]);
|
gl_free_texture_object(ss, ss->DefaultD[2]);
|
||||||
if (ss->DefaultD[3])
|
if (ss->DefaultD[3])
|
||||||
gl_free_texture_object(ss, ss->DefaultD[3]);
|
gl_free_texture_object(ss, ss->DefaultD[3]);
|
||||||
|
if (ss->DefaultCubeMap)
|
||||||
|
gl_free_texture_object(ss, ss->DefaultCubeMap);
|
||||||
FREE(ss);
|
FREE(ss);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -603,6 +613,7 @@ init_texture_unit( GLcontext *ctx, GLuint unit )
|
|||||||
texUnit->CurrentD[1] = ctx->Shared->DefaultD[1];
|
texUnit->CurrentD[1] = ctx->Shared->DefaultD[1];
|
||||||
texUnit->CurrentD[2] = ctx->Shared->DefaultD[2];
|
texUnit->CurrentD[2] = ctx->Shared->DefaultD[2];
|
||||||
texUnit->CurrentD[3] = ctx->Shared->DefaultD[3];
|
texUnit->CurrentD[3] = ctx->Shared->DefaultD[3];
|
||||||
|
texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1835,7 +1846,7 @@ _mesa_get_dispatch(GLcontext *ctx)
|
|||||||
void gl_problem( const GLcontext *ctx, const char *s )
|
void gl_problem( const GLcontext *ctx, const char *s )
|
||||||
{
|
{
|
||||||
fprintf( stderr, "Mesa implementation error: %s\n", s );
|
fprintf( stderr, "Mesa implementation error: %s\n", s );
|
||||||
fprintf( stderr, "Report to mesa-bugs@mesa3d.org\n" );
|
fprintf( stderr, "Report to Mesa bug database at www.mesa3d.org\n" );
|
||||||
(void) ctx;
|
(void) ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: state.c,v 1.14 2000/05/24 15:04:45 brianp Exp $ */
|
/* $Id: state.c,v 1.15 2000/05/26 14:44:59 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -931,8 +931,7 @@ void gl_update_state( GLcontext *ctx )
|
|||||||
ctx->Enabled &= ~(ENABLE_TEXMAT0|ENABLE_TEXMAT1);
|
ctx->Enabled &= ~(ENABLE_TEXMAT0|ENABLE_TEXMAT1);
|
||||||
|
|
||||||
for (i=0; i < MAX_TEXTURE_UNITS; i++) {
|
for (i=0; i < MAX_TEXTURE_UNITS; i++) {
|
||||||
if (ctx->TextureMatrix[i].flags & MAT_DIRTY_ALL_OVER)
|
if (ctx->TextureMatrix[i].flags & MAT_DIRTY_ALL_OVER) {
|
||||||
{
|
|
||||||
gl_matrix_analyze( &ctx->TextureMatrix[i] );
|
gl_matrix_analyze( &ctx->TextureMatrix[i] );
|
||||||
ctx->TextureMatrix[i].flags &= ~MAT_DIRTY_DEPENDENTS;
|
ctx->TextureMatrix[i].flags &= ~MAT_DIRTY_DEPENDENTS;
|
||||||
|
|
||||||
@@ -959,14 +958,12 @@ void gl_update_state( GLcontext *ctx )
|
|||||||
if (ctx->Texture.Unit[i].GenFlags != 0) {
|
if (ctx->Texture.Unit[i].GenFlags != 0) {
|
||||||
ctx->Enabled |= ENABLE_TEXGEN0 << i;
|
ctx->Enabled |= ENABLE_TEXGEN0 << i;
|
||||||
|
|
||||||
if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_NORMALS)
|
if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_NORMALS) {
|
||||||
{
|
|
||||||
ctx->Texture.NeedNormals = GL_TRUE;
|
ctx->Texture.NeedNormals = GL_TRUE;
|
||||||
ctx->Texture.NeedEyeCoords = GL_TRUE;
|
ctx->Texture.NeedEyeCoords = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_EYE_COORD)
|
if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_EYE_COORD) {
|
||||||
{
|
|
||||||
ctx->Texture.NeedEyeCoords = GL_TRUE;
|
ctx->Texture.NeedEyeCoords = GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -472,7 +472,7 @@ set_tex_image(struct gl_texture_object *tObj,
|
|||||||
tObj->Image[level] = texImage;
|
tObj->Image[level] = texImage;
|
||||||
return;
|
return;
|
||||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
|
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
|
||||||
tObj->PosX[level] = texImage;
|
tObj->Image[level] = texImage;
|
||||||
return;
|
return;
|
||||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
|
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
|
||||||
tObj->NegX[level] = texImage;
|
tObj->NegX[level] = texImage;
|
||||||
@@ -630,7 +630,7 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit,
|
|||||||
return ctx->Texture.Proxy3D->Image[level];
|
return ctx->Texture.Proxy3D->Image[level];
|
||||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
|
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
|
||||||
if (ctx->Extensions.HaveTextureCubeMap)
|
if (ctx->Extensions.HaveTextureCubeMap)
|
||||||
return texUnit->CurrentCubeMap->PosX[level];
|
return texUnit->CurrentCubeMap->Image[level];
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
|
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
|
||||||
@@ -660,7 +660,7 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit,
|
|||||||
return NULL;
|
return NULL;
|
||||||
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
|
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
|
||||||
if (ctx->Extensions.HaveTextureCubeMap)
|
if (ctx->Extensions.HaveTextureCubeMap)
|
||||||
return ctx->Texture.ProxyCubeMap->PosX[level];
|
return ctx->Texture.ProxyCubeMap->Image[level];
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
default:
|
default:
|
||||||
@@ -903,7 +903,10 @@ texture_error_check( GLcontext *ctx, GLenum target,
|
|||||||
}
|
}
|
||||||
else if (dimensions == 2) {
|
else if (dimensions == 2) {
|
||||||
isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_2D);
|
isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_2D);
|
||||||
if (target != GL_TEXTURE_2D && !isProxy) {
|
if (target != GL_TEXTURE_2D && !isProxy &&
|
||||||
|
!(ctx->Extensions.HaveTextureCubeMap &&
|
||||||
|
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
|
||||||
|
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
|
||||||
gl_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" );
|
gl_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" );
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -306,6 +306,10 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
|
|||||||
return; /* found smallest needed mipmap, all done! */
|
return; /* found smallest needed mipmap, all done! */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (t->Dimensions == 6) { /* cube map */
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Dimensions = ??? */
|
/* Dimensions = ??? */
|
||||||
|
Reference in New Issue
Block a user