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

osg::Window Class Reference
[Window]

Window base class. See Window for a description. More...

#include <OSGWindow.h>

Inheritance diagram for osg::Window:

osg::WindowBase osg::AttachmentContainer osg::FieldContainer osg::ClusterWindowBase osg::GLUTWindowBase osg::PassiveWindowBase osg::WIN32WindowBase osg::XWindowBase osg::ClusterWindow osg::PassiveWindow osg::XWindow osg::MultiDisplayWindowBase osg::SortFirstWindowBase osg::QTWindowBase osg::MultiDisplayWindow osg::SortFirstWindow osg::QTWindow List of all members.

Extension handling

bool hasExtension (UInt32 id)
bool hasExtension (const Char8 *s)
void * getFunction (UInt32 id)
void * getFunctionNoCheck (UInt32 id)
void dumpExtensions (void)
GLExtensionFunction getFunctionByName (const Char8 *s)
Real32 getConstantValue (GLenum val)
const Vec2fgetConstantValuev (GLenum val)
const std::vector< std::string > & getRegisteredFunctions (void)
const std::vector< std::string > & getExtensions (void)
const std::vector< std::string > & getIgnoredExtensions (void)
*static void setGLLibraryName (const Char8 *s)
static Int32 getExtensionId (const Char8 *s)
static bool hasCommonExtension (UInt32 id)
static const std::vector<
std::string > & 
getRegisteredExtensions (void)

GL object handling

*void validateGLObject (UInt32 id)
void validateAllGLObjects (void)
GLObjectStatusE getGLObjectStatus (UInt32 id)
void setGLObjectId (UInt32 id, UInt32 id2)
UInt32 getGLObjectId (UInt32 id)
static void refreshGLObject (UInt32 id)
static void reinitializeGLObject (UInt32 id)
static void destroyGLObject (UInt32 id, UInt32 num=1)
static void unpackIdStatus (UInt32 idstatus, UInt32 &id, GLObjectStatusE &status)

GL object handling

void doInitRegisterGLObject (UInt32 id, UInt32 num)
*static void initRegisterGLObject (UInt32 id, UInt32 num)
static UInt32 packIdStatus (UInt32 id, GLObjectStatusE status)

Static GL Object / Extension variables

typedef std::pair< UInt32,
UInt32
DestroyEntry
std::list< DestroyEntry_glObjectDestroyList
*static Lock_GLObjectLock
static Lock_staticWindowLock
static std::vector< GLObject * > _glObjects
static const Char8_glLibraryName = NULL
static std::vector< std::string > _registeredExtensions
static std::vector< std::string > _ignoredExtensions
static std::vector< bool > _commonExtensions
static std::vector< std::string > _registeredFunctions
static std::vector< Int32_registeredFunctionExts
static std::vector< GLenum_registeredConstants

Public Types

typedef ArgsCollector< UInt32GLObjectFunctorArgs
typedef TypedVoidFunctor2Base<
PtrCallArg< Window >, GLObjectFunctorArgs
GLObjectFunctor
typedef void(* GLExtensionFunction )(void)
enum  GLObjectStatusE {
  notused = 1, initialize, reinitialize, initialized,
  needrefresh, destroy, finaldestroy
}
enum  { invalidExtensionID = 0x7fffffff, invalidFunctionID = 0x7fffffff }
enum  { statusShift = 3, statusMask = 7 }
typedef WindowPtr Ptr

Public Member Functions

