#include <OSDLGLTexture.h>

The ownership of the source surface is not taken by GLtexture instances, since they have to convert it anyway into their own specific format for OpenGL.
This converted surface can be kept by the GLtexture for future use.
It is recommended to do so, insofar as, on some platforms, some operations, such as resizing, destroy the OpenGL context, including bound textures.
In this case, they have to be reloaded, which is possible if they have kept their converted surface.
Definition at line 88 of file OSDLGLTexture.h.
Public Types | |
| enum | TextureDimensionality { Disabled, OneDim, TwoDim } |
| Texture support can be disabled, or enabled for 1D or 2D textures. More... | |
| enum | TextureFlavour { None, Basic, For2D } |
| Texture flavours are presets that can be chosen as a whole. More... | |
Public Member Functions | |
| GLTexture (const std::string imageFilename, TextureFlavour flavour) throw ( GLTextureException ) | |
| Constructs a texture out of an image stored in a file. | |
| GLTexture (Surface &sourceSurface, TextureFlavour flavour) throw ( GLTextureException ) | |
| Constructs a texture out of an existing surface. | |
| virtual | ~GLTexture () throw () |
| Virtual destructor, deallocates the owned internal surface, if any. | |
| virtual bool | canBeUploaded () const throw () |
| Tells whether this texture can be uploaded to the OpenGL context. | |
| virtual void | upload () throw ( GLTextureException ) |
| Uploads the internal texture to the OpenGL context. | |
| virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const throw () |
| Returns an user-friendly description of the state of this object. | |
Static Public Member Functions | |
| static TextureDimensionality | GetTextureDimensionality () throw () |
| Returns the current texture dimensionality. | |
| static void | SetTextureDimensionality (TextureDimensionality Dimensionality=TwoDim) throw () |
| Sets the current texture dimensionality. | |
| static void | SetTextureFlavour (TextureFlavour textureFlavour) throw ( GLTextureException ) |
| Sets the current texture state according to specified texture flavour. | |
| static void | SetTextureEnvironmentParameter (GLEnumeration targetEnvironment, GLEnumeration environmentParameter, GLfloat parameterValue) throw ( GLTextureException ) |
| Sets a parameter of a texture environment. | |
| static void | SetTextureEnvironmentParameter (GLEnumeration targetEnvironment, GLEnumeration environmentParameter, const GLfloat *parameterValues) throw ( GLTextureException ) |
| Sets the parameters of a texture environment. | |
Static Public Attributes | |
| static TextureDimensionality | CurrentTextureDimensionality |
| Stores the current texture dimensionality. | |
Protected Member Functions | |
| void | upload (Surface &sourceSurface) throw ( GLTextureException ) |
| Uploads an adequately converted surface, copied from the specified one, and deallocates it iff no OpenGL context can be lost, otherwise keeps it in texture cache. | |
Protected Attributes | |
| Surface * | _source |
| The source surface from which this texture is made. | |
| GLTextureIdentifier | _id |
| Identifier given by OpenGL to reference this texture. | |
| TextureFlavour | _flavour |
| Stores the current texture flavour. | |
| Length | _width |
| The width of the texture, in pixels. | |
| Length | _height |
| The height of the texture, in pixels. | |
Private Member Functions | |
| GLTexture (const GLTexture &source) throw () | |
| Copy constructor made private to ensure that it will never be called. | |
| GLTexture & | operator= (const GLTexture &source) throw () |
| Assignment operator made private to ensure that it will never be called. | |
Texture support can be disabled, or enabled for 1D or 2D textures.
Default is 'TwoDim', enabled for 2D textures.
Definition at line 103 of file OSDLGLTexture.h.
Texture flavours are presets that can be chosen as a whole.
'None' does not change state of texture settings, whereas 'Basic' sets classical settings for filters and texture coordinate management, and 'For2D' selects settings appropriate for 2D rendering.
Definition at line 117 of file OSDLGLTexture.h.
| GLTexture::GLTexture | ( | const std::string | imageFilename, | |
| TextureFlavour | flavour | |||
| ) | throw ( GLTextureException ) [explicit] |
Constructs a texture out of an image stored in a file.
| imageFilename | the filename of the image, whose format (PNG, JPEG, etc.) will be auto-detected. | |
| flavour | the texture flavour that should be used. |
Definition at line 86 of file OSDLGLTexture.cc.
References OSDL::Video::OpenGL::GLTextureException::GLTextureException(), OSDL::Video::Surface::LoadImage(), and LOG_DEBUG_TEXTURE.
| GLTexture::GLTexture | ( | Surface & | sourceSurface, | |
| TextureFlavour | flavour | |||
| ) | throw ( GLTextureException ) [explicit] |
Constructs a texture out of an existing surface.
| sourceSurface | the surface from which the texture will be defined. It cannot be 'const' since a temporary change to the surface has to be performed. Nevertheless the source surface is, after a successful call, actually unchanged. | |
| flavour | the texture flavour that should be used. |
Definition at line 132 of file OSDLGLTexture.cc.
References LOG_DEBUG_TEXTURE.
| GLTexture::~GLTexture | ( | ) | throw () [virtual] |
Virtual destructor, deallocates the owned internal surface, if any.
Definition at line 149 of file OSDLGLTexture.cc.
References _id, _source, and LOG_DEBUG_TEXTURE.
| OSDL::Video::OpenGL::GLTexture::GLTexture | ( | const GLTexture & | source | ) | throw () [explicit, private] |
Copy constructor made private to ensure that it will never be called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
| bool GLTexture::canBeUploaded | ( | ) | const throw () [virtual] |
| void GLTexture::upload | ( | ) | throw ( GLTextureException ) [virtual] |
Uploads the internal texture to the OpenGL context.
| GLTextureException | if the texture could not be reloaded, for example if its source surface is not available anymore. |
Definition at line 177 of file OSDLGLTexture.cc.
References canBeUploaded(), and LOG_DEBUG_TEXTURE.
| const string GLTexture::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const throw () [virtual] |
Returns an user-friendly description of the state of this object.
| level | the requested verbosity level. |
Definition at line 202 of file OSDLGLTexture.cc.
References _height, _id, _source, _width, and OSDL::Video::Pixels::toString().
Referenced by OSDL::Rendering::Sprite::toString().
| GLTexture::TextureDimensionality GLTexture::GetTextureDimensionality | ( | ) | throw () [static] |
Returns the current texture dimensionality.
Definition at line 232 of file OSDLGLTexture.cc.
References CurrentTextureDimensionality.
| void GLTexture::SetTextureDimensionality | ( | TextureDimensionality | Dimensionality = TwoDim |
) | throw () [static] |
Sets the current texture dimensionality.
Definition at line 241 of file OSDLGLTexture.cc.
References CurrentTextureDimensionality.
Referenced by SetTextureFlavour().
| void GLTexture::SetTextureFlavour | ( | TextureFlavour | textureFlavour | ) | throw ( GLTextureException ) [static] |
Sets the current texture state according to specified texture flavour.
| textureFlavour | the selected texture flavour. |
| GLTextureException | if the operation failed, including if no OpenGL support is available. |
Definition at line 251 of file OSDLGLTexture.cc.
References Basic, OSDL::Video::OpenGL::OpenGLContext::EnableFeature(), For2D, None, SetTextureDimensionality(), SetTextureEnvironmentParameter(), OSDL::Video::Pixels::toString(), and TwoDim.
Referenced by OSDL::Video::OpenGL::OpenGLContext::set2DFlavour(), and upload().
| void GLTexture::SetTextureEnvironmentParameter | ( | GLEnumeration | targetEnvironment, | |
| GLEnumeration | environmentParameter, | |||
| GLfloat | parameterValue | |||
| ) | throw ( GLTextureException ) [static] |
Sets a parameter of a texture environment.
| targetEnvironment | the texture environment to set. | |
| environmentParameter | the symbolic name of a texture environment parameter. | |
| parameterValue | a single symbolic constant, a single floating-point number, or an RGBA color. |
| GLTextureException | should an error occur. |
Definition at line 374 of file OSDLGLTexture.cc.
Referenced by SetTextureFlavour().
| void GLTexture::SetTextureEnvironmentParameter | ( | GLEnumeration | targetEnvironment, | |
| GLEnumeration | environmentParameter, | |||
| const GLfloat * | parameterValues | |||
| ) | throw ( GLTextureException ) [static] |
Sets the parameters of a texture environment.
| targetEnvironment | the texture environment to set. | |
| environmentParameter | the symbolic name of a texture environment parameter. | |
| parameterValue | pointer to a parameter array that contains either a single symbolic constant, single floating-point number, or an RGBA color. |
| GLTextureException | should an error occur. |
Definition at line 436 of file OSDLGLTexture.cc.
| void GLTexture::upload | ( | Surface & | sourceSurface | ) | throw ( GLTextureException ) [protected] |
Uploads an adequately converted surface, copied from the specified one, and deallocates it iff no OpenGL context can be lost, otherwise keeps it in texture cache.
| sourceSurface | the surface to upload. In all cases it will be copied and converted, therefore it will remain untouched. |
Definition at line 502 of file OSDLGLTexture.cc.
References _flavour, _height, _id, _width, OSDL::Video::Surface::AlphaBlendingBlit, OSDL::Video::OpenGL::AlphaMask, OSDL::Video::Pixels::AlphaTransparent, OSDL::Video::OpenGL::BlueMask, OSDL::Video::Surface::getPixels(), OSDL::Video::OpenGL::GreenMask, OSDL::Video::OpenGL::RedMask, OSDL::Video::Surface::RLEColorkeyBlitAvailable, SetTextureFlavour(), OSDL::Video::VideoModule::SoftwareSurface, and OSDL::Video::Pixels::toString().
| GLTexture& OSDL::Video::OpenGL::GLTexture::operator= | ( | const GLTexture & | source | ) | throw () [private] |
Assignment operator made private to ensure that it will never be called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
Initial value:
Stores the current texture dimensionality.Default is 'TwoDim'.
Definition at line 233 of file OSDLGLTexture.h.
Referenced by GetTextureDimensionality(), and SetTextureDimensionality().
Surface* OSDL::Video::OpenGL::GLTexture::_source [protected] |
The source surface from which this texture is made.
Definition at line 335 of file OSDLGLTexture.h.
Referenced by canBeUploaded(), toString(), and ~GLTexture().
Identifier given by OpenGL to reference this texture.
Definition at line 342 of file OSDLGLTexture.h.
Referenced by toString(), upload(), and ~GLTexture().
Stores the current texture flavour.
Definition at line 353 of file OSDLGLTexture.h.
Referenced by upload().
Length OSDL::Video::OpenGL::GLTexture::_width [protected] |
The width of the texture, in pixels.
Definition at line 357 of file OSDLGLTexture.h.
Referenced by toString(), and upload().
Length OSDL::Video::OpenGL::GLTexture::_height [protected] |
The height of the texture, in pixels.
Definition at line 360 of file OSDLGLTexture.h.
Referenced by toString(), and upload().
1.5.5