# Visualization Library

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

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

Classes | Public Member Functions | Protected Attributes

# vl::DrawPixels Class Reference

Wraps the OpenGL function glDrawPixels(). More...

`#include <DrawPixels.hpp>`

Inheritance diagram for vl::DrawPixels:

List of all members.

## Classes

class | Pixels
| Represents a bitmap to be drawn on the screen. More...

## Public Member Functions

| DrawPixels ()
virtual const char * | className ()
| Returns the name of the class.
void | computeBounds_Implementation ()
void | render_Implementation (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context) const
| Renders the bitamps.
const Collection< Pixels > * | draws () const
Collection< Pixels > * | draws ()
void | deletePixelBufferObjects ()
| deallocate PBOs
void | releaseImages ()
| Iterates on the Pixels objects and sets their Image references to NULL.
bool | generatePixelBufferObjects (EGLBufferUsage usage, bool discard_local_storage)
| generates PBOs only for Pixels objects without a PBO handle
void | setUsePixelBufferObject (bool use_pbo)
bool | usePixelBufferObject () const
void | updateVBOs (bool, bool)
| Uploads the data stored in the local buffers on the GPU memory.

## Protected Attributes

Collection< Pixels > | mDraws
bool | mUsePixelBufferObject

## Detailed Description

Wraps the OpenGL function glDrawPixels().

Bind it to an Actor in order to render one or more bitmaps on the screen. DrawPixels supports multiple bitmaps, can draw a subsection of a bitmap, and supports also PBOs (GL_EXT_pixel_buffer_object). See also DrawPixels::Pixels.

Note:
  If the given Actor has an associated transform the bitmap position will follow it.

Remarks:
  Be aware that depth test, stencil test, alpha test, clipping planes etc. can affect the rendering of the bitmap. Since this function uses the glRasterPos OpenGL function lighting, texturing and the current color might affect the rendering. For more information look at the glRasterPos documentation.

Definition at line 60 of file DrawPixels.hpp.

## Constructor & Destructor Documentation

DrawPixels::DrawPixels | ( | ) |

Definition at line 112 of file DrawPixels.cpp.

References mDraws, mUsePixelBufferObject, and vl::Object::setAutomaticDelete().

## Member Function Documentation

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

Returns the name of the class.

Reimplemented from vl::Renderable.

Definition at line 132 of file DrawPixels.hpp.

void vl::DrawPixels::computeBounds_Implementation | ( | ) | `[inline, virtual]`

Implements vl::Renderable.

Definition at line 134 of file DrawPixels.hpp.

void DrawPixels::render_Implementation | ( | const Actor * | actor,
|  | const Shader * | shader,
|  | const Camera * | camera,
|  | OpenGLContext * | gl_context
| ) |  | const`[virtual]`

Renders the bitamps.

If camera != NULL and actor != NULL and actor->transform() != NULL then the bitmaps position will follow the Actor's Transform. The `renderer` parameter is ignored.

Implements vl::Renderable.

Definition at line 118 of file DrawPixels.cpp.

References vl::DrawPixels::Pixels::align(), vl::AlignHCenter, vl::AlignRight, vl::AlignTop, vl::AlignVCenter, vl::Collection< T >::at(), vl::Image::byteAlignment(), draws(), vl::Image::format(), vl::GLBufferObject::handle(), vl::Viewport::height(), vl::DrawPixels::Pixels::image(), vl::Image::isValid(), mDraws, vl::DrawPixels::Pixels::mPosition, vl::DrawPixels::Pixels::mSize, vl::DrawPixels::Pixels::mStart, vl::ImagePBO::pixelBufferObject(), vl::Image::pixels(), vl::Camera::project(), vl::Collection< T >::size(), vl::Actor::transform(), vl::Image::type(), vl::Camera::viewport(), VL_CHECK, VL_CHECK_OGL, vl::VL_glBindBuffer(), vl::Image::width(), vl::Viewport::width(), vl::ITransform::worldMatrix(), vl::Vector4< T_Scalar >::x(), vl::Vector2< T_Scalar >::x(), vl::Viewport::x(), vl::Vector4< T_Scalar >::y(), vl::Vector2< T_Scalar >::y(), and vl::Viewport::y().

const Collection<Pixels>* vl::DrawPixels::draws | ( | ) | const`[inline]`

Definition at line 142 of file DrawPixels.hpp.

Referenced by render_Implementation().

Collection<Pixels>* vl::DrawPixels::draws | ( | ) | `[inline]`

Definition at line 144 of file DrawPixels.hpp.

void DrawPixels::deletePixelBufferObjects | ( | ) |

deallocate PBOs

Definition at line 259 of file DrawPixels.cpp.

References mDraws, vl::Collection< T >::size(), and VL_CHECK_OGL.

void DrawPixels::releaseImages | ( | ) |

Iterates on the Pixels objects and sets their Image references to NULL.

Definition at line 269 of file DrawPixels.cpp.

References mDraws, and vl::Collection< T >::size().

bool DrawPixels::generatePixelBufferObjects | ( | EGLBufferUsage | usage,
|  | bool | discard_local_storage
| ) |  |

generates PBOs only for Pixels objects without a PBO handle

Definition at line 276 of file DrawPixels.cpp.

References mDraws, and vl::Collection< T >::size().

void DrawPixels::setUsePixelBufferObject | ( | bool | use_pbo ) |

Definition at line 299 of file DrawPixels.cpp.

References mUsePixelBufferObject.

bool vl::DrawPixels::usePixelBufferObject | ( | ) | const`[inline]`

Definition at line 157 of file DrawPixels.hpp.

void vl::DrawPixels::updateVBOs | ( | bool | discard_local_data,
|  | bool | force_update
| ) |  | `[inline, virtual]`

Uploads the data stored in the local buffers on the GPU memory.

If 'discard_local_data' is set to `true` the memory used by the local buffers is released.

Implements vl::Renderable.

Definition at line 161 of file DrawPixels.hpp.

## Member Data Documentation

Collection<Pixels> vl::DrawPixels::mDraws`[protected]`

Definition at line 164 of file DrawPixels.hpp.

Referenced by deletePixelBufferObjects(), DrawPixels(), generatePixelBufferObjects(), releaseImages(), and render_Implementation().

bool vl::DrawPixels::mUsePixelBufferObject`[protected]`

Definition at line 165 of file DrawPixels.hpp.

Referenced by DrawPixels(), and setUsePixelBufferObject().

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

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

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