Handle Attachments
*void addAttachment (const AttachmentPtr &fieldContainerP, UInt16 binding=0)
void subAttachment (const AttachmentPtr &fieldContainerP, UInt16 binding=0)
AttachmentPtr findAttachment (UInt32 groupId, UInt16 binding=0)
AttachmentPtr findAttachment (const FieldContainerType &type, UInt16 binding=0)
Field Access *SFAttachmentMapgetSFAttachments (void)
Get Instance Type Information
UInt32 getTypeId (void) const
UInt16 getGroupId (void) const
const Char8getTypeName (void) const
Generic Field Access *FieldgetField (UInt32 fieldId)
FieldgetField (const Char8 *fieldName)
Sync
*virtual void changed (BitVector whichField, UInt32 origin)
Viewport handling
*void addPort (const ViewportPtr &portP)
void insertPort (UInt32 portIndex, const ViewportPtr &portP)
void replacePort (UInt32 portIndex, const ViewportPtr &portP)
void replacePortBy (const ViewportPtr &portP, const ViewportPtr &newPortP)
void subPort (const ViewportPtr &portP)
void subPort (UInt32 portIndex)
Size handling
*bool isResizePending (void)
virtual void resize (int width, int height)
virtual void resizeGL (void)
void setSize (UInt16 width, UInt16 height)
Drawing
*virtual void frameInit (void)
virtual void frameExit (void)
virtual void draw (DrawAction *action=NULL)
virtual void drawAllViewports (DrawAction *action=NULL)
virtual void render (RenderActionBase *action=NULL)
virtual void renderAllViewports (RenderActionBase *action=NULL)
Window system implementation functions
*virtual void init (void)=0
virtual void activate (void)=0
virtual void deactivate (void)=0
virtual void swap (void)=0
Output
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get
*SFUInt16getSFWidth (void)
 Get the Window::_sfWidth field.
SFUInt16getSFHeight (void)
 Get the Window::_sfHeight field.
MFViewportPtrgetMFPort (void)
 Get the Window::_mfPort field.
SFBoolgetSFResizePending (void)
 Get the Window::_sfResizePending field.
UInt16getWidth (void)
 Get the value of the Window::_sfWidth field.
const UInt16getWidth (void) const
 Get the value of the Window::_sfWidth field.
UInt16getHeight (void)
 Get the value of the Window::_sfHeight field.
const UInt16getHeight (void) const
 Get the value of the Window::_sfHeight field.
bool & getResizePending (void)
 Get the value of the Window::_sfResizePending field.
const bool & getResizePending (void) const
 Get the value of the Window::_sfResizePending field.
ViewportPtrgetPort (const UInt32 index)
 Get the value of the index element the Window::_mfPort field.
MFViewportPtrgetPort (void)
 Get the Window::_mfPort field.
const MFViewportPtrgetPort (void) const
 Get the Window::_mfPort field.
Field Set
*void setWidth (const UInt16 &value)
 Set the value of the Window::_sfWidth field.
void setHeight (const UInt16 &value)
 Set the value of the Window::_sfHeight field.
void setResizePending (const bool &value)
 Set the value of the Window::_sfResizePending field.
Binary Access
*virtual UInt32 getBinSize (const BitVector &whichField)
virtual void copyToBin (BinaryDataHandler &pMem, const BitVector &whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField)
Handle Attachments
*void addAttachment (const AttachmentPtr &fieldContainerP, UInt16 binding=0)
void subAttachment (const AttachmentPtr &fieldContainerP, UInt16 binding=0)
AttachmentPtr findAttachment (UInt32 groupId, UInt16 binding=0)
AttachmentPtr findAttachment (const FieldContainerType &type, UInt16 binding=0)
Field Access *SFAttachmentMapgetSFAttachments (void)
Get Instance Type Information
UInt32 getTypeId (void) const
UInt16 getGroupId (void) const
const Char8getTypeName (void) const
Generic Field Access *FieldgetField (UInt32 fieldId)
FieldgetField (const Char8 *fieldName)
Clone
*virtual FieldContainerPtr shallowCopy (void) const =0

Static Public Member Functions

Get Class Type Information
static UInt16 getClassGroupId (void)
Class Get
*static const char * getClassname (void)
Extension registration
*static UInt32 registerExtension (const Char8 *s)
static void ignoreExtensions (const Char8 *s)
static UInt32 registerFunction (const Char8 *s, Int32 ext=-1)
static void registerConstant (GLenum val)
GL object registration
*static UInt32 registerGLObject (GLObjectFunctor functor, UInt32 num=1)
Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Get Class Type Information
static UInt16 getClassGroupId (void)

Static Public Attributes

