more work on GL_ARB_texture_cube_map
This commit is contained in:
parent
2c3a620133
commit
413d6a21f8
|
@ -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
|
||||
|
@ -226,6 +226,7 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
|||
return NULL;
|
||||
}
|
||||
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_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
|
||||
|
@ -467,6 +467,14 @@ alloc_shared_state( void )
|
|||
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) {
|
||||
/* Ran out of memory at some point. Free everything and return NULL */
|
||||
if (ss->DisplayList)
|
||||
|
@ -479,6 +487,8 @@ alloc_shared_state( void )
|
|||
gl_free_texture_object(ss, ss->DefaultD[2]);
|
||||
if (ss->DefaultD[3])
|
||||
gl_free_texture_object(ss, ss->DefaultD[3]);
|
||||
if (ss->DefaultCubeMap)
|
||||
gl_free_texture_object(ss, ss->DefaultCubeMap);
|
||||
FREE(ss);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -603,6 +613,7 @@ init_texture_unit( GLcontext *ctx, GLuint unit )
|
|||
texUnit->CurrentD[1] = ctx->Shared->DefaultD[1];
|
||||
texUnit->CurrentD[2] = ctx->Shared->DefaultD[2];
|
||||
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 )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -931,8 +931,7 @@ void gl_update_state( GLcontext *ctx )
|
|||
ctx->Enabled &= ~(ENABLE_TEXMAT0|ENABLE_TEXMAT1);
|
||||
|
||||
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] );
|
||||
ctx->TextureMatrix[i].flags &= ~MAT_DIRTY_DEPENDENTS;
|
||||
|
||||
|
@ -946,7 +945,7 @@ void gl_update_state( GLcontext *ctx )
|
|||
if (ctx->NewState & (NEW_TEXTURING | NEW_TEXTURE_ENABLE)) {
|
||||
ctx->Texture.NeedNormals = GL_FALSE;
|
||||
gl_update_dirty_texobjs(ctx);
|
||||
ctx->Enabled &= ~(ENABLE_TEXGEN0|ENABLE_TEXGEN1);
|
||||
ctx->Enabled &= ~(ENABLE_TEXGEN0 | ENABLE_TEXGEN1);
|
||||
ctx->Texture.ReallyEnabled = 0;
|
||||
|
||||
for (i=0; i < MAX_TEXTURE_UNITS; i++) {
|
||||
|
@ -954,19 +953,17 @@ void gl_update_state( GLcontext *ctx )
|
|||
gl_update_texture_unit( ctx, &ctx->Texture.Unit[i] );
|
||||
|
||||
ctx->Texture.ReallyEnabled |=
|
||||
ctx->Texture.Unit[i].ReallyEnabled<<(i*4);
|
||||
ctx->Texture.Unit[i].ReallyEnabled << (i * 4);
|
||||
|
||||
if (ctx->Texture.Unit[i].GenFlags != 0) {
|
||||
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.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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -472,7 +472,7 @@ set_tex_image(struct gl_texture_object *tObj,
|
|||
tObj->Image[level] = texImage;
|
||||
return;
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
|
||||
tObj->PosX[level] = texImage;
|
||||
tObj->Image[level] = texImage;
|
||||
return;
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
|
||||
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];
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
|
||||
if (ctx->Extensions.HaveTextureCubeMap)
|
||||
return texUnit->CurrentCubeMap->PosX[level];
|
||||
return texUnit->CurrentCubeMap->Image[level];
|
||||
else
|
||||
return NULL;
|
||||
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;
|
||||
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
|
||||
if (ctx->Extensions.HaveTextureCubeMap)
|
||||
return ctx->Texture.ProxyCubeMap->PosX[level];
|
||||
return ctx->Texture.ProxyCubeMap->Image[level];
|
||||
else
|
||||
return NULL;
|
||||
default:
|
||||
|
@ -903,7 +903,10 @@ texture_error_check( GLcontext *ctx, GLenum target,
|
|||
}
|
||||
else if (dimensions == 2) {
|
||||
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)" );
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
|
|
@ -306,6 +306,10 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
|
|||
return; /* found smallest needed mipmap, all done! */
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t->Dimensions == 6) { /* cube map */
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
/* Dimensions = ??? */
|
||||
|
|
Loading…
Reference in New Issue