ADTF Display Toolbox
Loading...
Searching...
No Matches
cGLTexture

OpenGL texture class. More...

#include <gltexture.h>

Inheritance diagram for cGLTexture:
[legend]

Public Member Functions

tResult Create (const tBitmapFormat *psFormat, tInt nMode=0)
 
tResult CleanUp ()
 
tBool IsCompatible (const tBitmapFormat *psFormat)
 
tVoid Blit (tInt x, tInt y, tInt nWidth, tInt nHeight)
 Blits a texture to the given rectangle.
 
 operator ITexture * ()
 instance of ITexture
 
- Public Member Functions inherited from ITexture
virtual ~ITexture ()
 virtual destructor to ensure proper cleanup.
 
virtual tResult Release ()=0
 The Function releases the Texture.
 
virtual tResult SetMode (tInt nMode)=0
 Set the Mode shown in tTextureMode.
 
virtual tVoid MakeCurrent ()=0
 Sets this texture as the current texture.
 
virtual tResult Copy (IImage *pSource)=0
 Fills the texture using a IImage.
 
virtual tInt GetWidth () const =0
 Gets the width of a texture (in pixel).
 
virtual tInt GetHeight () const =0
 Gets the height of a texture (in pixel).
 
virtual tInt GetBitsPerPixel () const =0
 Gets the number of bits per line of a texture.
 
virtual tInt GetPhysicalWidth () const =0
 Gets the physical width of the texture (in byte).
 
virtual tInt GetPhysicalHeight () const =0
 Gets the physical height of the texture (in byte).
 

Static Public Member Functions

static tResult CalcOpenGLTextureFormat (const tBitmapFormat *pBitmapInfo, GLenum *pPixelType, GLenum *pBitmapFormat, GLint *pBitmapFormatInternal)
 Calculates an OpenGL texture format based on a bitmap format.
 

Protected Attributes

tUInt m_hTexture
 
tInt m_nPhysicalWidth
 
tInt m_nPhysicalHeight
 
tBitmapFormat m_sFormat
 
ITexture::tTextureMode m_nMode
 

Additional Inherited Members

- Public Types inherited from ITexture
enum  tTextureMode { MODE_BilinearFiltered , MODE_NearestPixel }
 The enumeration shows the texture modes. More...
 

Detailed Description

OpenGL texture class.

Definition at line 84 of file gltexture.h.

Constructor & Destructor Documentation

◆ cGLTexture()

cGLTexture ( )
inline

Definition at line 94 of file gltexture.h.

◆ ~cGLTexture()

~cGLTexture ( )
inline

Definition at line 102 of file gltexture.h.

Member Function Documentation

◆ Blit()

tVoid Blit ( tInt x,
tInt y,
tInt nWidth,
tInt nHeight )
inline

Blits a texture to the given rectangle.

The whole texture will be placed into that rectangle. Colorizing the texture by using ICanvas::Color() is not possible, because the color is set to white and the previous color is restored after blitting

Parameters
x[in] starting position inside canvas
y[in] starting position inside canvas
nWidth[in] width of the destination rectangle which receives the texture
nHeight[in] height of the destination rectangle which receives the texture
Returns
tVoid

Definition at line 521 of file gltexture.h.

References m_hTexture, m_nPhysicalHeight, m_nPhysicalWidth, m_sFormat, and ITexture::MakeCurrent().

◆ CalcOpenGLTextureFormat()

static tResult CalcOpenGLTextureFormat ( const tBitmapFormat * pBitmapInfo,
GLenum * pPixelType,
GLenum * pBitmapFormat,
GLint * pBitmapFormatInternal )
inlinestatic

Calculates an OpenGL texture format based on a bitmap format.

Parameters
[in]pBitmapInfoThe input bitmap format.
[out]pPixelTypeThe OpenGL pixel type.
[out]pBitmapFormatThe OpenGL bitmap format.
[out]pBitmapFormatInternalThe internal OpenGL bitmap format.
Returns
The standard result code.

Definition at line 572 of file gltexture.h.

References tBitmapFormat::nPixelFormat, IImage::PF_16BIT, IImage::PF_24BIT, IImage::PF_32BIT, IImage::PF_8BIT, IImage::PF_ABGR_1555, IImage::PF_ABGR_8888, IImage::PF_ARGB_1555, IImage::PF_ARGB_8888, IImage::PF_BGR_888, IImage::PF_BGRA_5551, IImage::PF_BGRA_8888, IImage::PF_BGRx_8888, IImage::PF_GREYSCALE_16, IImage::PF_GREYSCALE_24, IImage::PF_GREYSCALE_32, IImage::PF_GREYSCALE_8, IImage::PF_RGB_555, IImage::PF_RGB_565, IImage::PF_RGB_888, IImage::PF_RGBA_5551, IImage::PF_RGBA_8888, IImage::PF_RGBx_8888, IImage::PF_xBGR_8888, IImage::PF_xRGB_8888, and IImage::PF_YUV420P_888.

Referenced by Create().

◆ CleanUp()

tResult CleanUp ( )
inline
Returns
The standard result code.

Definition at line 186 of file gltexture.h.

References m_hTexture, and m_sFormat.

Referenced by Create().

◆ Create()

tResult Create ( const tBitmapFormat * psFormat,
tInt nMode = 0 )
inline

◆ IsCompatible()

tBool IsCompatible ( const tBitmapFormat * psFormat)
inline
Parameters
psFormat[in] todo
Returns
todo

Definition at line 500 of file gltexture.h.

References m_sFormat, tBitmapFormat::nBitsPerPixel, tBitmapFormat::nHeight, tBitmapFormat::nPaletteSize, and tBitmapFormat::nWidth.

◆ operator ITexture *()

operator ITexture * ( )
inlineexplicit

instance of ITexture

Returns
object

Definition at line 798 of file gltexture.h.

Member Data Documentation

◆ m_hTexture

tUInt m_hTexture
protected

Definition at line 87 of file gltexture.h.

Referenced by Blit(), CleanUp(), and Create().

◆ m_nMode

ITexture::tTextureMode m_nMode
protected

Definition at line 91 of file gltexture.h.

Referenced by Create().

◆ m_nPhysicalHeight

tInt m_nPhysicalHeight
protected

Definition at line 89 of file gltexture.h.

Referenced by Blit(), and Create().

◆ m_nPhysicalWidth

tInt m_nPhysicalWidth
protected

Definition at line 88 of file gltexture.h.

Referenced by Blit(), and Create().

◆ m_sFormat

tBitmapFormat m_sFormat
protected

Definition at line 90 of file gltexture.h.

Referenced by Blit(), CleanUp(), Create(), and IsCompatible().