static const Real32 unknownConstant = -1e100
static const osg::BitVector WidthFieldMask
static const osg::BitVector HeightFieldMask
static const osg::BitVector PortFieldMask
static const osg::BitVector ResizePendingFieldMask
static const osg::BitVector GlObjectEventCounterFieldMask
static const osg::BitVector GlObjectLastRefreshFieldMask
static const osg::BitVector GlObjectLastReinitializeFieldMask
static const osg::BitVector MTInfluenceMask
static const BitVector AttachmentsFieldMask
static const BitVector NextFieldMask
CoredNodePtr helper
static const bool isNodeCore = false

Protected Member Functions

Sync
void executeSyncImpl (AttachmentContainer *pOther, const BitVector &whichField)
Sync
void executeSyncImpl (FieldContainer *pOther, const BitVector &whichField)
Pointer
*AttachmentContainerPtr getPtr (void)
MT Edit
template<class FieldTypeT>
*void beginEditX (const BitVector &whichField, FieldTypeT &field)
template<class FieldTypeT>
void endEditX (const BitVector &whichField, FieldTypeT &field)
MT Construction
*void onCreate (const FieldContainer *source=NULL)
void onCreateAspect (const FieldContainer *aspect0, const FieldContainer *source=NULL)
Constructors
Window (void)
 Window (const Window &source)
Destructors
*virtual ~Window (void)
GL setup handling
*virtual void setupGL (void)
Field Get
*SFUInt32getSFGlObjectEventCounter (void)
 Get the Window::_sfGlObjectEventCounter field.
MFUInt32getMFGlObjectLastRefresh (void)
 Get the Window::_mfGlObjectLastRefresh field.
MFUInt32getMFGlObjectLastReinitialize (void)
 Get the Window::_mfGlObjectLastReinitialize field.
UInt32getGlObjectEventCounter (void)
 Get the value of the Window::_sfGlObjectEventCounter field.
const UInt32getGlObjectEventCounter (void) const
 Get the value of the Window::_sfGlObjectEventCounter field.
UInt32getGlObjectLastRefresh (UInt32 index)
 Get the value of the index element the Window::_mfGlObjectLastRefresh field.
MFUInt32getGlObjectLastRefresh (void)
 Get the Window::_mfGlObjectLastRefresh field.
const MFUInt32getGlObjectLastRefresh (void) const
 Get the Window::_mfGlObjectLastRefresh field.
UInt32getGlObjectLastReinitialize (UInt32 index)
 Get the value of the index element the Window::_mfGlObjectLastReinitialize field.
MFUInt32getGlObjectLastReinitialize (void)
 Get the Window::_mfGlObjectLastReinitialize field.
const MFUInt32getGlObjectLastReinitialize (void) const
 Get the Window::_mfGlObjectLastReinitialize field.
Field Set
*void setGlObjectEventCounter (const UInt32 &value)
 Set the value of the Window::_sfGlObjectEventCounter field.
Sync
*void executeSyncImpl (WindowBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)
Sync
void executeSyncImpl (AttachmentContainer *pOther, const BitVector &whichField)
Sync
void executeSyncImpl (FieldContainer *pOther, const BitVector &whichField)
Pointer
*AttachmentContainerPtr getPtr (void)
MT Edit
template<class FieldTypeT>
*void beginEditX (const BitVector &whichField, FieldTypeT &field)
template<class FieldTypeT>
void endEditX (const BitVector &whichField, FieldTypeT &field)
MT Construction
*void onCreate (const FieldContainer *source=NULL)
void onCreateAspect (const FieldContainer *aspect0, const FieldContainer *source=NULL)

Static Protected Member Functions

Create Fieldcontainer
template<class ObjectPtrT>
*static void newPtr (ObjectPtrT &result, const typename ObjectPtrT::StoredObjectType *prototypeP)
template<class ObjectPtrT>
static void newPtr (ObjectPtrT &result)
Create Fieldcontainer
template<class ObjectPtrT>
*static void newPtr (ObjectPtrT &result, const typename ObjectPtrT::StoredObjectType *prototypeP)
template<class ObjectPtrT>
static void newPtr (ObjectPtrT &result)

Protected Attributes

