GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Private Attributes | Static Private Attributes | List of all members
GLC_Texture Class Reference

GLC_Texture : Image texture. More...

#include <glc_texture.h>

Public Member Functions

Constructor / Destructor
 GLC_Texture ()
 Default constructor.
 
 GLC_Texture (const QString &)
 Constructor with fileName.
 
 GLC_Texture (const QFile &)
 Constructor with QFile.
 
 GLC_Texture (const QImage &, const QString &fileName=QString())
 Constructor with QImage.
 
 GLC_Texture (const GLC_Texture &TextureToCopy)
 Copy constructor.
 
GLC_Textureoperator= (const GLC_Texture &)
 Overload "=" operator.
 
virtual ~GLC_Texture ()
 Default Destructor.
 
OpenGL Functions
void glLoadTexture (QGLContext *pContext=NULL)
 Load the texture.
 
void glcBindTexture (void)
 Bind texture in 2D mode.
 

Static Public Member Functions

Set Functions
static void setMaxTextureSize (const QSize &)
 

Private Member Functions

Private services functions
QImage loadFromFile (const QString &fileName)
 Load the image of this texture from the given fileName and return resutling image.
 
void removeThisOpenGLTextureId ()
 Remove this Opengl texture id.
 
void addThisOpenGLTextureId ()
 Add this Opengl texture id.
 

Private Attributes

QGLContext * m_pQGLContext
 OpenGL Context.
 
QString m_FileName
 Texture Name.
 
GLuint m_GlTextureID
 OpenGL Texture ID.
 
QImage m_textureImage
 QImage off the texture.
 
QSize m_TextureSize
 Size of the texture.
 
bool m_HasAlphaChannel
 Flag to know if the texture has alpha channel.
 

Static Private Attributes

static QSize m_MaxTextureSize
 Static member used to check texture size.
 
static const QSize m_MinTextureSize
 
static QHash< GLuint, int > m_TextureIdUsage
 Static hash table to manage OpenGL testure ID.
 

Get Functions

QGLContext * context () const
 Return the QGLContext of the texture.
 
QString fileName () const
 Return the texture File Name.
 
GLuint GL_ID () const
 Return OpenGL Texture Id.
 
bool isLoaded () const
 Return true if the texture is loaded.
 
QSize size () const
 Return the texture size.
 
bool operator== (const GLC_Texture &) const
 Return true if texture are the same.
 
bool hasAlphaChannel () const
 Return true if the texture has alpha channel.
 
QImage imageOfTexture () const
 Return the an image of the texture.
 
static QSize maxSize ()
 Return the maximum texture size.
 

Detailed Description

GLC_Texture : Image texture.

Image texture define a texture map in 2 D coordinate system

Definition at line 41 of file glc_texture.h.

Constructor & Destructor Documentation

GLC_Texture::GLC_Texture ( )

Default constructor.

Definition at line 49 of file glc_texture.cpp.

GLC_Texture::GLC_Texture ( const QString &  Filename)

Constructor with fileName.

Definition at line 61 of file glc_texture.cpp.

References m_FileName, and m_textureImage.

GLC_Texture::GLC_Texture ( const QFile &  file)

Constructor with QFile.

Definition at line 79 of file glc_texture.cpp.

References m_FileName, and m_textureImage.

GLC_Texture::GLC_Texture ( const QImage &  image,
const QString &  fileName = QString() 
)

Constructor with QImage.

Definition at line 99 of file glc_texture.cpp.

References m_textureImage.

GLC_Texture::GLC_Texture ( const GLC_Texture TextureToCopy)

Copy constructor.

Definition at line 110 of file glc_texture.cpp.

References addThisOpenGLTextureId(), m_FileName, and m_textureImage.

GLC_Texture::~GLC_Texture ( )
virtual

Default Destructor.

Definition at line 148 of file glc_texture.cpp.

References removeThisOpenGLTextureId().

Member Function Documentation

void GLC_Texture::addThisOpenGLTextureId ( )
private

Add this Opengl texture id.

Definition at line 311 of file glc_texture.cpp.

References m_GlTextureID, and m_TextureIdUsage.

Referenced by GLC_Texture(), glLoadTexture(), and operator=().

QGLContext* GLC_Texture::context ( ) const
inline

Return the QGLContext of the texture.

Definition at line 77 of file glc_texture.h.

