class SG_EXPORT osg::Drawable

Pure virtual base class for drawable Geometry.

Inheritance:


Public Methods

[more] Drawable()
[more] Drawable(const Drawable& drawable, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy
[more]virtual bool isSameKindAs(const Object* obj) const
[more]virtual const char* libraryName() const
[more]virtual const char* className() const
[more]virtual Geometry* asGeometry()
convert 'this' into a Geometry pointer if Drawable is a Geometry, otherwise return 0.
[more]virtual const Geometry* asGeometry() const
convert 'const this' into a const Geometry pointer if Drawable is a Geometry, otherwise return 0.
[more]inline const ParentList& getParents() const
Get the parent list of drawable.
[more]inline ParentList getParents()
Get the a copy of parent list of node.
[more]inline Node* getParent(unsigned int i)
Get a single parent of Drawable.
[more]inline const Node* getParent(unsigned int i) const
Get a single const parent of Drawable.
[more]inline unsigned int getNumParents() const
Get the number of parents of node.
[more]inline void setStateSet(StateSet* state)
Set the StateSet attached to the Drawable.
[more]inline StateSet* getStateSet()
Get the attached StateSet
[more]inline const StateSet* getStateSet() const
Get the attached const StateSet
[more]StateSet* getOrCreateStateSet()
Get the attached const StateSet, if one is not already attach create one, attach it to the drawable and return a pointer to it
[more]void dirtyBound()
Dirty the bounding box, forcing a computeBound() on the next call to getBound().
[more]inline const BoundingBox& getBound() const
get bounding box of geoset.
[more]inline void setShape(Shape* shape)
Set the Shape of the drawable.
[more]inline Shape* getShape()
Get the Shape of the Drawable
[more]inline const Shape* getShape() const
Get the const Shape of the const Drawable
[more]void setSupportsDisplayList(bool flag)
Set the drawable to it can or cannot be used in conjunction with OpenGL display lists.
[more]inline bool getSupportsDisplayList() const
Get whether display lists are supported for this drawable instance
[more]void setUseDisplayList(bool flag)
When set to true, force the draw method to use OpenGL Display List for rendering.
[more]inline bool getUseDisplayList() const
Return whether OpenGL display lists are being used for rendering
[more]void setUseVertexBufferObjects(bool flag)
When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplemention method to use OpenGL vertex buffer objects for rendering
[more]inline bool getUseVertexBufferObjects() const
Return whether OpenGL vertex buffer objects should be used when supported by OpenGL driver
[more]void dirtyDisplayList()
Force a recompile on next draw() of any OpenGL display list associated with this geoset
[more]virtual void compile(State& state) const
Immediately compile this drawable into an OpenGL Display List.
[more]void setUpdateCallback(UpdateCallback* ac)
Set the UpdateCallback which allows users to attach customize the undating of an object during the app traversal
[more]UpdateCallback* getUpdateCallback()
Get the non const UpdateCallback
[more]void setCullCallback(CullCallback* cc)
Set the CullCallback which allows users to attach customize the culling of Drawable during the cull traversal
[more]CullCallback* getCullCallback()
Get the non const CullCallback
[more]const CullCallback* getCullCallback() const
Get the const CullCallback
[more]void setDrawCallback(DrawCallback* dc)
Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object
[more]DrawCallback* getDrawCallback()
Get the non const DrawCallback
[more]const DrawCallback* getDrawCallback() const
Get the const DrawCallback
[more]virtual void drawImplementation(State& state) const = 0
draw directly ignoring an OpenGL display list which could be attached.
[more]static void deleteDisplayList(unsigned int contextID, GLuint globj)
use deleteDisplayList instead of glDeleteList to allow OpenGL display list to cached until they can be deleted by the OpenGL context in which they were created, specified by contextID
[more]static void flushDeletedDisplayLists(unsigned int contextID, double currentTime, double& availableTime)
flush all the cached display list which need to be deleted in the OpenGL context related to contextID
[more]static void deleteVertexBufferObject(unsigned int contextID, GLuint globj)
use deleteVertexBufferObject instead of glDeleteList to allow OpenGL buffer objects to cached until they can be deleted by the OpenGL context in which they were created, specified by contextID
[more]static void flushDeletedVertexBufferObjects(unsigned int contextID, double currentTime, double& availableTime)
flush all the cached vertex buffer objects which need to be deleted in the OpenGL context related to contextID
[more]virtual bool supports(AttributeFunctor&) const
return true if the Drawable subclass supports accept(AttributeFunctor&)
[more]virtual void accept(AttributeFunctor&)
accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.
[more]virtual bool supports(ConstAttributeFunctor&) const
return true if the Drawable subclass supports accept(ConstAttributeFunctor&)
[more]virtual void accept(ConstAttributeFunctor&) const
accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.
[more]virtual bool supports(PrimitiveFunctor&) const
return true if the Drawable subclass supports accept(PrimitiveFunctor&)
[more]virtual void accept(PrimitiveFunctor&) const
accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.
[more]static Extensions* getExtensions(unsigned int contextID, bool createIfNotInitalized)
Function to call to get the extension of a specified context.
[more]static void setExtensions(unsigned int contextID, Extensions* extensions)
setExtensions allows users to override the extensions across graphics contexts.
[more]inline void draw(State& state) const
draw OpenGL primitives.

Public Members

[more]typedef std::vector<Node*> ParentList
A vector of osg::Node pointers which is used to store the parent(s) of drawable
[more]struct UpdateCallback: public virtual osg::Referenced
[more]struct CullCallback: public virtual osg::Referenced
[more]struct DrawCallback: public virtual osg::Referenced
Callback attached to an Drawable which allows the users to customize the drawing of an exist Drawable object.
[more]typedef unsigned int AttributeType
[more]enum AttributeTypes
class AttributeFunctor
class ConstAttributeFunctor
class PrimitiveFunctor
class SG_EXPORT Extensions: public osg::Referenced
Extensions class which encapsulates the querring of extensions and associated function pointers, and provide convinience wrappers to check for the extensions or use the associated functions

Protected Fields

[more]ParentList _parents
[more]ref_ptr<StateSet> _stateset
[more]mutable BoundingBox _bbox
[more]mutable bool _bbox_computed
[more]ref_ptr<Shape> _shape
[more]bool _supportsDisplayList
[more]bool _useDisplayList
[more]bool _supportsVertexBufferObjects
[more]bool _useVertexBufferObjects
[more]mutable GLObjectList _globjList
[more]mutable GLObjectList _vboList
[more]ref_ptr<UpdateCallback> _updateCallback
[more]ref_ptr<DrawCallback> _drawCallback
[more]ref_ptr<CullCallback> _cullCallback

Protected Methods

[more]Drawable& operator = (const Drawable&)
[more]virtual ~Drawable()
[more]virtual bool computeBound() const
compute the bounding box of the drawable.
[more]void setBound(const BoundingBox& bb) const
set the bounding box
[more]void addParent(osg::Node* node)
[more]void removeParent(osg::Node* node)

Protected Members

[more]typedef osg::buffered_value<GLuint> GLObjectList


Inherited from Object:

Public Methods

ovirtual Object* cloneType() const
ovirtual Object* clone(const CopyOp&) const
oinline void setDataVariance(DataVariance dv)
oinline DataVariance getDataVariance() const
oinline void setUserData(Referenced* obj)
oinline Referenced* getUserData()
oinline const Referenced* getUserData() const

Public Members

oenum DataVariance

Protected Fields

oDataVariance _dataVariance
oref_ptr<Referenced> _userData


Inherited from Referenced:

Public Methods

ostatic void setDeleteHandler(DeleteHandler* handler)
ostatic DeleteHandler* getDeleteHandler()
oinline void ref() const
oinline void unref_nodelete() const
oinline int referenceCount() const
oinline void unref() const

Protected Fields

omutable int _refCount


Documentation

Pure virtual base class for drawable Geometry. Contains no drawing primitives directly, these are provided by subclasses such as osg::Geometry. State attributes for a Drawable are maintained in StateSet which the Drawable maintains a referenced counted pointer to. Both Drawable's and StateSet's can be shared for optimal memory usage and graphics performance.
o Drawable()

o Drawable(const Drawable& drawable, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy

ovirtual bool isSameKindAs(const Object* obj) const

ovirtual const char* libraryName() const

ovirtual const char* className() const

ovirtual Geometry* asGeometry()
convert 'this' into a Geometry pointer if Drawable is a Geometry, otherwise return 0. Equivalent to dynamic_cast(this).

ovirtual const Geometry* asGeometry() const
convert 'const this' into a const Geometry pointer if Drawable is a Geometry, otherwise return 0. Equivalent to dynamic_cast(this).

otypedef std::vector<Node*> ParentList
A vector of osg::Node pointers which is used to store the parent(s) of drawable

oinline const ParentList& getParents() const
Get the parent list of drawable.

oinline ParentList getParents()
Get the a copy of parent list of node. A copy is returned to prevent modification of the parent list.

oinline Node* getParent(unsigned int i)
Get a single parent of Drawable.
Parameters:
i - index of the parent to get.
Returns:
the parent i.

oinline const Node* getParent(unsigned int i) const
Get a single const parent of Drawable.
Parameters:
i - index of the parent to get.
Returns:
the parent i.

oinline unsigned int getNumParents() const
Get the number of parents of node.
Returns:
the number of parents of this node.

oinline void setStateSet(StateSet* state)
Set the StateSet attached to the Drawable. Previously attached StateSet are automatically unreferenced on assignment of a new drawstate.

oinline StateSet* getStateSet()
Get the attached StateSet

oinline const StateSet* getStateSet() const
Get the attached const StateSet

oStateSet* getOrCreateStateSet()
Get the attached const StateSet, if one is not already attach create one, attach it to the drawable and return a pointer to it

ovoid dirtyBound()
Dirty the bounding box, forcing a computeBound() on the next call to getBound(). Should be called in the internal geometry of the Drawable is modified.

oinline const BoundingBox& getBound() const
get bounding box of geoset. Note, now made virtual to make it possible to implement user-drawn objects albeit so what crudely, to be improved later.

oinline void setShape(Shape* shape)
Set the Shape of the drawable. The shape can be used to speed up collision detection or as a guide for produral geometry generation - see osg::ProduralGeometry.

oinline Shape* getShape()
Get the Shape of the Drawable

oinline const Shape* getShape() const
Get the const Shape of the const Drawable

ovoid setSupportsDisplayList(bool flag)
Set the drawable to it can or cannot be used in conjunction with OpenGL display lists. With set to true, calls to Drawable::setUseDisplayList, whereas when set to false, no display lists can be created and calls to setUseDisplayList are ignored, and a warning is produced. The later is typically used to guard against the switching on of display lists on objects with dynamic internal data such as continuous Level of Detail algorithms.

oinline bool getSupportsDisplayList() const
Get whether display lists are supported for this drawable instance

ovoid setUseDisplayList(bool flag)
When set to true, force the draw method to use OpenGL Display List for rendering. If false rendering directly. If the display list has not been already compile the next call to draw will automatically create the display list.

oinline bool getUseDisplayList() const
Return whether OpenGL display lists are being used for rendering

ovoid setUseVertexBufferObjects(bool flag)
When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplemention method to use OpenGL vertex buffer objects for rendering

oinline bool getUseVertexBufferObjects() const
Return whether OpenGL vertex buffer objects should be used when supported by OpenGL driver

ovoid dirtyDisplayList()
Force a recompile on next draw() of any OpenGL display list associated with this geoset

ovirtual void compile(State& state) const
Immediately compile this drawable into an OpenGL Display List. Note I, operation is ignored if _useDisplayList to false. Note II, compile is not intended to be overridden in subclasses.

ostruct UpdateCallback: public virtual osg::Referenced

ovirtual void update(osg::NodeVisitor* visitor, osg::Drawable* drawable) = 0
do customized app code

ovoid setUpdateCallback(UpdateCallback* ac)
Set the UpdateCallback which allows users to attach customize the undating of an object during the app traversal

oUpdateCallback* getUpdateCallback()
Get the non const UpdateCallback

ostruct CullCallback: public virtual osg::Referenced

ovirtual bool cull(osg::NodeVisitor* visitor, osg::Drawable* drawable, osg::State* state=NULL) const = 0
do customized cull code

ovoid setCullCallback(CullCallback* cc)
Set the CullCallback which allows users to attach customize the culling of Drawable during the cull traversal

oCullCallback* getCullCallback()
Get the non const CullCallback

oconst CullCallback* getCullCallback() const
Get the const CullCallback

ostruct DrawCallback: public virtual osg::Referenced
Callback attached to an Drawable which allows the users to customize the drawing of an exist Drawable object. The draw callback is implement as a replacement to the Drawable's own drawImplementation() method, if the the user intends to decorate the exist draw code then simple call the drawable->drawImplementation() from with the callbacks drawImplementation() method. This allows the users to do both pre and post callbacks without fuss and can even diable the inner draw in required.

ovirtual void drawImplementation(State& state, const osg::Drawable* drawable) const = 0
do customized draw code

ovoid setDrawCallback(DrawCallback* dc)
Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object

oDrawCallback* getDrawCallback()
Get the non const DrawCallback

oconst DrawCallback* getDrawCallback() const
Get the const DrawCallback

ovirtual void drawImplementation(State& state) const = 0
draw directly ignoring an OpenGL display list which could be attached. This is the internal draw method which does the drawing itself, and is the method to override when deriving from Drawable.

ostatic void deleteDisplayList(unsigned int contextID, GLuint globj)
use deleteDisplayList instead of glDeleteList to allow OpenGL display list to cached until they can be deleted by the OpenGL context in which they were created, specified by contextID

ostatic void flushDeletedDisplayLists(unsigned int contextID, double currentTime, double& availableTime)
flush all the cached display list which need to be deleted in the OpenGL context related to contextID

ostatic void deleteVertexBufferObject(unsigned int contextID, GLuint globj)
use deleteVertexBufferObject instead of glDeleteList to allow OpenGL buffer objects to cached until they can be deleted by the OpenGL context in which they were created, specified by contextID

ostatic void flushDeletedVertexBufferObjects(unsigned int contextID, double currentTime, double& availableTime)
flush all the cached vertex buffer objects which need to be deleted in the OpenGL context related to contextID

otypedef unsigned int AttributeType

oenum AttributeTypes

o VERTICES

o WEIGHTS

o NORMALS

o COLORS

o SECONDARY_COLORS

o FOG_COORDS

o ATTIBUTE_6

o ATTIBUTE_7

o TEXTURE_COORDS

o TEXTURE_COORDS_0

o TEXTURE_COORDS_1

o TEXTURE_COORDS_2

o TEXTURE_COORDS_3

o TEXTURE_COORDS_4

o TEXTURE_COORDS_5

o TEXTURE_COORDS_6

o TEXTURE_COORDS_7

ovirtual bool supports(AttributeFunctor&) const
return true if the Drawable subclass supports accept(AttributeFunctor&)

ovirtual void accept(AttributeFunctor&)
accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has. return true if functor handled by drawable, return false on failure of drawable to generate functor calls.

ovirtual bool supports(ConstAttributeFunctor&) const
return true if the Drawable subclass supports accept(ConstAttributeFunctor&)

ovirtual void accept(ConstAttributeFunctor&) const
accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has. return true if functor handled by drawable, return false on failure of drawable to generate functor calls.

ovirtual bool supports(PrimitiveFunctor&) const
return true if the Drawable subclass supports accept(PrimitiveFunctor&)

ovirtual void accept(PrimitiveFunctor&) const
accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has. return true if functor handled by drawable, return false on failure of drawable to generate functor calls. Note, PrimtiveFunctor only provide const access of the primtives, as primitives may be procedurally generated so one cannot modify it.

ostatic Extensions* getExtensions(unsigned int contextID, bool createIfNotInitalized)
Function to call to get the extension of a specified context. If the Exentsion object for that context has not yet been created then and the 'createIfNotInitalized' flag been set to false then returns NULL. If 'createIfNotInitalized' is true then the Extensions object is automatically created. However, in this case the extension object only be created with the graphics context associated with ContextID..

ostatic void setExtensions(unsigned int contextID, Extensions* extensions)
setExtensions allows users to override the extensions across graphics contexts. typically used when you have different extensions supported across graphics pipes but need to ensure that they all use the same low common denominator extensions.

oDrawable& operator = (const Drawable&)

ovirtual ~Drawable()

ovirtual bool computeBound() const
compute the bounding box of the drawable. Method must be implemented by subclasses.

ovoid setBound(const BoundingBox& bb) const
set the bounding box

ovoid addParent(osg::Node* node)

ovoid removeParent(osg::Node* node)

oParentList _parents

oref_ptr<StateSet> _stateset

omutable BoundingBox _bbox

omutable bool _bbox_computed

oref_ptr<Shape> _shape

obool _supportsDisplayList

obool _useDisplayList

obool _supportsVertexBufferObjects

obool _useVertexBufferObjects

otypedef osg::buffered_value<GLuint> GLObjectList

omutable GLObjectList _globjList

omutable GLObjectList _vboList

oref_ptr<UpdateCallback> _updateCallback

oref_ptr<DrawCallback> _drawCallback

oref_ptr<CullCallback> _cullCallback

oinline void draw(State& state) const
draw OpenGL primitives. If the drawable has _useDisplayList set to true then use an OpenGL display list, automatically compiling one if required. Otherwise call drawImplementation(). Note, draw method should *not* be overridden in subclasses as it manages the optional display list.


Direct child classes:
ShapeDrawable
ImpostorSprite
Geometry
DrawPixels
Friends:
class Node
class Geode

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.