Fields
*SFAttachmentMap _attachmentMap
Member
*UInt32 _shares
Map for GL cvonstant handling
*typedef std::map< GLenum,
Vec2f
ConstHash
Fields
*SFUInt16 _sfWidth
SFUInt16 _sfHeight
MFViewportPtr _mfPort
SFBool _sfResizePending
SFUInt32 _sfGlObjectEventCounter
MFUInt32 _mfGlObjectLastRefresh
MFUInt32 _mfGlObjectLastReinitialize
Fields
*SFAttachmentMap _attachmentMap
Member
*UInt32 _shares

Private Types

typedef WindowBase Inherited

Private Member Functions

void onCreate (const Window *source=NULL)
void onCreateAspect (const Window *aspect0, const Window *source=NULL)
void onDestroy (void)
Windowoperator= (const Window &source)

Static Private Member Functions

static void initMethod (void)
static void staticAcquire (void)
static void staticRelease (void)

Private Attributes

UInt32 _windowId
GL Object / Extension variables
*std::vector< UInt32_lastValidate
std::vector< UInt32_ids
std::vector< std::string > _extensions
std::vector< bool > _availExtensions
std::vector< void * > _extFunctions
ConstHash _availConstants
UInt32 _numAvailConstants

Static Private Attributes

static std::vector< WindowPtr_allWindows
static UInt32 _currentWindowId = 0

Friends

class FieldContainer
class WindowBase
GL object handling helper class
class GLObject

Classes

class  GLObject

Detailed Description

Window is the base class for all window management classes. See Window for a description.

Ext:

To create a new Window the methods that have to be overridden are init(void), activate(void), deactivate(void) and swap(void).

Definition at line 73 of file OSGWindow.h.


Member Typedef Documentation

typedef ArgsCollector<UInt32> osg::Window::GLObjectFunctorArgs
 

Definition at line 96 of file OSGWindow.h.

typedef TypedVoidFunctor2Base<PtrCallArg<Window> , GLObjectFunctorArgs> osg::Window::GLObjectFunctor
 

Definition at line 99 of file OSGWindow.h.

typedef void(* osg::Window::GLExtensionFunction)(void)
 

Definition at line 101 of file OSGWindow.h.

typedef WindowBase osg::Window::Inherited [private]
 

Reimplemented from osg::WindowBase.

Reimplemented in osg::ClusterWindow, osg::ClusterWindowBase, osg::MultiDisplayWindow, osg::MultiDisplayWindowBase, osg::SortFirstWindow, osg::SortFirstWindowBase, osg::PassiveWindow, osg::PassiveWindowBase, osg::XWindow, osg::XWindowBase, osg::WIN32WindowBase, osg::GLUTWindowBase, osg::QTWindow, and osg::QTWindowBase.

Definition at line 330 of file OSGWindow.h.

typedef std::pair<UInt32,UInt32> osg::Window::DestroyEntry [private]
 

Definition at line 366 of file OSGWindow.h.

typedef WindowPtr osg::WindowBase::Ptr [inherited]
 

Reimplemented in osg::ClusterWindowBase, osg::MultiDisplayWindowBase, osg::SortFirstWindowBase, osg::PassiveWindowBase, osg::XWindowBase, osg::WIN32WindowBase, and osg::GLUTWindowBase.

Definition at line 96 of file OSGWindowBase.h.


Member Enumeration Documentation

enum osg::Window::GLObjectStatusE
 

Enumeration values for the status of the GL objects. This is primarily used to signal the object's callback functions what to do. See OpenGL Objects & Extension Handling for a description.

Enumerator:
notused  Object is not used at all right now.
initialize  The object is being initialized for the first time.
reinitialize  The object is being re-initialized, i.e. it has changed significantly.
initialized  The object is initialized and valid.
needrefresh  The object is initialized but needs a refresh.
destroy  The object is to be destroyed, i.e. removed from the current OpenGL context.
finaldestroy  The object has been removed from all OpenGL contexts and used ressources but be freed now.

Definition at line 78 of file OSGWindow.h.

