Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Protected Member Functions | List of all members
om::graphics::textures::DeviceTexture Class Referenceabstract

A class that represents an image stored on the graphics hardware. More...

#include <omGraphicsDeviceTexture.h>

Inheritance diagram for om::graphics::textures::DeviceTexture:
om::graphics::devices::DeviceResource om::graphics::devices::opengl::OpenGLTexture

Public Member Functions

virtual Size getDimensionCount () const =0
 Return the number of dimensions in this texture, usually 1, 2, or 3. More...
 
virtual Size getSize (Index dimension) const =0
 Return the size of the texture along the specified dimension index. More...
 
virtual Size getFaceCount () const =0
 Return the number of faces that this texture has. More...
 
virtual Bool isCube () const =0
 Return whether or not this texture is a cube map texture. More...
 
Bool isValidFace (const TextureFace &face) const
 Return whether or not the specified face is valid for this texture. More...
 
virtual TextureFormat getFormat () const =0
 Return a object that represents the internal storage format for the texture. More...
 
virtual Bool getFace (Image &image, const PixelFormat &pixelType, TextureFace face=TextureFace::FRONT, Index mipmapLevel=0) const =0
 Get the texture's image data for the specified face index with the data in the specified pixel type. More...
 
virtual Bool setFace (const Image &newImage, TextureFormat newTextureFormat, TextureFace face=TextureFace::FRONT, Index mipmapLevel=0)=0
 Replace the current contents of the texture with the specified image. More...
 
virtual Bool updateFace (const Image &newImage, const Vector3i &position, TextureFace face=TextureFace::FRONT, Index mipmapLevel=0)=0
 Update a region of the texture with the specified image. More...
 
virtual Bool clearFace (Float channelColor, TextureFace face=TextureFace::FRONT, Index mipmapLevel=0)=0
 Clear this texture's image using the specified clear color component for the given face and mipmap level. More...
 
virtual TextureWrapType getWrapType () const =0
 Return the type of texture wrapping to do when texture coordinates are outside of the range [0,1]. More...
 
virtual Bool setWrapType (const TextureWrapType &newWrapType)=0
 Set the type of texture wrapping to do when texture coordinates are outside of the range [0,1]. More...
 
virtual TextureFilter getDownsampleFilter () const =0
 Return the type of texture filtering that is used when the texture is reduced in size. More...
 
virtual Bool setDownsampleFilter (const TextureFilter &newDownsampleFilter)=0
 Set the type of texture filtering that is used when the texture is reduced in size. More...
 
virtual TextureFilter getUpsampleFilter () const =0
 Return the type of texture filtering that is used when the texture is increased in size. More...
 
virtual Bool setUpsampleFilter (const TextureFilter &newUpsampleFilter)=0
 Set the type of texture filtering that is used when the texture is increased in size. More...
 
virtual Size getMipmapCount () const =0
 Return the number of mipmap levels that this texture has. More...
 
virtual Bool generateMipmaps ()=0
 Generate smaller mipmaps of the texture from the largest texture image (level 0). More...
 
virtual Bool isResident () const =0
 Return whether or not the texture is currently in active memory on the GPU. More...
 
- Public Member Functions inherited from om::graphics::devices::DeviceResource
virtual ~DeviceResource ()
 Destroy a device object, releasing all internal state. More...
 
GraphicsContextgetContext () const
 Return a pointer to the graphics context associated with this DeviceResource. More...
 
virtual Bool isValid () const =0
 Return whether or not the state of this device resource is valid and able to be used for rendering. More...
 

Protected Member Functions

 DeviceTexture (devices::GraphicsContext *context)
 Create an empty texture for the given context with no face images. More...
 
- Protected Member Functions inherited from om::graphics::devices::DeviceResource
 DeviceResource (GraphicsContext *newContext)
 Create a new device object that is associated with the specified graphics context. More...
 

Detailed Description

A class that represents an image stored on the graphics hardware.

A texture can be either 1D, 2D, 3D, or a cube map (six 2D faces), with any common texture format (Alpha, Gray, RGB, RGBA, etc.).

Constructor & Destructor Documentation

om::graphics::textures::DeviceTexture::DeviceTexture ( devices::GraphicsContext context)
inlineprotected

Create an empty texture for the given context with no face images.

Member Function Documentation

virtual Size om::graphics::textures::DeviceTexture::getDimensionCount ( ) const
pure virtual

Return the number of dimensions in this texture, usually 1, 2, or 3.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Size om::graphics::textures::DeviceTexture::getSize ( Index  dimension) const
pure virtual

Return the size of the texture along the specified dimension index.

Indices start from 0 and count to d-1 for a texture with d dimensions. The method returns a size of 1 for all out-of-bounds dimensions.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Size om::graphics::textures::DeviceTexture::getFaceCount ( ) const
pure virtual

