Stellarium 0.12.1
List of all members | Public Member Functions | Static Public Member Functions
StelQGLTextureBackend Class Reference

Texture backend based on QGL, usable with both GL1 and GL2. More...

#include <StelQGLTextureBackend.hpp>

Public Member Functions

 ~StelQGLTextureBackend ()
 Destroy the StelQGLTextureBackend. Must be called before the Renderer is destroyed. More...
 
void bind (const int textureUnit)
 Called by QGLRenderer to bind the texture to specified texture unit. More...
 
void startAsynchronousLoading ()
 Start asynchrounously loading the texture in a separate thread. More...
 
- Public Member Functions inherited from StelTextureBackend
virtual ~StelTextureBackend ()
 Destroy the texture. More...
 
TextureStatus getStatus () const
 Get the current texture status. More...
 
const QString & getName () const
 Get the "name" of this texture. More...
 
QSize getDimensions () const
 Get texture dimensions in pixels. More...
 
const QString & getErrorMessage () const
 Get a human-readable message describing the error that happened during loading (if any). More...
 

Static Public Member Functions

static StelQGLTextureBackendconstructFromImage (class StelQGLRenderer *renderer, const QString &path, const TextureParams &params, QImage &image)
 Construct a StelQGLTextureBackend from an image. More...
 
static StelQGLTextureBackendconstructFromPVR (class StelQGLRenderer *renderer, const QString &path, const TextureParams &params)
 Construct a StelQGLTextureBackend from a PVR (compressed texture on some mobile platforms) file. More...
 
static StelQGLTextureBackendconstructAsynchronous (class StelQGLRenderer *renderer, const QString &path, const TextureParams &params)
 Construct a StelQGLTextureBackend asynchronously (in a separate thread). More...
 
static StelQGLTextureBackendfromFBO (StelQGLRenderer *renderer, class QGLFramebufferObject *fbo)
 Construct a StelQGLTextureBackend from a framebuffer object. More...
 
static StelQGLTextureBackendfromViewport (StelQGLRenderer *renderer, const QSize viewportSize, const QGLFormat &viewportFormat)
 Construct a StelQGLTextureBackend from the viewport. More...
 
static StelQGLTextureBackendfromRawData (StelQGLRenderer *renderer, const void *data, const QSize size, const TextureDataFormat format, const TextureParams &params)
 Construct a texture from raw data. More...
 

Additional Inherited Members

- Protected Member Functions inherited from StelTextureBackend
 StelTextureBackend (const QString &path)
 Construct a StelTextureBackend with specified texture path/url. More...
 
void startedLoading ()
 Must be called before loading an image (whether normally or asynchronously). More...
 
void finishedLoading (const QSize dimensions)
 Must be called after succesfully loading an image (whether normally or asynchronously). More...
 
void errorOccured (const QString &error)
 Must be called when an error occurs during loading. More...
 
- Protected Attributes inherited from StelTextureBackend
const QString path
 Full file system path or URL of the texture file. More...
 

Detailed Description

Texture backend based on QGL, usable with both GL1 and GL2.

Note
This is an internal class of the Renderer subsystem and should not be used elsewhere.

Definition at line 31 of file StelQGLTextureBackend.hpp.

Constructor & Destructor Documentation

StelQGLTextureBackend::~StelQGLTextureBackend ( )

Destroy the StelQGLTextureBackend. Must be called before the Renderer is destroyed.

Member Function Documentation

void StelQGLTextureBackend::bind ( const int  textureUnit)

Called by QGLRenderer to bind the texture to specified texture unit.

static StelQGLTextureBackend* StelQGLTextureBackend::constructAsynchronous ( class StelQGLRenderer renderer,
const QString &  path,
const TextureParams params 
)
static

Construct a StelQGLTextureBackend asynchronously (in a separate thread).

Will return a StelQGLTextureBackend in Uninitialized state - if not lazy loading, caller must start loading themselves.

Parameters
rendererRenderer this texture belongs to.
pathFull path of image file in the file system (or a URL pointing to the image).
paramsTexture parameters (e.g. filtering, wrapping, etc.).
Returns
Pointer to the new StelQGLTextureBackend.
static StelQGLTextureBackend* StelQGLTextureBackend::constructFromImage ( class StelQGLRenderer renderer,
const QString &  path,
const TextureParams params,
QImage &  image 
)
static

Construct a StelQGLTextureBackend from an image.

Parameters
rendererRenderer this texture belongs to.
pathFull path of the image file in the filesystem.
paramsTexture parameters (e.g. filtering, wrapping, etc.).
imageImage to load from.
Returns
Pointer to the new StelQGLTextureBackend.
static StelQGLTextureBackend* StelQGLTextureBackend::constructFromPVR ( class StelQGLRenderer renderer,
const QString &  path,
const TextureParams params 
)
static

Construct a StelQGLTextureBackend from a PVR (compressed texture on some mobile platforms) file.

This includes loading the texture from file, which might fail if the file does not exist, creating a texture with Error status.

Parameters
rendererRenderer this texture belongs to.
pathFull path of the PVR image file in the filesystem.
paramsTexture parameters (e.g. filtering, wrapping, etc.).
Returns
Pointer to the new StelQGLTextureBackend.
static StelQGLTextureBackend* StelQGLTextureBackend::fromFBO ( StelQGLRenderer renderer,
class QGLFramebufferObject *  fbo 
)
static

Construct a StelQGLTextureBackend from a framebuffer object.

This will simply wrap a texture of a framebuffer object in a StelQGLTextureBackend and return it. The texture itself will still be owned by the framebuffer object, and destroyed with the framebuffer objects, not with the StelQGLTextureBackend.

Parameters
rendererRenderer this texture belongs to.
fboFramebuffer object to get the texture from.
Returns
Pointer to the new StelQGLTextureBackend.
static StelQGLTextureBackend* StelQGLTextureBackend::fromRawData ( StelQGLRenderer renderer,
const void *  data,
const QSize  size,
const TextureDataFormat  format,
const TextureParams params 
)
static

Construct a texture from raw data.

Used to create textures from data Qt does not support, e.g. floating point textures.

Parameters
rendererRenderer this texture belongs to.
dataPointer to the texture data.
sizeTexture size in pixels.
formatFormat of texture pixels stored in data.
paramsTexture parameters (e.g. filtering, wrapping, etc.)
static StelQGLTextureBackend* StelQGLTextureBackend::fromViewport ( StelQGLRenderer renderer,
const QSize  viewportSize,
const QGLFormat &  viewportFormat 
)
static

Construct a StelQGLTextureBackend from the viewport.

Used to get a texture of the viewport. The returned texture will be power-of-two containing the image data in area matching viewport size.

Note
This only works when FBOs are not used. When using FBOs, use fromFBO on the front buffer instead.
Parameters
rendererRenderer this texture belongs to.
viewportSizeSize of the viewport in pixels.
viewportFormatPixel format of the viewport.
Returns
Pointer to the new StelQGLTextureBackend.
void StelQGLTextureBackend::startAsynchronousLoading ( )

Start asynchrounously loading the texture in a separate thread.

Can only be called on a StelQGLTextureBackend returned by constructAsynchronous.

Changes status from Uninitialized to Loading.


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