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_Texture & | operator= (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. |
GLC_Texture : Image texture.
Image texture define a texture map in 2 D coordinate system
Definition at line 41 of file glc_texture.h.
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() | |||
) |
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().
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] |
Return the texture File Name.
Definition at line 81 of file glc_texture.h.
Referenced by GLC_Material::hashCode(), operator<<(), GLC_Material::textureFileName(), GLC_WorldTo3dxml::writeCATRepresentationImage(), and GLC_WorldTo3dxml::writeImageFileIn3dxml().
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 |
) |
Load the texture.
Definition at line 194 of file glc_texture.cpp.
References addThisOpenGLTextureId(), m_GlTextureID, m_MaxTextureSize, m_pQGLContext, m_textureImage, and m_TextureSize.
Referenced by glcBindTexture(), and GLC_Material::glLoadTexture().
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] |
Return the an image of the texture.
Definition at line 108 of file glc_texture.h.
Referenced by GLC_ImagePlane::GLC_ImagePlane(), and GLC_WorldTo3dxml::writeImageFileIn3dxml().
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 | ( | ) | [inline, static] |
Return the maximum texture size.
Definition at line 97 of file glc_texture.h.
GLC_Texture & GLC_Texture::operator= | ( | const GLC_Texture & | texture | ) |
Overload "=" operator.
Definition at line 131 of file glc_texture.cpp.
References addThisOpenGLTextureId(), m_FileName, m_GlTextureID, m_HasAlphaChannel, m_pQGLContext, m_textureImage, m_TextureSize, and removeThisOpenGLTextureId().
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, and m_MinTextureSize.
Referenced by GLC_ImagePlane::GLC_ImagePlane().
QSize GLC_Texture::size | ( | ) | const [inline] |
Return the texture size.
Definition at line 93 of file glc_texture.h.
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 [static, private] |
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 [static, private] |
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 [static, private] |
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=().