QString GLC_Texture::fileName ( ) const
inline
GLuint GLC_Texture::GL_ID ( ) const
inline

Return OpenGL Texture Id.

Definition at line 85 of file glc_texture.h.

Referenced by GLC_Material::textureID().

void GLC_Texture::glcBindTexture ( void  )

Bind texture in 2D mode.

Definition at line 235 of file glc_texture.cpp.

References glLoadTexture(), and m_GlTextureID.

Referenced by GLC_Material::glExecute().

void GLC_Texture::glLoadTexture ( QGLContext *  pContext = NULL)
bool GLC_Texture::hasAlphaChannel ( ) const
inline

Return true if the texture has alpha channel.

Definition at line 104 of file glc_texture.h.

QImage GLC_Texture::imageOfTexture ( ) const
inline
bool GLC_Texture::isLoaded ( ) const
inline

Return true if the texture is loaded.

Definition at line 89 of file glc_texture.h.

Referenced by GLC_Material::textureIsLoaded().

QImage GLC_Texture::loadFromFile ( const QString &  fileName)
private

Load the image of this texture from the given fileName and return resutling image.

Definition at line 244 of file glc_texture.cpp.

References glc::archiveEntryFileName(), glc::archiveFileName(), and glc::isArchiveString().

static QSize GLC_Texture::maxSize ( )
inlinestatic

Return the maximum texture size.

Definition at line 97 of file glc_texture.h.

GLC_Texture & GLC_Texture::operator= ( const GLC_Texture texture)
bool GLC_Texture::operator== ( const GLC_Texture texture) const

Return true if texture are the same.

Definition at line 158 of file glc_texture.cpp.

References m_FileName, and m_textureImage.

void GLC_Texture::removeThisOpenGLTextureId ( )
private

Remove this Opengl texture id.

Definition at line 296 of file glc_texture.cpp.

References m_GlTextureID, m_pQGLContext, and m_TextureIdUsage.

Referenced by operator=(), and ~GLC_Texture().

void GLC_Texture::setMaxTextureSize ( const QSize &  size)
static

Definition at line 177 of file glc_texture.cpp.

References m_MaxTextureSize, m_MinTextureSize, and size().

Referenced by GLC_ImagePlane::GLC_ImagePlane().

QSize GLC_Texture::size ( void  ) const
inline

Return the texture size.

Definition at line 93 of file glc_texture.h.

Referenced by setMaxTextureSize().

Member Data Documentation

QString GLC_Texture::m_FileName
private

Texture Name.

Definition at line 159 of file glc_texture.h.

Referenced by GLC_Texture(), operator=(), and operator==().

GLuint GLC_Texture::m_GlTextureID
private

OpenGL Texture ID.

Definition at line 162 of file glc_texture.h.

Referenced by addThisOpenGLTextureId(), glcBindTexture(), glLoadTexture(), operator=(), and removeThisOpenGLTextureId().

bool GLC_Texture::m_HasAlphaChannel
private

Flag to know if the texture has alpha channel.

Definition at line 171 of file glc_texture.h.

Referenced by operator=().

QSize GLC_Texture::m_MaxTextureSize
staticprivate

Static member used to check texture size.

Definition at line 174 of file glc_texture.h.

Referenced by glLoadTexture(), and setMaxTextureSize().

const QSize GLC_Texture::m_MinTextureSize
staticprivate

Definition at line 175 of file glc_texture.h.

Referenced by setMaxTextureSize().

QGLContext* GLC_Texture::m_pQGLContext
private

OpenGL Context.

Definition at line 156 of file glc_texture.h.

Referenced by glLoadTexture(), operator=(), and removeThisOpenGLTextureId().

QHash< GLuint, int > GLC_Texture::m_TextureIdUsage
staticprivate

Static hash table to manage OpenGL testure ID.

Definition at line 178 of file glc_texture.h.

Referenced by addThisOpenGLTextureId(), and removeThisOpenGLTextureId().

QImage GLC_Texture::m_textureImage
private

QImage off the texture.

Definition at line 165 of file glc_texture.h.

Referenced by GLC_Texture(), glLoadTexture(), operator=(), and operator==().

QSize GLC_Texture::m_TextureSize
private

Size of the texture.

Definition at line 168 of file glc_texture.h.

Referenced by glLoadTexture(), and operator=().


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

©2005-2013 Laurent Ribon