14#ifndef OSG_CONTEXTDATA
15#define OSG_CONTEXTDATA 1
40 const std::type_info* id(&
typeid(T));
46 return static_cast<T*
>(ptr.
get());
55 const std::type_info* id(&
typeid(T));
56 ManagerMap::const_iterator itr =
_managerMap.find(
id);
58 else return itr->second.get();
65 const std::type_info* id(&
typeid(T));
140 typedef std::map<const std::type_info*, osg::ref_ptr<osg::Referenced> >
ManagerMap;
152inline T*
get(
unsigned int contextID)
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
ContextData * get< ContextData >(unsigned int contextID)
Definition ContextData:159
OSG_EXPORT ContextData * getContextData(unsigned int contextID)
Get the ContextData for a specific contextID.
OSG_EXPORT ContextData * getOrCreateContextData(unsigned int contextID)
Get or create the ContextData for a specific contextID.
T * get(unsigned int contextID)
Definition ContextData:152
Definition ContextData:22
virtual void reportStats(std::ostream &out)
void setNumContexts(unsigned int numContexts)
Definition ContextData:29
unsigned int getNumContexts() const
Definition ContextData:30
static void decrementContextIDUsageCount(unsigned int contextID)
Decrement the usage count associate with a contextID.
void set(T *ptr)
Set a specific GL extensions object pr GraphicsObjectManager.
Definition ContextData:63
unsigned int _numContexts
Definition ContextData:136
virtual void deleteAllGLObjects()
Do a GL delete all OpenGL objects.
virtual void resetStats()
virtual void flushAllDeletedGLObjects()
Flush all deleted OpenGL objects.
virtual void recomputeStats(std::ostream &out) const
static void incrementContextIDUsageCount(unsigned int contextID)
Increment the usage count associate with a contextID.
static GraphicsContext * getCompileContext(unsigned int contextID)
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specifi...
std::map< const std::type_info *, osg::ref_ptr< osg::Referenced > > ManagerMap
Definition ContextData:140
const T * get() const
Get a specific GL extensions object or GraphicsObjectManager if it already exists in the extension ma...
Definition ContextData:53
virtual void discardAllGLObjects()
Discard all OpenGL objects.
osg::GraphicsContext * getCompileContext()
Definition ContextData:33
static void registerGraphicsContext(GraphicsContext *gc)
Register a GraphicsContext.
virtual void newFrame(osg::FrameStamp *)
Signal that a new frame has started.
virtual void flushDeletedGLObjects(double currentTime, double &availableTime)
Flush all deleted OpenGL objects within the specified availableTime.
ManagerMap _managerMap
Definition ContextData:141
osg::ref_ptr< osg::GraphicsContext > _compileContext
Definition ContextData:137
void setCompileContext(osg::GraphicsContext *gc)
Definition ContextData:32
static GraphicsContexts getAllRegisteredGraphicsContexts()
Get all the registered graphics contexts.
static void unregisterGraphicsContext(GraphicsContext *gc)
Unregister a GraphicsContext.
void decrementUsageCount()
Definition ContextData:27
static unsigned int createNewContextID()
Create a contextID for a new graphics context, this contextID is used to set up the osg::State associ...
static GraphicsContexts getRegisteredGraphicsContexts(unsigned int contextID)
Get all the registered graphics contexts associated with a specific contextID.
static unsigned int getMaxContextID()
Get the current max ContextID.
ContextData(unsigned int contextID)
T * get()
Get a specific GL extensions object or GraphicsObjectManager, initialize if not already present.
Definition ContextData:38
GraphicsContext::GraphicsContexts GraphicsContexts
Definition ContextData:110
static void setCompileContext(unsigned int contextID, GraphicsContext *gc)
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specifi...
static GraphicsContext * getOrCreateCompileContext(unsigned int contextID)
Get existing or create a new GraphicsContext to do background compilation for GraphicsContexts associ...
void incrementUsageCount()
Definition ContextData:26
Class which encapsulates the frame number, reference time and calendar time of specific frame,...
Definition FrameStamp:35
unsigned int _contextID
Definition GLObjects:94
GraphicsObjectManager(const std::string &name, unsigned int contextID)
Base class for providing Windowing API agnostic access to creating and managing graphics context.
Definition GraphicsContext:30
std::vector< GraphicsContext * > GraphicsContexts
Definition GraphicsContext:272
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
#define OSG_EXPORT
Definition Export:39