Return the number of faces that this texture has.

A normal texture will have 1 face, while a cube map texture will have 6 faces.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Bool om::graphics::textures::DeviceTexture::isCube ( ) const
pure virtual

Return whether or not this texture is a cube map texture.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

Bool om::graphics::textures::DeviceTexture::isValidFace ( const TextureFace face) const
inline

Return whether or not the specified face is valid for this texture.

virtual TextureFormat om::graphics::textures::DeviceTexture::getFormat ( ) const
pure virtual

Return a object that represents the internal storage format for the texture.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Bool om::graphics::textures::DeviceTexture::getFace ( Image &  image,
const PixelFormat &  pixelType,
TextureFace  face = TextureFace::FRONT,
Index  mipmapLevel = 0 
) const
pure virtual

Get the texture's image data for the specified face index with the data in the specified pixel type.

If the face type is not equal to TextureFace::FRONT and the texture is not a cube map texture, an empty image with UNDEFINED pixel type is returned.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Bool om::graphics::textures::DeviceTexture::setFace ( const Image &  newImage,
TextureFormat  newTextureFormat,
TextureFace  face = TextureFace::FRONT,
Index  mipmapLevel = 0 
)
pure virtual

Replace the current contents of the texture with the specified image.

If the image's pixel type is not compatable with the current type of the texture, or if the face index is not equal to TextureFace::FRONT and the texture is not a cube map texture, or if an invalid mipmap level is specified, FALSE is returned indicating failure and the method has no effect. Otherwise, the method succeeds and TRUE is returned.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Bool om::graphics::textures::DeviceTexture::updateFace ( const Image &  newImage,
const Vector3i position,
TextureFace  face = TextureFace::FRONT,
Index  mipmapLevel = 0 
)
pure virtual

Update a region of the texture with the specified image.

This method replaces some of the pixels that are currently part of the texture with the pixels stored in the specified image. The texture is replaced with the image starting at the specified position in pixels from its lower left corner.

If the updated pixels will lie outside of the texture's area, or if the image's pixel type is not compatable with the current type of the texture, or if the face index is not equal to TextureFace::FRONT and the texture is not a cube map texture, FALSE is returned indicating failure and the method has no effect. Otherwise, the method succeeds and TRUE is returned.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Bool om::graphics::textures::DeviceTexture::clearFace ( Float  channelColor,
TextureFace  face = TextureFace::FRONT,
Index  mipmapLevel = 0 
)
pure virtual

Clear this texture's image using the specified clear color component for the given face and mipmap level.

This method initializes every texel of the texture with the specified color component for every texture component.

The method returns whether or not the clear operation was successful.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual TextureWrapType om::graphics::textures::DeviceTexture::getWrapType ( ) const
pure virtual

Return the type of texture wrapping to do when texture coordinates are outside of the range [0,1].

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Bool om::graphics::textures::DeviceTexture::setWrapType ( const TextureWrapType newWrapType)
pure virtual

Set the type of texture wrapping to do when texture coordinates are outside of the range [0,1].

The method returns whether or not the wrap type was set successfully for the texture.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual TextureFilter om::graphics::textures::DeviceTexture::getDownsampleFilter ( ) const
pure virtual

Return the type of texture filtering that is used when the texture is reduced in size.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Bool om::graphics::textures::DeviceTexture::setDownsampleFilter ( const TextureFilter newDownsampleFilter)
pure virtual

Set the type of texture filtering that is used when the texture is reduced in size.

The method returns whether or not the downsample filter was set successfully for the texture.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual TextureFilter om::graphics::textures::DeviceTexture::getUpsampleFilter ( ) const
pure virtual

Return the type of texture filtering that is used when the texture is increased in size.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Bool om::graphics::textures::DeviceTexture::setUpsampleFilter ( const TextureFilter newUpsampleFilter)
pure virtual

Set the type of texture filtering that is used when the texture is increased in size.

The method returns whether or not the upsample filter was set successfully for the texture.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Size om::graphics::textures::DeviceTexture::getMipmapCount ( ) const
pure virtual

Return the number of mipmap levels that this texture has.

This number is determined by the size along the largest dimension of the texture, given by the relationship: numLevels = 1 + floor(log2(maxDimension)).

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Bool om::graphics::textures::DeviceTexture::generateMipmaps ( )
pure virtual

Generate smaller mipmaps of the texture from the largest texture image (level 0).

This method automatically scales down the largest mipmap level (level 0) for each of the smaller mipmap levels (>1), replacing any previous mipmap information.

Implemented in om::graphics::devices::opengl::OpenGLTexture.

virtual Bool om::graphics::textures::DeviceTexture::isResident ( ) const
pure virtual

Return whether or not the texture is currently in active memory on the GPU.

Implemented in om::graphics::devices::opengl::OpenGLTexture.


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