Added support for releasing GLObjects, and renamed DisplayListVisitor the

GLObjectVisitor to better fit its function, and added support for releasing
objects as well as compiling them.
This commit is contained in:
Robert Osfield
2004-07-20 05:37:59 +00:00
parent 12a315ec1d
commit aa833acfd3
21 changed files with 214 additions and 73 deletions

View File

@@ -199,7 +199,7 @@ void Drawable::dirtyBound()
}
}
void Drawable::compile(State& state) const
void Drawable::compileGLObjects(State& state) const
{
if (!_useDisplayList) return;
@@ -216,12 +216,6 @@ void Drawable::compile(State& state) const
glDeleteLists( globj, 1 );
}
if (_stateset.valid())
{
_stateset->compile(state);
}
globj = glGenLists( 1 );
glNewList( globj, GL_COMPILE );
@@ -234,6 +228,32 @@ void Drawable::compile(State& state) const
}
void Drawable::releaseGLObjects(State* state) const
{
if (!_useDisplayList) return;
if (state)
{
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
unsigned int contextID = state->getContextID();
// get the globj for the current contextID.
GLuint& globj = _globjList[contextID];
// call the globj if already set otherwise comple and execute.
if( globj != 0 )
{
glDeleteLists( globj, 1 );
globj = 0;
}
}
else
{
const_cast<Drawable*>(this)->dirtyDisplayList();
}
}
void Drawable::setSupportsDisplayList(bool flag)
{
// if value unchanged simply return.