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:
@@ -254,8 +254,11 @@ class SG_EXPORT Drawable : public Object
|
||||
/** Immediately compile this drawable into an OpenGL Display List.
|
||||
Note I, operation is ignored if _useDisplayList to false.
|
||||
Note II, compile is not intended to be overridden in subclasses.*/
|
||||
virtual void compile(State& state) const;
|
||||
virtual void compileGLObjects(State& state) const;
|
||||
|
||||
/** release any OpenGL display lists associated with graphics context specified
|
||||
in osg::State object is supplied, or release all display lists for all graphics contexts if state pointer is NULL*/
|
||||
virtual void releaseGLObjects(State* state=0) const;
|
||||
|
||||
struct UpdateCallback : public virtual osg::Object
|
||||
{
|
||||
|
||||
@@ -201,7 +201,12 @@ class SG_EXPORT FragmentProgram : public StateAttribute
|
||||
|
||||
virtual void apply(State& state) const;
|
||||
|
||||
virtual void compile(State& state) const { apply(state); }
|
||||
virtual void compileGLObjects(State& state) const { apply(state); }
|
||||
|
||||
/** release an OpenGL objects in specified graphics context if State
|
||||
object is passed, otherwise release OpenGL objexts for all graphics context if
|
||||
State object pointer NULL.*/
|
||||
virtual void releaseGLObjects(State* state=0) const;
|
||||
|
||||
/** Extensions class which encapsulates the querring of extensions and
|
||||
* associated function pointers, and provide convinience wrappers to
|
||||
|
||||
@@ -229,7 +229,13 @@ class SG_EXPORT StateAttribute : public Object
|
||||
virtual void apply(State&) const = 0;
|
||||
|
||||
/** default to nothing to compile - all state is applied immediately. */
|
||||
virtual void compile(State&) const {}
|
||||
virtual void compileGLObjects(State&) const {}
|
||||
|
||||
/** release an OpenGL objects in specified graphics context if State
|
||||
object is passed, otherwise release OpenGL objexts for all graphics context if
|
||||
State object pointer NULL.*/
|
||||
virtual void releaseGLObjects(State* =0) const {}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -221,7 +221,10 @@ class SG_EXPORT StateSet : public Object
|
||||
|
||||
|
||||
/** call compile on all StateAttributes contained within this StateSet.*/
|
||||
void compile(State& state) const;
|
||||
void compileGLObjects(State& state) const;
|
||||
|
||||
/** call release on all StateAttributes contained within this StateSet.*/
|
||||
virtual void releaseGLObjects(State* state=0) const;
|
||||
|
||||
protected :
|
||||
|
||||
|
||||
@@ -319,7 +319,12 @@ class SG_EXPORT Texture : public osg::StateAttribute
|
||||
virtual void apply(State& state) const = 0;
|
||||
|
||||
/** Calls apply(state) to compile the texture. */
|
||||
virtual void compile(State& state) const;
|
||||
virtual void compileGLObjects(State& state) const;
|
||||
|
||||
/** release an OpenGL objects in specified graphics context if State
|
||||
object is passed, otherwise release OpenGL objexts for all graphics context if
|
||||
State object pointer NULL.*/
|
||||
virtual void releaseGLObjects(State* state=0) const;
|
||||
|
||||
/** Extensions class which encapsulates the querring of extensions and
|
||||
* associated function pointers, and provide convinience wrappers to
|
||||
|
||||
@@ -193,7 +193,12 @@ class SG_EXPORT VertexProgram : public StateAttribute
|
||||
|
||||
virtual void apply(State& state) const;
|
||||
|
||||
virtual void compile(State& state) const { apply(state); }
|
||||
virtual void compileGLObjects(State& state) const { apply(state); }
|
||||
|
||||
/** release an OpenGL objects in specified graphics context if State
|
||||
object is passed, otherwise release OpenGL objexts for all graphics context if
|
||||
State object pointer NULL.*/
|
||||
virtual void releaseGLObjects(State* state=0) const;
|
||||
|
||||
/** Extensions class which encapsulates the querring of extensions and
|
||||
* associated function pointers, and provide convinience wrappers to
|
||||
|
||||
Reference in New Issue
Block a user