20 #ifndef _STELTEXTURE_HPP_ 21 #define _STELTEXTURE_HPP_ 24 #include "StelOpenGL.hpp" 34 #ifndef GL_CLAMP_TO_EDGE 35 #define GL_CLAMP_TO_EDGE 0x812F 49 StelTextureParams(
bool qgenerateMipmaps=
false, GLint afiltering=GL_LINEAR, GLint awrapMode=GL_CLAMP_TO_EDGE,
bool qfilterMipmaps=
false) :
71 bool bind(
int slot=0);
105 void onNetworkReply();
114 GLData() : data(NULL), width(0), height(0), format(0), type(0) {}
122 static GLData imageToGLData(
const QImage &image);
123 static GLData loadFromPath(
const QString &path);
124 static GLData loadFromData(
const QByteArray& data);
130 static QByteArray convertToGLFormat(
const QImage& image, GLint* format, GLint* type);
134 void reportError(
const QString& errorMessage);
139 bool glLoad(
const QImage& image);
141 bool glLoad(
const GLData& data);
149 QNetworkReply *networkReply;
165 QString errorMessage;
181 #endif // _STELTEXTURE_HPP_ bool isLoading() const
Return whether the image is currently being loaded.
Contains the parameters defining how a texture is created.
bool bind(int slot=0)
Bind the texture so that it can be used for openGL drawing (calls glBindTexture). ...
Define the StelTextureSP type.
const QString & getFullPath() const
Return the full path to the image file.
bool hasAlphaChannel() const
Returns whether the texture has an alpha channel (GL_RGBA or GL_LUMINANCE_ALPHA format) This only ret...
bool canBind() const
Return whether the texture can be binded, i.e. it is fully loaded.
GLint wrapMode
Define the wrapping mode to use. Must be one of GL_CLAMP_TO_EDGE, or GL_REPEAT.
const QString & getErrorMessage() const
Get the error message which caused the texture loading to fail.
bool filterMipmaps
If true, mipmapped textures are filtered with GL_LINEAR_MIPMAP_LINEAR instead of GL_LINEAR_MIPMAP_NEA...
unsigned int getGlSize() const
Return texture memory size.
bool generateMipmaps
Define if mipmaps must be created.
GLint filtering
Define the scaling filter to use. Must be one of GL_NEAREST or GL_LINEAR.
virtual ~StelTexture()
Destructor.
void loadingProcessFinished(bool error)
Emitted when the texture is ready to be bind(), i.e.
bool getDimensions(int &width, int &height)
Return the width and heigth of the texture in pixels.