Added support for setting the maximum number of graphics contexts that the

OSG has to maintian.
This commit is contained in:
Robert Osfield
2002-02-28 00:11:31 +00:00
parent 384b23ea62
commit 2973ca0a25
8 changed files with 81 additions and 24 deletions

View File

@@ -19,6 +19,10 @@ class SG_EXPORT DisplaySettings : public osg::Referenced
public:
/** Maintain a DisplaySettings singleton for objects to querry at runtime.*/
static DisplaySettings* instance();
DisplaySettings()
{
setDefaults();
@@ -36,7 +40,10 @@ class SG_EXPORT DisplaySettings : public osg::Referenced
virtual ~DisplaySettings();
DisplaySettings& operator = (const DisplaySettings& vs);
void merge(const DisplaySettings& vs);
@@ -95,6 +102,11 @@ class SG_EXPORT DisplaySettings : public osg::Referenced
const unsigned int getMinimumNumStencilBits() const { return _minimumNumberStencilBits; }
const bool getStencilBuffer() const { return _minimumNumberStencilBits!=0; }
void setMaxNumberOfGraphicsContexts(const int num) { _maxNumOfGraphicsContexts = num; }
const int getMaxNumberOfGraphicsContexts() const { return _maxNumOfGraphicsContexts; }
protected:
void copy(const DisplaySettings& vs);
@@ -111,6 +123,7 @@ class SG_EXPORT DisplaySettings : public osg::Referenced
unsigned int _minimumNumberAlphaBits;
unsigned int _minimumNumberStencilBits;
int _maxNumOfGraphicsContexts;
};

View File

@@ -248,13 +248,23 @@ class SG_EXPORT Texture : public StateAttribute
inline GLuint& getHandle(const uint contextID) const
{
// pad out handle list if required.
while (_handleList.size()<=contextID)
_handleList.push_back(0);
if (_handleList.size()<=contextID)
_handleList.resize(contextID,0);
// get the globj for the current contextID.
return _handleList[contextID];
}
inline uint& getModifiedTag(const uint contextID) const
{
// pad out handle list if required.
if (_modifiedTag.size()<=contextID)
_modifiedTag.resize(contextID,0);
// get the modified tag for the current contextID.
return _modifiedTag[contextID];
}
/** Force a recompile on next apply() of associated OpenGL texture objects.*/
void dirtyTextureObject();

View File

@@ -120,16 +120,16 @@ class SG_EXPORT Transform : public Group
/** Set the transform's matrix.*/
void setMatrix(const Matrix& mat) { (*_matrix) = mat; _inverseDirty=true; dirtyBound(); }
void setMatrix(const Matrix& mat) { (*_matrix) = mat; _inverseDirty=true; computeInverse(); dirtyBound(); }
/** Get the transform's matrix. */
inline const Matrix& getMatrix() const { return *_matrix; }
/** preMult transform.*/
void preMult(const Matrix& mat) { _matrix->preMult(mat); _inverseDirty=true; dirtyBound(); }
void preMult(const Matrix& mat) { _matrix->preMult(mat); _inverseDirty=true; computeInverse(); dirtyBound(); }
/** postMult transform.*/
void postMult(const Matrix& mat) { _matrix->postMult(mat); _inverseDirty=true; dirtyBound(); }
void postMult(const Matrix& mat) { _matrix->postMult(mat); _inverseDirty=true; computeInverse(); dirtyBound(); }
protected :

View File

@@ -34,10 +34,10 @@ class OSGDB_EXPORT Registry
{
public:
~Registry();
static Registry* instance();
~Registry();
/** read the command line string list, removing any matched control sequences.*/
void readCommandLine(std::vector<std::string>& commandLine);