OpenSceneGraph 2.8.3

osg::Viewport Class Reference

Encapsulate OpenGL glViewport. More...

Inheritance diagram for osg::Viewport:

List of all members.

Public Types

typedef double value_type

Public Member Functions

 Viewport ()
 Viewport (value_type x, value_type y, value_type width, value_type height)
 Viewport (const Viewport &vp, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 Copy constructor using CopyOp to manage deep vs shallow copy.
 META_StateAttribute (osg, Viewport, VIEWPORT)
virtual int compare (const StateAttribute &sa) const
 Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
void setViewport (value_type x, value_type y, value_type width, value_type height)
value_typex ()
value_type x () const
value_typey ()
value_type y () const
value_typewidth ()
value_type width () const
value_typeheight ()
value_type height () const
bool valid () const
double aspectRatio () const
 Return the aspectRatio of the viewport, which is equal to width/height.
const osg::Matrix computeWindowMatrix () const
 Compute the Window Matrix which takes projected coords into Window coordinates.
virtual void apply (State &state) const
 apply the OpenGL state attributes.

Protected Member Functions

virtual ~Viewport ()

Protected Attributes

value_type _x
value_type _y
value_type _width
value_type _height

Detailed Description

Encapsulate OpenGL glViewport.


Member Typedef Documentation

typedef double osg::Viewport::value_type

Constructor & Destructor Documentation

osg::Viewport::Viewport ( )
osg::Viewport::Viewport ( value_type  x,
value_type  y,
value_type  width,
value_type  height 
) [inline]
osg::Viewport::Viewport ( const Viewport vp,
const CopyOp copyop = CopyOp::SHALLOW_COPY 
) [inline]

Copy constructor using CopyOp to manage deep vs shallow copy.

virtual osg::Viewport::~Viewport ( ) [protected, virtual]

Member Function Documentation

virtual void osg::Viewport::apply ( State ) const [virtual]

apply the OpenGL state attributes.

The render info for the current OpenGL context is passed in to allow the StateAttribute to obtain details on the the current context and state.

Reimplemented from osg::StateAttribute.

double osg::Viewport::aspectRatio ( ) const [inline]

Return the aspectRatio of the viewport, which is equal to width/height.

If height is zero, the potential division by zero is avoided by simply returning 1.0f.

virtual int osg::Viewport::compare ( const StateAttribute sa) const [inline, virtual]

Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.

Implements osg::StateAttribute.

References COMPARE_StateAttribute_Parameter, and COMPARE_StateAttribute_Types.

const osg::Matrix osg::Viewport::computeWindowMatrix ( ) const [inline]

Compute the Window Matrix which takes projected coords into Window coordinates.

To convert local coordinates into window coordinates use v_window = v_local * MVPW matrix, where the MVPW matrix is ModelViewMatrix * ProjectionMatrix * WindowMatrix, the latter supplied by Viewport::computeWindowMatrix(), the ModelView and Projection Matrix can either be sourced from the current osg::State object, via osgUtil::SceneView or CullVisitor.

References osg::Matrixd::scale(), and osg::Matrixd::translate().

Referenced by osg::CullStack::getWindowMatrix(), and osgUtil::IntersectionVisitor::pushWindowMatrix().

value_type& osg::Viewport::height ( ) [inline]
value_type osg::Viewport::height ( ) const [inline]
osg::Viewport::META_StateAttribute ( osg  ,
Viewport  ,
VIEWPORT   
)
void osg::Viewport::setViewport ( value_type  x,
value_type  y,
value_type  width,
value_type  height 
) [inline]
bool osg::Viewport::valid ( ) const [inline]
value_type& osg::Viewport::width ( ) [inline]
value_type osg::Viewport::width ( ) const [inline]
value_type osg::Viewport::x ( ) const [inline]
value_type& osg::Viewport::x ( ) [inline]
value_type osg::Viewport::y ( ) const [inline]
value_type& osg::Viewport::y ( ) [inline]

Member Data Documentation


The documentation for this class was generated from the following file:

osg logo
Generated at Tue Mar 22 2011 13:20:24 for the OpenSceneGraph by doxygen 1.7.3.