00079     {
00080         notused      = 1, 
00081         initialize, 
00082         reinitialize, 
00083         initialized,
00084         needrefresh, 
00085         destroy, 
00086         finaldestroy 
00087     };

anonymous enum
 

Enumerator:
invalidExtensionID 
invalidFunctionID 

Reimplemented from osg::WindowBase.

Definition at line 89 of file OSGWindow.h.

00089 { invalidExtensionID = 0x7fffffff, invalidFunctionID = 0x7fffffff };

anonymous enum
 

Enumerator:
statusShift  Shift value to transform object id and status into asingle int.
statusMask  Mask value to transform object id and status into asingle int.

Definition at line 92 of file OSGWindow.h.

00092 { statusShift = 3, statusMask = 7 }; 


Constructor & Destructor Documentation

osg::Window::Window void   )  [protected]
 

Constructor

Definition at line 276 of file OSGWindow.cpp.

00276                       :
00277      Inherited( ),
00278     _windowId (0)
00279 {
00280     // only called for prototypes, no need to init them
00281 }

osg::Window::Window const Window source  )  [protected]
 

Copy Constructor

Definition at line 286 of file OSGWindow.cpp.

References _glObjects, and doInitRegisterGLObject().

00286                                       :
00287     Inherited(source),
00288     _glObjectDestroyList(source._glObjectDestroyList),
00289     _lastValidate(source._lastValidate.size(),0),
00290     _ids(source._ids.size(),0),
00291     _extensions(),
00292     _availExtensions(),
00293     _extFunctions(),
00294     _availConstants(),
00295     _numAvailConstants(0),
00296     _windowId(0)
00297 {       
00298     // mark all GL objects as not yet initialized
00299     doInitRegisterGLObject(1, _glObjects.size() - 1);
00300 }

osg::Window::~Window void   )  [protected, virtual]
 

Destructor

Definition at line 305 of file OSGWindow.cpp.

00306 {
00307     // delete the ports and the context
00308 }


Member Function Documentation

* static const char* osg::Window::getClassname void   )  [inline, static]
 

Definition at line 107 of file OSGWindow.h.

00107 { return "Window"; };

void osg::Window::changed BitVector  whichField,
UInt32  origin
[virtual]
 

react to field changes

Reimplemented from osg::AttachmentContainer.

Reimplemented in osg::ClusterWindow, osg::MultiDisplayWindow, osg::SortFirstWindow, osg::PassiveWindow, osg::XWindow, and osg::QTWindow.

Definition at line 399 of file OSGWindow.cpp.

References osg::AttachmentContainer::changed().

Referenced by osg::XWindow::changed(), osg::PassiveWindow::changed(), and osg::ClusterWindow::changed().

00400 {
00401     Inherited::changed(whichField, origin);
00402 }

void osg::Window::addPort const ViewportPtr portP  ) 
 

Definition at line 406 of file OSGWindow.cpp.

References osg::WindowBase::_mfPort, osg::MField< FieldTypeT, fieldNameSpace >::back(), osg::beginEditCP(), osg::endEditCP(), osg::NullFC, osg::ViewportBase::ParentFieldMask, and osg::MField< FieldTypeT, fieldNameSpace >::push_back().

00407 {
00408     if(portP != NullFC)
00409     {
00410         _mfPort.push_back(portP);
00411 // CHECK CHECK
00412 //        _mfPort.back()->setParent(FieldContainer::getPtr<WindowPtr>(*this));
00413 
00414         beginEditCP(portP, Viewport::ParentFieldMask);
00415         {
00416             _mfPort.back()->setParent(WindowPtr(*this));
00417         }
00418         endEditCP  (portP, Viewport::ParentFieldMask);
00419     }
00420 }

void osg::Window::insertPort UInt32  portIndex,
const ViewportPtr portP
 

Definition at line 422 of file OSGWindow.cpp.

References osg::WindowBase::_mfPort, osg::MField< FieldTypeT, fieldNameSpace >::begin(), osg::beginEditCP(), osg::endEditCP(), osg::MField< FieldTypeT, fieldNameSpace >::insert(), osg::NullFC, and osg::ViewportBase::ParentFieldMask.

