Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

osg::GraphicsContext Class Reference

Base class for providing Windowing API agnostic access to creating and managing graphics context. More...

Inheritance diagram for osg::GraphicsContext:

Inheritance graph
[legend]
List of all members.

Public Member Functions

const TraitsgetTraits () const
 Get the traits of the GraphicsContext.

void setState (State *state)
 Set the State object which tracks the current OpenGL state for this graphics context.

StategetState ()
 Get the State object which tracks the current OpenGL state for this graphics context.

const StategetState () const
 Get the const State object which tracks the current OpenGL state for this graphics context.

bool realize ()
 Realise the GraphicsContext.

void close (bool callCloseImplementation=true)
 close the graphics context.

void swapBuffers ()
 swap the front and back buffers.

bool isRealized () const
 Return true if the graphics context has been realised and is ready to use.

void makeCurrent ()
 Make this graphics context current.

void makeContextCurrent (GraphicsContext *readContext)
 Make this graphics context current with specified read context.

void releaseContext ()
 Release the graphics context by unlocking the GraphicsContext mutex.

bool isCurrent () const
 Return true if the current thread has this OpenGL graphics context.

void bindPBufferToTexture (GLenum buffer)
 Bind the graphics context to associated texture.

void createGraphicsThread ()
 Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations.

void setGraphicsThread (GraphicsThread *gt)
 Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations.

GraphicsThreadgetGraphicsThread ()
 Get the graphics thread assigned the graphics context.

const GraphicsThreadgetGraphicsThread () const
 Get the const graphics thread assigned the graphics context.

virtual bool realizeImplementation ()=0
 Realise the GraphicsContext implementation, Pure virtual - must be implemented by concrate implementations of GraphicsContext.

virtual bool isRealizedImplementation () const=0
 Return true if the graphics context has been realised, and is ready to use, implementation.

virtual void closeImplementation ()=0
 Close the graphics context implementation.

virtual void makeCurrentImplementation ()=0
 Make this graphics context current implementation.

virtual void makeContextCurrentImplementation (GraphicsContext *readContext)=0
 Make this graphics context current with specified read context implementation.

virtual void bindPBufferToTextureImplementation (GLenum buffer)=0
 Pure virtual, Bind the graphics context to associated texture implementation.

virtual void swapBuffersImplementation ()=0
 Swap the front and back buffers implementation.


Static Public Member Functions

void setCreateGraphicsContextCallback (CreateGraphicContextCallback *callback)
 Set the create graphics context callback - this callback should be supplied by the windows toolkit.

CreateGraphicContextCallbackgetCreateGraphicsContextCallback ()
 Get the create graphics context callback.

GraphicsContextcreateGraphicsContext (Traits *traits)
 Create a graphics context for a specified set of traits.

unsigned int createNewContextID ()
 Create a contextID for a new graphics context, this contextID is used to set up the osg::State associate with context.

void incrementContextIDUsageCount (unsigned int contextID)
 Increment the usage count associate with a contextID.

void decrementContextIDUsageCount (unsigned int contextID)
 Decrement the usage count associate with a contextID.


Protected Member Functions

 GraphicsContext ()
virtual ~GraphicsContext ()

Protected Attributes

ref_ptr< Traits_traits
ref_ptr< State_state
OpenThreads::Mutex _mutex
OpenThreads::Thread * _threadOfLastMakeCurrent
ref_ptr< GraphicsThread_graphicsThread

Detailed Description

Base class for providing Windowing API agnostic access to creating and managing graphics context.


Constructor & Destructor Documentation

osg::GraphicsContext::GraphicsContext  )  [protected]
 

virtual osg::GraphicsContext::~GraphicsContext  )  [protected, virtual]
 


Member Function Documentation

void osg::GraphicsContext::bindPBufferToTexture GLenum  buffer  )  [inline]
 

Bind the graphics context to associated texture.

virtual void osg::GraphicsContext::bindPBufferToTextureImplementation GLenum  buffer  )  [pure virtual]
 

Pure virtual, Bind the graphics context to associated texture implementation.

Pure virtual - must be implemented by concrate implementations of GraphicsContext.

Implemented in osgProducer::GraphicsContextImplementation.

void osg::GraphicsContext::close bool  callCloseImplementation = true  ) 
 

close the graphics context.

close(bool) stops any associated graphics threads, releases the contextID for the GraphicsContext then optional calls closeImplementation() to do the actual deletion of the graphics. This call is made optional as there are times when the graphics context has already been deleted externally and only the OSG side of the its data need to be closed down.

virtual void osg::GraphicsContext::closeImplementation  )  [pure virtual]
 

Close the graphics context implementation.

Pure virtual - must be implemented by concrate implementations of GraphicsContext.

Implemented in osgProducer::GraphicsContextImplementation.

GraphicsContext* osg::GraphicsContext::createGraphicsContext Traits traits  )  [static]
 

Create a graphics context for a specified set of traits.

