GLObjects
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_GLOBJECTS
#define OSG_GLOBJECTS 1
#include <osg/Referenced>
#include <osg/GL>
#include <list>
#include <string>
namespace osg {
// forward declare
class FrameStamp;
extern OSG_EXPORT void flushDeletedGLObjects(unsigned int contextID, double currentTime, double& availableTime);
extern OSG_EXPORT void flushAllDeletedGLObjects(unsigned int contextID);
extern OSG_EXPORT void deleteAllGLObjects(unsigned int contextID);
extern OSG_EXPORT void discardAllGLObjects(unsigned int contextID);
class OSG_EXPORT GraphicsObject : public osg::Referenced
{
public:
GraphicsObject();
protected:
virtual ~GraphicsObject();
};
class OSG_EXPORT GraphicsObjectManager : public osg::Referenced
{
public:
GraphicsObjectManager(const std::string& name, unsigned int contextID);
unsigned int getContextID() const { return _contextID; }
virtual void newFrame(osg::FrameStamp* /*fs*/) {}
virtual void resetStats() {}
virtual void reportStats(std::ostream& /*out*/) {}
virtual void recomputeStats(std::ostream& /*out*/) const {}
virtual void flushDeletedGLObjects(double currentTime, double& availableTime) = 0;
virtual void flushAllDeletedGLObjects() = 0;
virtual void deleteAllGLObjects() = 0;
virtual void discardAllGLObjects() = 0;
protected:
virtual ~GraphicsObjectManager();
std::string _name;
unsigned int _contextID;
};
class OSG_EXPORT GLObjectManager : public GraphicsObjectManager
{
public:
GLObjectManager(const std::string& name, unsigned int contextID);
virtual void flushDeletedGLObjects(double currentTime, double& availableTime);
virtual void flushAllDeletedGLObjects();
virtual void deleteAllGLObjects();
virtual void discardAllGLObjects();
virtual void scheduleGLObjectForDeletion(GLuint globj);
virtual GLuint createGLObject();
virtual void deleteGLObject(GLuint globj) = 0;
protected:
virtual ~GLObjectManager();
typedef std::list<GLuint> GLObjectHandleList;
OpenThreads::Mutex _mutex;
GLObjectHandleList _deleteGLObjectHandles;
};
}
#endif
Referenced
OpenThreads::Mutex
This class provides an object-oriented thread mutex interface.
Definition Mutex:31
osg::FrameStamp
Definition FrameStamp:35
osg::GLObjectManager::_mutex
OpenThreads::Mutex _mutex
Definition GLObjects:124
osg::GLObjectManager::discardAllGLObjects
virtual void discardAllGLObjects()
osg::GLObjectManager::GLObjectHandleList
std::list< GLuint > GLObjectHandleList
Definition GLObjects:123
osg::GLObjectManager::GLObjectManager
GLObjectManager(const std::string &name, unsigned int contextID)
osg::GLObjectManager::flushDeletedGLObjects
virtual void flushDeletedGLObjects(double currentTime, double &availableTime)
osg::GLObjectManager::deleteGLObject
virtual void deleteGLObject(GLuint globj)=0
osg::GLObjectManager::_deleteGLObjectHandles
GLObjectHandleList _deleteGLObjectHandles
Definition GLObjects:125
osg::GLObjectManager::deleteAllGLObjects
virtual void deleteAllGLObjects()
osg::GLObjectManager::flushAllDeletedGLObjects
virtual void flushAllDeletedGLObjects()
osg::GLObjectManager::createGLObject
virtual GLuint createGLObject()
osg::GLObjectManager::scheduleGLObjectForDeletion
virtual void scheduleGLObjectForDeletion(GLuint globj)
osg::GLObjectManager::~GLObjectManager
virtual ~GLObjectManager()
osg::GraphicsObjectManager::recomputeStats
virtual void recomputeStats(std::ostream &) const
Definition GLObjects:68
osg::GraphicsObjectManager::newFrame
virtual void newFrame(osg::FrameStamp *)
Definition GLObjects:64
osg::GraphicsObjectManager::getContextID
unsigned int getContextID() const
Definition GLObjects:61
osg::GraphicsObjectManager::flushAllDeletedGLObjects
virtual void flushAllDeletedGLObjects()=0
osg::GraphicsObjectManager::flushDeletedGLObjects
virtual void flushDeletedGLObjects(double currentTime, double &availableTime)=0
osg::GraphicsObjectManager::reportStats
virtual void reportStats(std::ostream &)
Definition GLObjects:67
osg::GraphicsObjectManager::_contextID
unsigned int _contextID
Definition GLObjects:94
osg::GraphicsObjectManager::~GraphicsObjectManager
virtual ~GraphicsObjectManager()
osg::GraphicsObjectManager::deleteAllGLObjects
virtual void deleteAllGLObjects()=0
osg::GraphicsObjectManager::discardAllGLObjects
virtual void discardAllGLObjects()=0
osg::GraphicsObjectManager::GraphicsObjectManager
GraphicsObjectManager(const std::string &name, unsigned int contextID)
osg::GraphicsObjectManager::resetStats
virtual void resetStats()
Definition GLObjects:66
osg::GraphicsObjectManager::_name
std::string _name
Definition GLObjects:93
osg::GraphicsObject::~GraphicsObject
virtual ~GraphicsObject()
osg::GraphicsObject::GraphicsObject
GraphicsObject()
osg::Referenced
Definition Referenced:44
osg
Definition AlphaFunc:19
osg::flushDeletedGLObjects
OSG_EXPORT void flushDeletedGLObjects(unsigned int contextID, double currentTime, double &availableTime)
osg::flushAllDeletedGLObjects
OSG_EXPORT void flushAllDeletedGLObjects(unsigned int contextID)
osg::discardAllGLObjects
OSG_EXPORT void discardAllGLObjects(unsigned int contextID)
osg::deleteAllGLObjects
OSG_EXPORT void deleteAllGLObjects(unsigned int contextID)
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39