# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Attributes

# vl::Viewport Class Reference

Implements the viewport and clearing settings associated to a Camera. More...

`#include <Viewport.hpp>`

Inheritance diagram for vl::Viewport:

List of all members.

## Public Member Functions

virtual const char * | className ()
| Returns the name of the class.
| Viewport ()
| Viewport (int x, int y, int w, int h)
void | activate () const
bool | null ()
void | set (int x, int y, int w, int h)
void | setX (int x)
int | x () const
void | setY (int y)
int | y () const
void | setWidth (int width)
int | width () const
void | setHeight (int height)
int | height () const
fvec2 | center () const
RectI | rect () const
| Returns the rectangular area that defines the viewport computed as RectI(x(), y(), x()+width()-1, y()+height()-1).
void | setClearColor (float r, float g, float b, float a)
void | setClearColor (const fvec4 &color)
const fvec4 & | clearColor () const
void | setClearColorInt (int r, int g, int b, int a)
void | setClearColorInt (const ivec4 &color)
const ivec4 & | clearColorInt () const
void | setClearColorUInt (unsigned int r, unsigned int g, unsigned int b, unsigned int a)
void | setClearColorUInt (const uvec4 &color)
const uvec4 & | clearColorUInt () const
void | setClearStencil (int stencil)
int | clearStencil () const
void | setClearDepth (Real depth)
Real | clearDepth () const
void | setClearFlags (EClearFlags clear_flags)
EClearFlags | clearFlags () const
void | setClearColorMode (EClearColorMode mode)
EClearColorMode | clearColorMode () const
bool | isPointInside (int x, int y, int render_target_height) const
| Returns true if the given point is inside the Viewport.

## Protected Attributes

fvec4 | mClearColor
ivec4 | mClearColorInt
uvec4 | mClearColorUInt
Real | mClearDepth
int | mClearStencil
EClearFlags | mClearFlags
EClearColorMode | mClearColorMode
int | mX
int | mY
int | mWidth
int | mHeight

## Detailed Description

Implements the viewport and clearing settings associated to a Camera.

Supports glClearColor, glClearColorIiEXT and glClearColorIuiEXT (see GL_EXT_texture_integer).

See also:
  Camera, Rendering, Renderer

Definition at line 51 of file Viewport.hpp.

## Constructor & Destructor Documentation

Viewport::Viewport | ( | ) |

Definition at line 42 of file Viewport.cpp.

References vl::CCM_Float, vl::CF_CLEAR_COLOR_DEPTH, mClearColor, mClearColorMode, mClearDepth, mClearFlags, mClearStencil, mHeight, mWidth, mX, mY, and VL_DEBUG_SET_OBJECT_NAME.

Viewport::Viewport | ( | int | x,
|  | int | y,
|  | int | w,
|  | int | h
| ) |  |

Definition at line 56 of file Viewport.cpp.

References vl::CCM_Float, vl::CF_CLEAR_COLOR_DEPTH, mClearColor, mClearColorMode, mClearDepth, mClearFlags, mClearStencil, mHeight, mWidth, mX, mY, VL_DEBUG_SET_OBJECT_NAME, x(), and y().

## Member Function Documentation