void osg::GraphicsContext::createGraphicsThread  ) 
 

Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations.

unsigned int osg::GraphicsContext::createNewContextID  )  [static]
 

Create a contextID for a new graphics context, this contextID is used to set up the osg::State associate with context.

Automatically increments the usage count of the contextID to 1.

void osg::GraphicsContext::decrementContextIDUsageCount unsigned int  contextID  )  [static]
 

Decrement the usage count associate with a contextID.

Once the contextID goes to 0 the contextID is then free to be reused.

CreateGraphicContextCallback* osg::GraphicsContext::getCreateGraphicsContextCallback  )  [static]
 

Get the create graphics context callback.

const GraphicsThread* osg::GraphicsContext::getGraphicsThread  )  const [inline]
 

Get the const graphics thread assigned the graphics context.

GraphicsThread* osg::GraphicsContext::getGraphicsThread  )  [inline]
 

Get the graphics thread assigned the graphics context.

const State* osg::GraphicsContext::getState  )  const [inline]
 

Get the const State object which tracks the current OpenGL state for this graphics context.

State* osg::GraphicsContext::getState  )  [inline]
 

Get the State object which tracks the current OpenGL state for this graphics context.

const Traits* osg::GraphicsContext::getTraits  )  const [inline]
 

Get the traits of the GraphicsContext.

void osg::GraphicsContext::incrementContextIDUsageCount unsigned int  contextID  )  [static]
 

Increment the usage count associate with a contextID.

The usage count speficies how many graphics contexts a specific contextID is shared between.

bool osg::GraphicsContext::isCurrent  )  const [inline]
 

Return true if the current thread has this OpenGL graphics context.

bool osg::GraphicsContext::isRealized  )  const [inline]
 

Return true if the graphics context has been realised and is ready to use.

virtual bool osg::GraphicsContext::isRealizedImplementation  )  const [pure virtual]
 

Return true if the graphics context has been realised, and is ready to use, implementation.

Pure virtual - must be implemented by concrate implementations of GraphicsContext.

Implemented in osgProducer::GraphicsContextImplementation.

void osg::GraphicsContext::makeContextCurrent GraphicsContext readContext  ) 
 

Make this graphics context current with specified read context.

Implementated by first aquiring a lock of the GraphicsContext mutex, and then doing a call to makeContextCurrentImplementation().

virtual void osg::GraphicsContext::makeContextCurrentImplementation GraphicsContext readContext  )  [pure virtual]
 

Make this graphics context current with specified read context implementation.

Pure virtual - must be implemented by concrate implementations of GraphicsContext.

Implemented in osgProducer::GraphicsContextImplementation.

void osg::GraphicsContext::makeCurrent  ) 
 

Make this graphics context current.

Implementated by first aquiring a lock of the GraphicsContext mutex, and then doing a call to makeCurrentImplementation().

virtual void osg::GraphicsContext::makeCurrentImplementation  )  [pure virtual]
 

Make this graphics context current implementation.

Pure virtual - must be implemented by concrate implementations of GraphicsContext.

Implemented in osgProducer::GraphicsContextImplementation.

bool osg::GraphicsContext::realize  ) 
 

Realise the GraphicsContext.

virtual bool osg::GraphicsContext::realizeImplementation  )  [pure virtual]
 

Realise the GraphicsContext implementation, Pure virtual - must be implemented by concrate implementations of GraphicsContext.

Implemented in osgProducer::GraphicsContextImplementation.

void osg::GraphicsContext::releaseContext  ) 
 

Release the graphics context by unlocking the GraphicsContext mutex.

void osg::GraphicsContext::setCreateGraphicsContextCallback CreateGraphicContextCallback callback  )  [static]
 

Set the create graphics context callback - this callback should be supplied by the windows toolkit.

void osg::GraphicsContext::setGraphicsThread GraphicsThread gt  ) 
 

Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations.

void osg::GraphicsContext::setState State state  )  [inline]
 

Set the State object which tracks the current OpenGL state for this graphics context.

void osg::GraphicsContext::swapBuffers  ) 
 

swap the front and back buffers.

virtual void osg::GraphicsContext::swapBuffersImplementation  )  [pure virtual]
 

Swap the front and back buffers implementation.

Pure virtual - must be implemented by Concrate implementations of GraphicsContext.

Implemented in osgProducer::GraphicsContextImplementation.


Member Data Documentation

ref_ptr<GraphicsThread> osg::GraphicsContext::_graphicsThread [protected]
 

OpenThreads::Mutex osg::GraphicsContext::_mutex [protected]
 

ref_ptr<State> osg::GraphicsContext::_state [protected]
 

OpenThreads::Thread* osg::GraphicsContext::_threadOfLastMakeCurrent [protected]
 

ref_ptr<Traits> osg::GraphicsContext::_traits [protected]
 


The documentation for this class was generated from the following file:
Generated at Thu Nov 24 16:23:06 2005 for the OpenSceneGraph by doxygen 1.3.6.