Visualization Library 2.0.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
Wraps the OpenGL function glDrawPixels(). More...
#include <DrawPixels.hpp>
Classes | |
class | Pixels |
Represents a bitmap to be drawn on the screen. More... | |
Public Member Functions | |
DrawPixels () | |
void | computeBounds_Implementation () |
void | render_Implementation (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context) const |
Renders the bitamps. More... | |
const Collection< Pixels > * | draws () const |
Collection< Pixels > * | draws () |
void | deletePixelBufferObjects () |
deallocate PBOs More... | |
void | releaseImages () |
Iterates on the Pixels objects and sets their Image references to NULL. More... | |
bool | generatePixelBufferObjects (EBufferObjectUsage usage, bool discard_local_storage) |
generates PBOs only for Pixels objects without a PBO handle More... | |
void | setUsePixelBufferObject (bool use_pbo) |
bool | usePixelBufferObject () const |
virtual void | updateDirtyBufferObject (EBufferObjectUpdateMode) |
Uploads the data stored in the local buffers on the GPU memory. More... | |
virtual void | deleteBufferObject () |
Destroys the BufferObject (vertex buffer objects) associated to this a Renderable. More... | |
Public Member Functions inherited from vl::Renderable | |
Renderable () | |
Constructor. More... | |
virtual | ~Renderable () |
Destructor. More... | |
void | render (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context) |
Renders the Renderable and if necessary compiles the display list and updates the BufferObjects. More... | |
void | computeBounds () |
Recomputes the bounding box and bounding sphere of a Renderable. More... | |
long long | boundsUpdateTick () const |
Returns the bounds-update-tick which is a counter incremented every time the bounding box or bounding sphere is updated. More... | |
void | setBoundsDirty (bool dirty) |
Marks the bounding box and bounding sphere as dirty in order to be recomputed at the next rendering. More... | |
bool | boundsDirty () const |
Returns whether the bounding sphere or bounding box are "dirty", that is, meant to be recomputed. More... | |
void | setBoundingBox (const AABB &aabb) |
Sets the bounding box of a Renderable. More... | |
void | setBoundingSphere (const Sphere &sphere) |
Sets the bounding sphere of a Renderable. More... | |
const AABB & | boundingBox () const |
Returns the bounding box of a Renderable without recomputing the bounds if dirty. More... | |
const Sphere & | boundingSphere () const |
Returns the bounding sphere of a Renderable without recomputing the bounds if dirty. More... | |
const AABB & | boundingBox () |
Returns the bounding box of a Renderable recomputing the bounds if dirty. More... | |
const Sphere & | boundingSphere () |
Returns the bounding sphere of a Renderable recomputing the bounds if dirty. More... | |
unsigned int | displayList () const |
Returns the display list associated to a Renderable or 0 (zero) if no display list is associated. More... | |
void | setDisplayList (unsigned int disp_list) |
Manually assciates a display list to a Renderable (to be used with care). More... | |
bool | isDisplayListEnabled () const |
Returns true if display lists are enabled for a Renderable (disabled by default). More... | |
void | setDisplayListEnabled (bool enabled) |
Enable/disable display lists (disabled by default). More... | |
bool | displayListDirty () const |
Whether the display list associated to a Renderable should be recompiled at the next rendering. More... | |
void | setDisplayListDirty (bool dirty) |
Whether the display list associated to a Renderable should be recompiled at the next rendering. More... | |
bool | isBufferObjectEnabled () const |
Returns true if BufferObject (vertex buffer object) are enabled for a Renderable (enabled by default). More... | |
void | setBufferObjectEnabled (bool enabled) |
Enable/disable BufferObject (vertex buffer object) (enabled by default). More... | |
bool | isBufferObjectDirty () const |
Whether BufferObjects associated to a Renderable should be recomputed on the next rendering. More... | |
void | setBufferObjectDirty (bool dirty=true) |
Whether BufferObjects associated to a Renderable should be recomputed on the next rendering. More... | |
void | deleteDisplayList () |
Deletes the display list currently associated to a Renderable. More... | |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
Protected Attributes | |
Collection< Pixels > | mDraws |
bool | mUsePixelBufferObject |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
Additional Inherited Members | |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
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.
Definition at line 60 of file DrawPixels.hpp.
DrawPixels::DrawPixels | ( | ) |
Definition at line 112 of file DrawPixels.cpp.
References mDraws, and mUsePixelBufferObject.
|
inlinevirtual |
Implements vl::Renderable.
Definition at line 134 of file DrawPixels.hpp.
|
inlinevirtual |
Destroys the BufferObject (vertex buffer objects) associated to this a Renderable.
Implements vl::Renderable.
Definition at line 163 of file DrawPixels.hpp.
void DrawPixels::deletePixelBufferObjects | ( | ) |
|
inline |
Definition at line 142 of file DrawPixels.hpp.
Referenced by render_Implementation().
|
inline |
Definition at line 144 of file DrawPixels.hpp.
bool DrawPixels::generatePixelBufferObjects | ( | EBufferObjectUsage | usage, |
bool | discard_local_storage | ||
) |
generates PBOs only for Pixels objects without a PBO handle
Definition at line 276 of file DrawPixels.cpp.
References vl::DrawPixels::Pixels::hasPixelBufferObject(), mDraws, vl::DrawPixels::Pixels::mImage, and NULL.
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, vl::DrawPixels::Pixels::mImage, and NULL.
|
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::Image::byteAlignment(), draws(), vl::Image::format(), vl::BufferObject::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::Actor::transform(), vl::Image::type(), vl::Camera::viewport(), VL_CHECK, VL_CHECK_OGL, vl::Viewport::width(), vl::Image::width(), vl::Transform::worldMatrix(), vl::Viewport::x(), vl::Vector4< T_Scalar >::x(), vl::Vector2< T_Scalar >::x(), vl::Viewport::y(), vl::Vector4< T_Scalar >::y(), and vl::Vector2< T_Scalar >::y().
void DrawPixels::setUsePixelBufferObject | ( | bool | use_pbo | ) |
Definition at line 299 of file DrawPixels.cpp.
References mUsePixelBufferObject.
|
inlinevirtual |
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.
|
inline |
Definition at line 157 of file DrawPixels.hpp.
|
protected |
Definition at line 166 of file DrawPixels.hpp.
Referenced by deletePixelBufferObjects(), DrawPixels(), generatePixelBufferObjects(), releaseImages(), and render_Implementation().
|
protected |
Definition at line 167 of file DrawPixels.hpp.
Referenced by DrawPixels(), and setUsePixelBufferObject().
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:07.
© Copyright Michele Bosi. All rights reserved.