Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure

StelTextureMgr Class Reference

Manage textures loading and manipulation. More...

#include <StelTextureMgr.hpp>

List of all members.

Public Member Functions

void init ()
StelTextureSP createTexture (const QString &filename)
StelTextureSP createTextureThread (const QString &url, const QString &fileExtension="", bool lazyLoading=true)
void setMipmapsMode (bool b=false)
void setWrapMode (GLint m=GL_CLAMP)
void setMinFilter (GLint m=GL_NEAREST)
void setMagFilter (GLint m=GL_LINEAR)
void setDefaultParams ()
void setDynamicRangeMode (StelTextureTypes::DynamicRangeMode dMode=StelTextureTypes::Linear)
void registerImageLoader (const QString &fileExtension, ImageLoader *loader)


Detailed Description

Manage textures loading and manipulation.

The texture loader has a current state defining the way the textures will be loaded in memory, that is, whether mimap should be generated, the wrap mode or mag and min filters. The state should be reinitialized by calling the StelTextureMgr::setDefaultParams method before any texture loading. It provides function for loading images in a separate threads.


Member Function Documentation

void StelTextureMgr::init (  ) 

Initialize some variable from the openGL contex.

Must be called after the creation of the GLContext.

StelTextureSP StelTextureMgr::createTexture ( const QString &  filename  ) 

Load an image from a file and create a new texture from it.

Parameters:
filename the texture file name, can be absolute path if starts with '/' otherwise the file will be looked in stellarium standard textures directories.

StelTextureSP StelTextureMgr::createTextureThread ( const QString &  url,
const QString &  fileExtension = "",
bool  lazyLoading = true 
)

Load an image from a file and create a new texture from it in a new thread.

Parameters:
url the texture file name or URL, can be absolute path if starts with '/' otherwise the file will be looked in stellarium standard textures directories.
fileExtension the file extension to assume. If not set the extension is determined from url
lazyLoading define whether the texture should be actually loaded only when needed, i.e. when bind() is called the first time.

void StelTextureMgr::setMipmapsMode ( bool  b = false  )  [inline]

Define if mipmaps must be created while creating textures.

void StelTextureMgr::setWrapMode ( GLint  m = GL_CLAMP  )  [inline]

Define the texture wrapping mode to use while creating textures.

Parameters:
m can be either GL_CLAMP, GL_CLAMP_TO_EDGE, or GL_REPEAT. See doc for glTexParameter for more info.

void StelTextureMgr::setMinFilter ( GLint  m = GL_NEAREST  )  [inline]

Define the texture min filter to use while creating textures.

Parameters:
m can be either GL_NEAREST, GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_LINEAR See doc for glTexParameter for more info.

void StelTextureMgr::setMagFilter ( GLint  m = GL_LINEAR  )  [inline]

Define the texture magnification filter to use while creating textures.

Parameters:
m can be either GL_NEAREST, GL_LINEAR See doc for glTexParameter for more info.

void StelTextureMgr::setDefaultParams (  ) 

Set default parameters for Mipmap mode, wrap mode, min and mag filters.

void StelTextureMgr::setDynamicRangeMode ( StelTextureTypes::DynamicRangeMode  dMode = StelTextureTypes::Linear  )  [inline]

Define how the dynamic range of the image will be adapted to fit on 8 bits Note that using linear mode on 8 bits images does nothing.

void StelTextureMgr::registerImageLoader ( const QString &  fileExtension,
ImageLoader loader 
) [inline]

Register a new image loader for a given image file extension.


Generated on Mon Feb 2 17:23:48 2009 for Stellarium by  doxygen 1.5.5