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

osg::Viewport Class Reference

Encapsulte OpenGL glViewport. More...

Inheritance diagram for osg::Viewport:

Inheritance graph
[legend]
List of all members.

Public Methods

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

virtual ~Viewport ()

Protected Attributes

int _x
int _y
int _width
int _height

Detailed Description

Encapsulte OpenGL glViewport.


Constructor & Destructor Documentation

osg::Viewport::Viewport  
 

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.

const float osg::Viewport::aspectRatio   const [inline]
 

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

If height is zero, the potental division by zero is avoid 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 converted local coodinates into window coordinates use v_window = v_local * MVPW matrix, where the MVPW matrix is ModelViewMatrix * ProjectionMatrix * WindowMatrix, the later 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]
 

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

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

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

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

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

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

const int osg::Viewport::y   const [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 Wed Sep 18 13:55:47 2002 for the Open Scene Graph by doxygen 1.2.16.