Stellarium  0.16.1
List of all members | Classes | Signals | Public Member Functions | Friends
StelTexture Class Reference

Base texture class. More...

#include <StelTexture.hpp>

+ Inheritance diagram for StelTexture:
+ Collaboration diagram for StelTexture:

Classes

struct  StelTextureParams
 Contains the parameters defining how a texture is created. More...
 

Signals

void loadingProcessFinished (bool error)
 Emitted when the texture is ready to be bind(), i.e. More...
 

Public Member Functions

virtual ~StelTexture ()
 Destructor. More...
 
bool bind (int slot=0)
 Bind the texture so that it can be used for openGL drawing (calls glBindTexture). More...
 
void release () const
 Releases the currently bound texture without testing if it is currently bound, i.e. More...
 
void waitForLoaded ()
 Waits until the texture data is ready for usage (i.e. More...
 
bool canBind () const
 Return whether the texture can be binded, i.e. it is fully loaded. More...
 
bool getDimensions (int &width, int &height)
 Return the width and heigth of the texture in pixels. More...
 
bool hasAlphaChannel () const
 Returns whether the texture has an alpha channel (GL_RGBA or GL_LUMINANCE_ALPHA format) This only returns valid information after the texture is fully loaded. More...
 
const QString & getErrorMessage () const
 Get the error message which caused the texture loading to fail. More...
 
bool hasError () const
 Returns true if a loading error occurred. More...
 
const QString & getFullPath () const
 Return the full path to the image file. More...
 
bool isLoading () const
 Return whether the image is currently being loaded. More...
 
unsigned int getGlSize () const
 Return texture memory size. More...
 

Friends

class StelTextureMgr
 

Detailed Description

Base texture class.

For creating an instance, use StelTextureMgr::createTexture() and StelTextureMgr::createTextureThread()

See also
StelTextureSP

Definition at line 41 of file StelTexture.hpp.

Constructor & Destructor Documentation

virtual StelTexture::~StelTexture ( )
virtual

Destructor.

Member Function Documentation

bool StelTexture::bind ( int  slot = 0)

Bind the texture so that it can be used for openGL drawing (calls glBindTexture).

If the texture is lazyly loaded, this starts the loading and return false immediately.

Returns
true if the binding successfully occured, false if the texture is not yet loaded.
bool StelTexture::canBind ( ) const
inline

Return whether the texture can be binded, i.e. it is fully loaded.

Definition at line 81 of file StelTexture.hpp.

bool StelTexture::getDimensions ( int &  width,
int &  height 
)

Return the width and heigth of the texture in pixels.

const QString& StelTexture::getErrorMessage ( ) const
inline

Get the error message which caused the texture loading to fail.

Returns
the human friendly error message or empty string if no errors occured

Definition at line 92 of file StelTexture.hpp.

const QString& StelTexture::getFullPath ( ) const
inline

Return the full path to the image file.

If the texture was downloaded from a remote location, this function return the full URL.

Definition at line 99 of file StelTexture.hpp.

unsigned int StelTexture::getGlSize ( ) const
inline

Return texture memory size.

Definition at line 105 of file StelTexture.hpp.

bool StelTexture::hasAlphaChannel ( ) const
inline

Returns whether the texture has an alpha channel (GL_RGBA or GL_LUMINANCE_ALPHA format) This only returns valid information after the texture is fully loaded.

Definition at line 88 of file StelTexture.hpp.

bool StelTexture::hasError ( ) const
inline

Returns true if a loading error occurred.

Definition at line 95 of file StelTexture.hpp.

bool StelTexture::isLoading ( ) const
inline

Return whether the image is currently being loaded.

Definition at line 102 of file StelTexture.hpp.

void StelTexture::loadingProcessFinished ( bool  error)
signal

Emitted when the texture is ready to be bind(), i.e.

when downloaded, imageLoading and glLoading is over or when an error occured and the texture will never be available In case of error, you can query what the problem was by calling getErrorMessage()

Parameters
erroris equal to true if an error occured while loading the texture
void StelTexture::release ( ) const
inline

Releases the currently bound texture without testing if it is currently bound, i.e.

it simply calls glBindTexture(GL_TEXTURE_2D, 0)

Definition at line 74 of file StelTexture.hpp.

void StelTexture::waitForLoaded ( )

Waits until the texture data is ready for usage (i.e.

bind will return true after this). Do not use this for potentially network loaded textures.


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