00423 {    
00424     MFViewportPtr::iterator portIt = _mfPort.begin();
00425 
00426     if(portP != NullFC)
00427     {
00428         portIt += portIndex;
00429   
00430 // CHECK CHECK      
00431 //        (*(_mfPort.insert(portIt, portP)))->setParent(
00432 //            FieldContainer::getPtr<WindowPtr>(*this));
00433 
00434         beginEditCP(portP, Viewport::ParentFieldMask);
00435         {
00436             (*(_mfPort.insert(portIt, portP)))->setParent(
00437                 WindowPtr(*this));
00438         }
00439         endEditCP  (portP, Viewport::ParentFieldMask);
00440 
00441     }
00442 }

void osg::Window::replacePort UInt32  portIndex,
const ViewportPtr portP
 

Definition at line 445 of file OSGWindow.cpp.

References osg::WindowBase::_mfPort, and osg::NullFC.

00446 {
00447     if(portP != NullFC)
00448     {
00449         _mfPort[portIndex]->setParent(NullFC);
00450         _mfPort[portIndex] = portP;
00451 // CHECK CHECK
00452 //        _mfPort.getValue(portIndex)->setParent(
00453 //            FieldContainer::getPtr<WindowPtr>(*this));
00454         _mfPort[portIndex]->setParent(
00455             WindowPtr(*this));
00456     }
00457 }

void osg::Window::replacePortBy const ViewportPtr portP,
const ViewportPtr newPortP
 

Definition at line 459 of file OSGWindow.cpp.

References osg::WindowBase::_mfPort, osg::MField< FieldTypeT, fieldNameSpace >::end(), osg::MField< FieldTypeT, fieldNameSpace >::find(), and osg::NullFC.

00461 {
00462     MFViewportPtr::iterator portIt = _mfPort.find(portP);
00463 
00464     if(newportP != NullFC)
00465     {
00466         if(portIt != _mfPort.end())
00467         {
00468             (*portIt)->setParent(NullFC);
00469             (*portIt) = newportP;
00470 // CHECK CHECK
00471 //            (*portIt)->setParent(
00472 //                FieldContainer::getPtr<WindowPtr>(*this));
00473             (*portIt)->setParent(
00474                 WindowPtr(*this));
00475         }
00476     }
00477 }

void osg::Window::subPort const ViewportPtr portP  ) 
 

Definition at line 479 of file OSGWindow.cpp.

References osg::WindowBase::_mfPort, osg::MField< FieldTypeT, fieldNameSpace >::end(), osg::MField< FieldTypeT, fieldNameSpace >::erase(), osg::MField< FieldTypeT, fieldNameSpace >::find(), and osg::NullFC.

00480 {
00481     MFViewportPtr::iterator portIt = _mfPort.find(portP);
00482 
00483     if(portIt != _mfPort.end())
00484     {
00485         (*portIt)->setParent(NullFC);
00486 
00487         _mfPort.erase(portIt);
00488     }
00489 
00490 }

void osg::Window::subPort UInt32  portIndex  ) 
 

Definition at line 492 of file OSGWindow.cpp.

References osg::WindowBase::_mfPort, osg::MField< FieldTypeT, fieldNameSpace >::begin(), osg::MField< FieldTypeT, fieldNameSpace >::end(), osg::MField< FieldTypeT, fieldNameSpace >::erase(), and osg::NullFC.

00493 {
00494     MFViewportPtr::iterator portIt = _mfPort.begin();
00495 
00496     portIt += portIndex;
00497 
00498     if(portIt != _mfPort.end())
00499     {
00500         (*portIt)->setParent(NullFC);
00501 
00502         _mfPort.erase(portIt);
00503     }
00504 }

UInt32 osg::Window::registerExtension const Char8 s  )  [static]
 

Register a new OpenGL extension. See OpenGL Extensions for details. Ignores NULL strings.

Definition at line 849 of file OSGWindow.cpp.

References _registeredExtensions, FDEBUG, FPDEBUG, staticAcquire(), and staticRelease().

Referenced by osg::BlendChun