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

osg::Viewport Class Reference

Encapsulate OpenGL glViewport. More...

Inheritance diagram for osg::Viewport:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Viewport ()
 Viewport (int x, int y, int width, int 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 (int x, int y, int width, int height)
void getViewport (int &x, int &y, int &width, int &height) const
int & x ()
int x () const
int & y ()
int y () const
int & width ()
int width () const
int & height ()
int height () const
bool valid () const
float 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

int _x
int _y
int _width
int _height

Detailed Description

Encapsulate OpenGL glViewport.


Constructor & Destructor Documentation

osg::Viewport::Viewport  ) 
 

osg::Viewport::Viewport int  x,
int  y,
int  width,
int  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 state  )  const [virtual]
 

apply the OpenGL state attributes.

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

Implements osg::StateAttribute.

float 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.

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.

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.

void osg::Viewport::getViewport int &  x,
int &  y,
int &  width,
int &  height
const [inline]
 

int osg::Viewport::height  )  const [inline]
 

int& osg::Viewport::height  )  [inline]
 

osg::Viewport::META_StateAttribute osg  ,
Viewport  ,
VIEWPORT 
 

void osg::Viewport::setViewport int  x,
int  y,
int  width,
int  height
[inline]
 

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

int osg::Viewport::width  )  const [inline]
 

int& osg::Viewport::width  )  [inline]
 

int osg::Viewport::x  )  const [inline]
 

int& osg::Viewport::x  )  [inline]
 

int osg::Viewport::y  )  const [inline]
 

int& osg::Viewport::y  )  [inline]
 


Member Data Documentation

int osg::Viewport::_height [protected]
 

int osg::Viewport::_width [protected]
 

int osg::Viewport::_x [protected]
 

int osg::Viewport::_y [protected]
 


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