osg::Viewport Class Reference

Encapsulate OpenGL glViewport. More...

Inheritance diagram for osg::Viewport:

Inheritance graph
[legend]

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

osg::Viewport::META_StateAttribute ( osg  ,
Viewport  ,
VIEWPORT   
)

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.

void osg::Viewport::setViewport ( value_type  x,
value_type  y,
value_type  width,
value_type  height 
) [inline]

value_type& osg::Viewport::x (  )  [inline]

value_type osg::Viewport::x (  )  const [inline]

value_type& osg::Viewport::y (  )  [inline]

value_type osg::Viewport::y (  )  const [inline]

value_type& osg::Viewport::width (  )  [inline]

value_type osg::Viewport::width (  )  const [inline]

value_type& osg::Viewport::height (  )  [inline]

value_type osg::Viewport::height (  )  const [inline]

bool osg::Viewport::valid (  )  const [inline]

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

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

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

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.

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.


Member Data Documentation

value_type osg::Viewport::_x [protected]

value_type osg::Viewport::_y [protected]

value_type osg::Viewport::_width [protected]

value_type osg::Viewport::_height [protected]


The documentation for this class was generated from the following file:
Generated at Sun Oct 14 02:12:19 2007 for the OpenSceneGraph by doxygen 1.5.3.