## class SG_EXPORT osg::Viewport

> Encapsulte OpenGL glViewport

## Inheritance:

### Public Methods

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
inline void setViewport(int x, int y, int width, int height)
void getViewport(int& x, int& y, int& width, int& height) const
inline int x() const
inline int y() const
inline int width() const
inline int height() const
inline bool valid() const
inline float aspectRatio() const
  Return the aspcetRatio of the viewport, which is equal to width/height.
inline const osg::Matrix computeWindowMatrix() const
  Compute the Window Matrix which takes projected coords into Window coordinates.
virtual void apply(State& state) const

### Protected Fields

int _x
int _y
int _width
int _height

### Protected Methods

virtual ~Viewport()

### Inherited from StateAttribute:

### Public Methods

virtual Object* cloneType() const
virtual Object* clone(const CopyOp&) const
virtual bool isSameKindAs(const Object* obj) const
virtual const char* libraryName() const
virtual const char* className() const
virtual Type getType() const
virtual bool isTextureAttribute() const
bool operator < (const StateAttribute& rhs) const
bool operator == (const StateAttribute& rhs) const
bool operator != (const StateAttribute& rhs) const
virtual void getAssociatedModes(std::vector<GLMode>& ) const
virtual void compile(State&) const

### Public Members

typedef GLenum GLMode
typedef unsigned int GLModeValue
typedef unsigned int OverrideValue
enum Values
typedef unsigned int Type
enum Types

### Inherited from Object:

### Public Methods

inline void setDataVariance(DataVariance dv)
inline DataVariance getDataVariance() const
inline void setUserData(Referenced* obj)
inline Referenced* getUserData()
inline const Referenced* getUserData() const

### Public Members

enum DataVariance

### Protected Fields

DataVariance _dataVariance
ref_ptr<Referenced> _userData

### Inherited from Referenced:

### Public Methods

inline Referenced& operator = (Referenced&)
static void setDeleteHandler(DeleteHandler* handler)
static DeleteHandler* getDeleteHandler()
inline void ref() const
inline void unref_nodelete() const
inline int referenceCount() const
inline void unref() const

### Protected Fields

mutable int _refCount

## Documentation

> Encapsulte OpenGL glViewport

`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

`inline void setViewport(int x, int y, int width, int height)`

`void getViewport(int& x, int& y, int& width, int& height) const`

`inline int x() const`

`inline int y() const`

`inline int width() const`

`inline int height() const`

`inline bool valid() const`

`inline float aspectRatio() const`
  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.

`inline const osg::Matrix computeWindowMatrix() const`
  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.

`virtual void apply(State& state) const`

`virtual ~Viewport()`

`int _x`

`int _y`

`int _width`

`int _height`

This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java

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