virtual const char* vl::Viewport::className | ( | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::Object.

Definition at line 54 of file Viewport.hpp.

void Viewport::activate | ( | ) | const

Definition at line 70 of file Viewport.cpp.

References vl::Vector4< T_Scalar >::a(), vl::Vector4< T_Scalar >::b(), vl::Log::bug(), vl::CCM_Float, vl::CCM_Int, vl::CCM_UInt, clearColorMode(), vl::Vector4< T_Scalar >::g(), mClearColor, mClearColorInt, mClearColorUInt, mClearDepth, mClearFlags, mClearStencil, mHeight, mWidth, mX, mY, vl::Vector4< T_Scalar >::r(), VL_CHECK_OGL, x(), and y().

Referenced by vl::Renderer::render(), and vl::EdgeRenderer::render().

bool vl::Viewport::null | ( | ) | `[inline]`

Definition at line 60 of file Viewport.hpp.

void vl::Viewport::set | ( | int | x,
|  | int | y,
|  | int | w,
|  | int | h
| ) |  | `[inline]`

Definition at line 62 of file Viewport.hpp.

void vl::Viewport::setX | ( | int | x ) | `[inline]`

Definition at line 63 of file Viewport.hpp.

int vl::Viewport::x | ( | ) | const`[inline]`

Definition at line 64 of file Viewport.hpp.

Referenced by activate(), vl::Text::boundingRectTransformed(), vl::PixelLODEvaluator::evaluate(), isPointInside(), vl::TrackballManipulator::mouseDownEvent(), vl::TrackballManipulator::mouseMoveEvent(), vl::Renderer::render(), vl::DrawPixels::render_Implementation(), vl::Clear::render_Implementation(), vl::OcclusionCullRenderer::render_pass2(), vl::Text::renderBackground(), vl::Text::renderBorder(), vl::Text::renderText(), and Viewport().

void vl::Viewport::setY | ( | int | y ) | `[inline]`

Definition at line 65 of file Viewport.hpp.

int vl::Viewport::y | ( | ) | const`[inline]`

Definition at line 66 of file Viewport.hpp.

Referenced by activate(), vl::Text::boundingRectTransformed(), vl::GhostCameraManipulator::enableEvent(), vl::PixelLODEvaluator::evaluate(), isPointInside(), vl::TrackballManipulator::mouseDownEvent(), vl::TrackballManipulator::mouseMoveEvent(), vl::GhostCameraManipulator::mouseMoveEvent(), vl::Renderer::render(), vl::DrawPixels::render_Implementation(), vl::Clear::render_Implementation(), vl::OcclusionCullRenderer::render_pass2(), vl::Text::renderBackground(), vl::Text::renderBorder(), vl::Text::renderText(), and Viewport().

void vl::Viewport::setWidth | ( | int | width ) | `[inline]`

Definition at line 67 of file Viewport.hpp.

Referenced by vl::Applet::resizeEvent().

int vl::Viewport::width | ( | ) | const`[inline]`

Definition at line 68 of file Viewport.hpp.

Referenced by vl::Text::boundingRectTransformed(), vl::TrackballManipulator::computeVector(), vl::PixelLODEvaluator::evaluate(), isPointInside(), vl::TrackballManipulator::mouseDownEvent(), vl::Renderer::render(), vl::DrawPixels::render_Implementation(), vl::Clear::render_Implementation(), vl::OcclusionCullRenderer::render_pass2(), vl::Text::renderBackground(), vl::Text::renderBorder(), and vl::Text::renderText().

void vl::Viewport::setHeight | ( | int | height ) | `[inline]`

Definition at line 69 of file Viewport.hpp.

Referenced by vl::Applet::resizeEvent().

int vl::Viewport::height | ( | ) | const`[inline]`

Definition at line 70 of file Viewport.hpp.

Referenced by vl::Text::boundingRectTransformed(), vl::TrackballManipulator::computeVector(), vl::GhostCameraManipulator::enableEvent(), vl::PixelLODEvaluator::evaluate(), isPointInside(), vl::TrackballManipulator::mouseDownEvent(), vl::TrackballManipulator::mouseMoveEvent(), vl::GhostCameraManipulator::mouseMoveEvent(), vl::Renderer::render(), vl::DrawPixels::render_Implementation(), vl::Clear::render_Implementation(), vl::OcclusionCullRenderer::render_pass2(), vl::Text::renderBackground(), vl::Text::renderBorder(), and vl::Text::renderText().

fvec2 vl::Viewport::center | ( | ) | const`[inline]`

Definition at line 71 of file Viewport.hpp.

Referenced by vl::GhostCameraManipulator::enableEvent(), and vl::GhostCameraManipulator::mouseMoveEvent().

RectI vl::Viewport::rect | ( | ) | const`[inline]`

Returns the rectangular area that defines the viewport computed as RectI(x(), y(), x()+width()-1, y()+height()-1).

Definition at line 76 of file Viewport.hpp.

Referenced by vl::Scissor::enable().

void vl::Viewport::setClearColor | ( | float | r,
|  | float | g,
|  | float | b,
|  | float | a
| ) |  | `[inline]`

Definition at line 78 of file Viewport.hpp.

void vl::Viewport::setClearColor | ( | const fvec4 & | color ) | `[inline]`

Definition at line 79 of file Viewport.hpp.

const fvec4& vl::Viewport::clearColor | ( | ) | const`[inline]`

Definition at line 80 of file Viewport.hpp.

void vl::Viewport::setClearColorInt | ( | int | r,
|  | int | g,
|  | int | b,
|  | int | a
| ) |  | `[inline]`

Definition at line 82 of file Viewport.hpp.

void vl::Viewport::setClearColorInt | ( | const ivec4 & | color ) | `[inline]`

Definition at line 83 of file Viewport.hpp.

const ivec4& vl::Viewport::clearColorInt | ( | ) | const`[inline]`

Definition at line 84 of file Viewport.hpp.

void vl::Viewport::setClearColorUInt | ( | unsigned int | r,
|  | unsigned int | g,
|  | unsigned int | b,
|  | unsigned int | a
| ) |  | `[inline]`

Definition at line 86 of file Viewport.hpp.

void vl::Viewport::setClearColorUInt | ( | const uvec4 & | color ) | `[inline]`

Definition at line 87 of file Viewport.hpp.

const uvec4& vl::Viewport::clearColorUInt | ( | ) | const`[inline]`

Definition at line 88 of file Viewport.hpp.

void vl::Viewport::setClearStencil | ( | int | stencil ) | `[inline]`

Definition at line 90 of file Viewport.hpp.

int vl::Viewport::clearStencil | ( | ) | const`[inline]`

Definition at line 91 of file Viewport.hpp.

void vl::Viewport::setClearDepth | ( | Real | depth ) | `[inline]`

Definition at line 93 of file Viewport.hpp.

Real vl::Viewport::clearDepth | ( | ) | const`[inline]`

Definition at line 94 of file Viewport.hpp.

void vl::Viewport::setClearFlags | ( | EClearFlags | clear_flags ) | `[inline]`

Definition at line 96 of file Viewport.hpp.

Referenced by vl::Renderer::render(), and vl::EdgeRenderer::render().

EClearFlags vl::Viewport::clearFlags | ( | ) | const`[inline]`

Definition at line 97 of file Viewport.hpp.

void vl::Viewport::setClearColorMode | ( | EClearColorMode | mode ) | `[inline]`

Definition at line 99 of file Viewport.hpp.

EClearColorMode vl::Viewport::clearColorMode | ( | ) | const`[inline]`

Definition at line 100 of file Viewport.hpp.

Referenced by activate().

bool Viewport::isPointInside | ( | int | x,
|  | int | y,
|  | int | render_target_height
| ) |  | const

Returns true if the given point is inside the Viewport.

Definition at line 138 of file Viewport.cpp.

References height(), width(), x(), and y().

## Member Data Documentation

fvec4 vl::Viewport::mClearColor`[protected]`

Definition at line 108 of file Viewport.hpp.

Referenced by activate(), and Viewport().

ivec4 vl::Viewport::mClearColorInt`[protected]`

Definition at line 109 of file Viewport.hpp.

Referenced by activate().

uvec4 vl::Viewport::mClearColorUInt`[protected]`

Definition at line 110 of file Viewport.hpp.

Referenced by activate().

Real vl::Viewport::mClearDepth`[protected]`

Definition at line 112 of file Viewport.hpp.

Referenced by activate(), and Viewport().

int vl::Viewport::mClearStencil`[protected]`

Definition at line 113 of file Viewport.hpp.

Referenced by activate(), and Viewport().

EClearFlags vl::Viewport::mClearFlags`[protected]`

Definition at line 114 of file Viewport.hpp.

Referenced by activate(), and Viewport().

EClearColorMode vl::Viewport::mClearColorMode`[protected]`

Definition at line 115 of file Viewport.hpp.

Referenced by Viewport().

int vl::Viewport::mX`[protected]`

Definition at line 116 of file Viewport.hpp.

Referenced by activate(), and Viewport().

int vl::Viewport::mY`[protected]`

Definition at line 117 of file Viewport.hpp.

Referenced by activate(), and Viewport().

int vl::Viewport::mWidth`[protected]`

Definition at line 118 of file Viewport.hpp.

Referenced by activate(), and Viewport().

int vl::Viewport::mHeight`[protected]`

Definition at line 119 of file Viewport.hpp.

Referenced by activate(), and Viewport().

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/Viewport.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/Viewport.cpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:47.
Permission is granted to use this page to write and publish articles regarding Visualization Library.