- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ufo::UGL_Image Class Reference

OpenGL implementation of an image. More...

#include <ugl_image.hpp>

Inheritance diagram for ufo::UGL_Image:

ufo::UImage ufo::UDrawable ufo::UVolatileData ufo::UObject ufo::UObject ufo::UCollectable ufo::UCollectable List of all members.

Public Member Functions

 UGL_Image (const std::string &fileName, bool lazy=true, bool autoRefresh=true, GLenum imageFormat=0, GLenum internalFormat=0)
 UGL_Image (UImageIO *imageIO, bool lazy=true, bool autoRefresh=true, GLenum imageFormat=0, GLenum internalFormat=0)
virtual UDimension getImageSize () const
virtual int getImageComponents () const
virtual unsigned long handle () const
UDimension getSize () const
void paint (UGraphics *g)
void paint (UGraphics *g, const UPoint &location)
void paint (UGraphics *g, const URectangle &rect)
void paintSubImage (UGraphics *g, const URectangle &rect, const UPoint &dest)
void paintSubImage (UGraphics *g, const URectangle &rect, const URectangle &dest)
void dispose ()
void disposeGL ()
void refresh ()
void setQuality (int quality)
int getQuality () const

Protected Member Functions

virtual bool createGLTexture (GLubyte *dataA, int componentsA, GLenum imageFormatA, GLenum internalFormatA)
void ensureImage ()
int round2 (int n)

Detailed Description

OpenGL implementation of an image.

Loads and paints OpenGL textures to screen.

Author:
Johannes Schmidt


Constructor & Destructor Documentation

ufo::UGL_Image::UGL_Image const std::string &  fileName,
bool  lazy = true,
bool  autoRefresh = true,
GLenum  imageFormat = 0,
GLenum  internalFormat = 0
 

Creates an OpenGL texture from the given file.

Parameters:
fileName The image file
lazy If true, loads the texture on request (otherwise immediately)
autoRefresh When true recreates automatically the OpenGL texture on GL context recreation
imageFormat The format used to interpret the image data
internalFormat The format used to save the texture in the VRAM

ufo::UGL_Image::UGL_Image UImageIO imageIO,
bool  lazy = true,
bool  autoRefresh = true,
GLenum  imageFormat = 0,
GLenum  internalFormat = 0
 

Creates an OpenGL texture from the given image IO data.

Parameters:
imageIO the image data
lazy If true, loads the texture on request (otherwise immediately)
autoRefresh When true recreates automatically the OpenGL texture on GL context recreation
imageFormat The format used to interpret the image data
internalFormat The format used to save the texture in the VRAM


Member Function Documentation

virtual bool ufo::UGL_Image::createGLTexture GLubyte *  dataA,
int  componentsA,
GLenum  imageFormatA,
GLenum  internalFormatA
[protected, virtual]
 

makes a openGL texture

void ufo::UGL_Image::dispose  ) 
 

Disposes the saved image data which is normally used to do an auto refresh.

void ufo::UGL_Image::disposeGL  ) 
 

Disposes the OpenGL texture. The texture can be recreated using refresh as long as it was created with autoRefresh enabled.

virtual int ufo::UGL_Image::getImageComponents  )  const [virtual]
 

Returns:
The number of bytes used for one pixel.

Implements ufo::UImage.

virtual UDimension ufo::UGL_Image::getImageSize  )  const [virtual]
 

Returns:
The size of the image.

Implements ufo::UImage.

UDimension ufo::UGL_Image::getSize  )  const
 

Returns:
The size of the image as UDimension

virtual unsigned long ufo::UGL_Image::handle  )  const [virtual]
 

Returns the system dependent image handle, if any. This may be the OpenGL index for OpenGL backends.

Returns:
The system dependent image handle or 0.

Reimplemented from ufo::UImage.

void ufo::UGL_Image::paint UGraphics g,
const URectangle rect
 

paints the texture and scale it if it is necessary

void ufo::UGL_Image::paint UGraphics g,
const UPoint location
 

Paints the texture with an offset of x, y.

void ufo::UGL_Image::paint UGraphics g  ) 
 

paints the texture

void ufo::UGL_Image::paintSubImage UGraphics g,
const URectangle rect,
const URectangle dest
 

Paints sub rectangle rect of this image in the destination rect dest.

Parameters:
g The graphics object
rect The sub rect
dest The destination rect for painting

void ufo::UGL_Image::paintSubImage UGraphics g,
const URectangle rect,
const UPoint dest
 

Paints sub rectangle rect of this image at destination dest.

Parameters:
g The graphics object
rect The sub rect
dest The destination location for painting

void ufo::UGL_Image::refresh  )  [virtual]
 

Refreshes the OpenGL texture using the saved image data.

Reimplemented from ufo::UImage.

int ufo::UGL_Image::round2 int  n  )  [protected]
 

rounds to the next power of two

void ufo::UGL_Image::setQuality int  quality  ) 
 

0 == default, 1 = nearest, 2 = linear, 3 = mipmap.


The documentation for this class was generated from the following file:
The libUFO Project - written by Johannes Schmidt