Added Object::resizeGLObjectBuffers(uint) method to help improve the ability
to change the number of active graphics contexts on the fly during an applications life.
This commit is contained in:
@@ -352,6 +352,9 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
|
||||
|
||||
OpenThreads::Mutex* getDataChangeMutex() const { return &_dataChangeMutex; }
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objexts
|
||||
* for all graphics contexts. */
|
||||
|
||||
@@ -278,6 +278,9 @@ class OSG_EXPORT Drawable : public Object
|
||||
*/
|
||||
virtual void compileGLObjects(RenderInfo& renderInfo) const;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objexts
|
||||
* for all graphics contexts. */
|
||||
|
||||
@@ -220,6 +220,9 @@ class OSG_EXPORT FragmentProgram : public StateAttribute
|
||||
|
||||
virtual void compileGLObjects(State& state) const { apply(state); }
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** 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.*/
|
||||
|
||||
@@ -138,6 +138,9 @@ class OSG_EXPORT Geode : public Node
|
||||
|
||||
virtual BoundingSphere computeBound() const;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objexts
|
||||
* for all graphics contexts. */
|
||||
|
||||
@@ -142,6 +142,9 @@ class OSG_EXPORT Group : public Node
|
||||
return _children.size(); // node not found.
|
||||
}
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objexts
|
||||
* for all graphics contexts. */
|
||||
|
||||
@@ -299,6 +299,8 @@ class OSG_EXPORT Node : public Object
|
||||
/** Get the const compute bound callback.*/
|
||||
const ComputeBoundingSphereCallback* getComputeBoundingSphereCallback() const { return _computeBoundCallback.get(); }
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objexts
|
||||
|
||||
@@ -118,6 +118,8 @@ class OSG_EXPORT Object : public Referenced
|
||||
/** Get const user data.*/
|
||||
inline const Referenced* getUserData() const { return _userData.get(); }
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objexts
|
||||
|
||||
@@ -242,6 +242,9 @@ class OSG_EXPORT PrimitiveSet : public Object
|
||||
/** Get modified count value.*/
|
||||
inline unsigned int getModifiedCount() const { return _modifiedCount; }
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
|
||||
|
||||
/** If State is non-zero, this function releases OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objexts
|
||||
* for all graphics contexts. */
|
||||
@@ -437,6 +440,9 @@ class OSG_EXPORT DrawElementsUByte : public PrimitiveSet, public VectorGLubyte
|
||||
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
|
||||
virtual void offsetIndices(int offset);
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
virtual void releaseGLObjects(State* state=0) const;
|
||||
|
||||
virtual void computeRange() const
|
||||
@@ -517,6 +523,9 @@ class OSG_EXPORT DrawElementsUShort : public PrimitiveSet, public VectorGLushort
|
||||
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
|
||||
virtual void offsetIndices(int offset);
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
virtual void releaseGLObjects(State* state=0) const;
|
||||
|
||||
virtual void computeRange() const
|
||||
@@ -595,6 +604,9 @@ class OSG_EXPORT DrawElementsUInt : public PrimitiveSet, public VectorGLuint
|
||||
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
|
||||
virtual void offsetIndices(int offset);
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
virtual void releaseGLObjects(State* state=0) const;
|
||||
|
||||
virtual void computeRange() const
|
||||
|
||||
@@ -63,6 +63,9 @@ class OSG_EXPORT Program : public osg::StateAttribute
|
||||
|
||||
virtual void compileGLObjects(osg::State& state) const;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** release OpenGL objects in specified graphics context if State
|
||||
object is passed, otherwise release OpenGL objects for all graphics context if
|
||||
State object pointer NULL.*/
|
||||
|
||||
@@ -81,6 +81,9 @@ class OSG_EXPORT Shader : public osg::Object
|
||||
/** Get the Shader type as a descriptive string. */
|
||||
const char* getTypename() const;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** release OpenGL objects in specified graphics context if State
|
||||
object is passed, otherwise release OpenGL objects for all graphics context if
|
||||
State object pointer NULL.*/
|
||||
|
||||
@@ -312,10 +312,13 @@ class OSG_EXPORT StateAttribute : public Object
|
||||
*/
|
||||
virtual void apply(State&) const {}
|
||||
|
||||
/** default to nothing to compile - all state is applied immediately. */
|
||||
/** Default to nothing to compile - all state is applied immediately. */
|
||||
virtual void compileGLObjects(State&) const {}
|
||||
|
||||
/** release OpenGL objects in specified graphics context if State
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
|
||||
|
||||
/** Release 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 {}
|
||||
|
||||
@@ -417,6 +417,9 @@ class OSG_EXPORT StateSet : public Object
|
||||
/** call compile on all StateAttributes contained within this StateSet.*/
|
||||
void compileGLObjects(State& state) const;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** call release on all StateAttributes contained within this StateSet.*/
|
||||
virtual void releaseGLObjects(State* state=0) const;
|
||||
|
||||
|
||||
@@ -451,6 +451,9 @@ class OSG_EXPORT Texture : public osg::StateAttribute
|
||||
/** Calls apply(state) to compile the texture. */
|
||||
virtual void compileGLObjects(State& state) const;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objexts
|
||||
* for all graphics contexts. */
|
||||
|
||||
@@ -221,6 +221,9 @@ class OSG_EXPORT VertexProgram : public StateAttribute
|
||||
|
||||
virtual void compileGLObjects(State& state) const { apply(state); }
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** Release any OpenGL objects in specified graphics context if State
|
||||
* object is passed, otherwise release OpenGL objexts for all graphics contexts if
|
||||
* State object pointer is NULL.
|
||||
|
||||
@@ -48,6 +48,8 @@ class buffered_value
|
||||
inline bool empty() const { return _array.empty(); }
|
||||
|
||||
inline unsigned int size() const { return _array.size(); }
|
||||
|
||||
inline void resize(unsigned int newSize) { _array.resize(newSize,0); }
|
||||
|
||||
inline T& operator[] (unsigned int pos)
|
||||
{
|
||||
@@ -99,6 +101,8 @@ class buffered_object
|
||||
|
||||
inline unsigned int size() const { return _array.size(); }
|
||||
|
||||
inline void resize(unsigned int newSize) { _array.resize(newSize); }
|
||||
|
||||
inline T& operator[] (unsigned int pos)
|
||||
{
|
||||
// automatically resize array.
|
||||
|
||||
Reference in New Issue
Block a user