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);
102 void onNetworkReply();
111 GLData() : data(NULL), width(0), height(0), format(0), type(0) {}
119 static GLData imageToGLData(
const QImage &image);
120 static GLData loadFromPath(
const QString &path);
121 static GLData loadFromData(
const QByteArray& data);
127 static QByteArray convertToGLFormat(
const QImage& image, GLint* format, GLint* type);
131 void reportError(
const QString& errorMessage);
136 bool glLoad(
const QImage& image);
138 bool glLoad(
const GLData& data);
140 StelTextureParams loadParams;
143 QNetworkReply *networkReply;
159 QString errorMessage;
172 #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...
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.