Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes

vl::Texture Class Reference

Wraps an OpenGL texture object representing and managing all the supported texture types. More...

#include <Texture.hpp>

Inheritance diagram for vl::Texture:
vl::Object

List of all members.

Classes

class  SetupParams
 The SetupParams function wraps all the parameters needed to crate a Texture. More...

Public Member Functions

virtual const char * className ()
 Returns the name of the class.
 Texture (const String &image_path, ETextureFormat format=TF_RGBA, bool mipmaps=true, bool border=false)
 Constructs a texture from the specified file.
 Texture (Image *image, ETextureFormat format=TF_RGBA, bool mipmaps=true, bool border=false)
 Constructs a texture from the specified image.
 Texture (int width, ETextureFormat format=TF_RGBA, bool border=false)
 Constructs an empty 1D texture.
 Texture (int width, int height, ETextureFormat format=TF_RGBA, bool border=false)
 Constructs an empty 2D texture.
 Texture (int width, int height, int depth, ETextureFormat format=TF_RGBA, bool border=false)
 Constructs an empty 3D texture.
 Texture ()
 Constructs an null texture that can be initialized later using one of the prepareTexture*() functions or calling createTexture().
 ~Texture ()
 Destructor.
TexParametergetTexParameter ()
 The TexParameter object associated to a Texture.
const TexParametergetTexParameter () const
 The TexParameter object associated to a Texture.
GLBufferObjectbufferObject ()
 The buffer object bound to a buffer object texture.
const GLBufferObjectbufferObject () const
 The buffer object bound to a buffer object texture.
void destroyTexture ()
 Destroys the texture.
bool createTexture ()
 Creates a texture using the parameters specified by the last prepareTexture*() called.
bool createTexture (ETextureDimension tex_dimension, ETextureFormat tex_format, int w, int h, int d, bool border, GLBufferObject *bo, int samples, bool fixedsamplelocations)
 Creates an empty texture, with no mipmaps, of the specified type, format and dimensions.
bool setMipLevel (int mip_level, Image *img, bool gen_mipmaps)
 Copies the texture image to the specified mip-maping level.
void prepareTexture1D (int width, ETextureFormat format, bool border=false)
 Prepares for creation an empty 1D texture.
void createTexture1D (int width, ETextureFormat format, bool border=false)
 Creates an empty 1D texture.
void prepareTexture1D (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a 1D texture from the specified file.
void createTexture1D (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates a 1D texture from the specified file.
void prepareTexture1D (Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a 1D texture from the specified image.
void createTexture1D (Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates a 1D texture from the specified image.
void prepareTexture2D (int width, int height, ETextureFormat format, bool border=false)
 Prepares for creation an empty 2D texture.
void createTexture2D (int width, int height, ETextureFormat format, bool border=false)
 Creates an empty 2D texture.
void prepareTexture2D (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a 2D texture from the specified file.
void createTexture2D (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates a 2D texture from the specified file.
void prepareTexture2D (Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a 2D texture from the specified image.
void createTexture2D (Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates a 2D texture from the specified image.
void prepareTexture3D (int width, int height, int depth, ETextureFormat format, bool border=false)
 Prepares for creation an empty 3D texture.
void createTexture3D (int width, int height, int depth, ETextureFormat format, bool border=false)
 Creates an empty 3D texture.
void prepareTexture3D (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a 3D texture from the specified file.
void createTexture3D (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates a 3D texture from the specified file.
void prepareTexture3D (Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a 3D texture from the specified image.
void createTexture3D (Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates a 3D texture from the specified image.
void prepareTextureCubemap (int width, int height, ETextureFormat format, bool border=false)
 Prepares for creation an empty cubemap texture.
void createTextureCubemap (int width, int height, ETextureFormat format, bool border=false)
 Creates an empty cubemap texture.
void prepareTextureCubemap (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a cubemap texture from the specified file.
void createTextureCubemap (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates creation a cubemap texture from the specified file.
void prepareTextureCubemap (Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a cubemap texture from the specified image.
void createTextureCubemap (Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates a cubemap texture from the specified image.
void prepareTexture1DArray (int width, int count, ETextureFormat format)
 Prepares for creation an empty 1D array texture.
void createTexture1DArray (int width, int count, ETextureFormat format)
 Creates an empty 1D array texture.
void prepareTexture1DArray (const String &image_path, ETextureFormat format, bool mipmaps=true)
 Prepares for creation a 1d texture array from the specified file.
void createTexture1DArray (const String &image_path, ETextureFormat format, bool mipmaps=true)
 Creates a 1d texture array from the specified file.
void prepareTexture1DArray (Image *image, ETextureFormat format, bool mipmaps=true)
 Prepares for creation a 1d texture array from the specified image.
void createTexture1DArray (Image *image, ETextureFormat format, bool mipmaps=true)
 Creates a 1d texture array from the specified image.
void prepareTexture2DArray (int width, int height, int count, ETextureFormat format)
 Prepares for creation an empty 2D array texture.
void createTexture2DArray (int width, int height, int count, ETextureFormat format)
 Creates an empty 2D array texture.
void prepareTexture2DArray (const String &image_path, ETextureFormat format, bool mipmaps=true)
 Prepares for creation a 2d texture array from the specified file.
void createTexture2DArray (const String &image_path, ETextureFormat format, bool mipmaps=true)
 Creates a 2d texture array from the specified file.
void prepareTexture2DArray (Image *image, ETextureFormat format, bool mipmaps=true)
 Prepares for creation a 2d texture array from the specified image.
void createTexture2DArray (Image *image, ETextureFormat format, bool mipmaps=true)
 Creates a 2d texture array from the specified image.
void prepareTextureRectangle (int width, int height, ETextureFormat format)
 Prepares for creation an empty texture rectangle.
void createTextureRectangle (int width, int height, ETextureFormat format)
 Creates an empty texture rectangle.
void prepareTextureRectangle (const String &image_path, ETextureFormat format)
 Prepares for creation a texture rectangle from the specified file.
void createTextureRectangle (const String &image_path, ETextureFormat format)
 Creates a texture rectangle from the specified file.
void prepareTextureRectangle (Image *image, ETextureFormat format)
 Prepares for creation a texture rectangle from the specified image.
void createTextureRectangle (Image *image, ETextureFormat format)
 Creates a texture rectangle from the specified image.
void prepareTextureBuffer (vl::ETextureFormat format, GLBufferObject *bo)
 Prepares a texture buffer texture.
void createTextureBuffer (vl::ETextureFormat format, GLBufferObject *bo)
 Creates a texture buffer texture.
void prepareTexture2DMultisample (int width, int height, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
 Prepares a 2D multisample texture.
void createTexture2DMultisample (int width, int height, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
 Creates a 2D multisample texture.
void prepareTexture2DMultisampleArray (int width, int height, int depth, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
 Prepares a 3D multisample texture.
void createTexture2DMultisampleArray (int width, int height, int depth, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
 Creates a 3D multisample texture.
bool isValid () const
 Returns true if the current texture configuration seems valid.
unsigned int handle () const
 OpenGL texture handle as returned by glGenTextures().
void setHandle (unsigned int id)
 OpenGL texture handle as returned by glGenTextures().
void setDimension (ETextureDimension dimension)
 The texture type (1d, 2d, cubemap etc.) as specified by the target parameter of glTexImage*().
ETextureDimension dimension () const
 The texture type (1d, 2d, cubemap etc.) as specified by the target parameter of glTexImage*().
void setInternalFormat (ETextureFormat format)
 The texture internal format as pecified by the internalFormat parameter of glTexImage*().
ETextureFormat internalFormat () const
 The texture internal format as pecified by the internalFormat parameter of glTexImage*().
void setWidth (int x)
 The horizontal dimension of the texture in texels.
int width () const
 The horizontal dimension of the texture in texels.
void setHeight (int y)
 The vertical dimension of the texture in texels.
int height () const
 The vertical dimension of the texture in texels.
void setDepth (int z)
 The z dimension of the texture in texels.
int depth () const
 The z dimension of the texture in texels.
void setBorder (bool border)
 Whether the texture has a 1 pixel texture border or not.
bool border () const
 Whether the texture has a 1 pixel texture border or not.
int samples () const
 Returns the number of samples of a multisample texture.
bool fixedSamplesLocation () const
 Returns whether the samples location is fixed for a a multisample texture.
const SetupParamssetupParams () const
 See SetupParams.
SetupParamssetupParams ()
 See SetupParams.
void setSetupParams (SetupParams *setup_params)
 See SetupParams.
bool isDepthTexture () const
 Returns true if the texture is a depth or depth/stencil textre.
void clone (const Texture &other)
 Copies all the texture parameters form the specified texture, including the OpenGL texture handle.

Static Public Member Functions

static bool supports (ETextureDimension tex_dimension, ETextureFormat tex_format, int mip_level, EImageDimension img_dimension, int w, int h, int d, bool border, int samples, bool fixedsamplelocations, bool verbose)
 Checks whether the specified texture type, format and dimension combination is supported by the current OpenGL driver.
static bool isCompressedFormat (int format)
 Returns true if the specified format is compressed.

Protected Attributes

unsigned int mHandle
TexParameter mTexParameter
ref< SetupParamsmSetupParams
ref< GLBufferObjectmBufferObject
ETextureFormat mFormat
ETextureDimension mDimension
int mWidth
int mHeight
int mDepth
int mSamples
bool mBorder
bool mFixedSamplesLocation

Detailed Description

Wraps an OpenGL texture object representing and managing all the supported texture types.

Remarks:
Many of the parameters used to create a Textures are the same used by glTexImage1D/2D/3D etc. See the following for more information:
Note:
A TexParameter defines a set of variables associated to a Texture while TexGen and TexEnv define a set of variables associated to a TextureUnit.
See also:

Definition at line 137 of file Texture.hpp.


Constructor & Destructor Documentation

Texture::Texture ( const String image_path,
ETextureFormat  format = TF_RGBA,
bool  mipmaps = true,
bool  border = false 
)

Constructs a texture from the specified file.

Note:
The OpenGL texture object is created immediately therefore an OpenGL context must be active when calling this constructor.

Definition at line 420 of file Texture.cpp.

References border(), vl::Log::bug(), createTexture(), vl::Log::error(), vl::ref< T >::get(), vl::ID_1D, vl::ID_2D, vl::ID_3D, vl::ID_Cubemap, vl::loadImage(), prepareTexture1D(), prepareTexture2D(), prepareTexture3D(), prepareTextureCubemap(), and VL_DEBUG_SET_OBJECT_NAME.

Texture::Texture ( Image image,
ETextureFormat  format = TF_RGBA,
bool  mipmaps = true,
bool  border = false 
)

Constructs a texture from the specified image.

Note:
The OpenGL texture object is created immediately therefore an OpenGL context must be active when calling this constructor.

Definition at line 396 of file Texture.cpp.

References vl::Log::bug(), createTexture(), vl::Image::dimension(), vl::Log::error(), vl::ID_1D, vl::ID_2D, vl::ID_3D, vl::ID_Cubemap, vl::Image::isValid(), prepareTexture1D(), prepareTexture2D(), prepareTexture3D(), prepareTextureCubemap(), and VL_DEBUG_SET_OBJECT_NAME.

Texture::Texture ( int  width,
ETextureFormat  format = TF_RGBA,
bool  border = false 
)

Constructs an empty 1D texture.

Note:
The OpenGL texture object is created immediately therefore an OpenGL context must be active when calling this constructor.

Definition at line 363 of file Texture.cpp.

References createTexture(), vl::Log::error(), vl::TD_TEXTURE_1D, VL_CHECK_OGL, and VL_DEBUG_SET_OBJECT_NAME.

Texture::Texture ( int  width,
int  height,
ETextureFormat  format = TF_RGBA,
bool  border = false 
)

Constructs an empty 2D texture.

Note:
The OpenGL texture object is created immediately therefore an OpenGL context must be active when calling this constructor.

Definition at line 374 of file Texture.cpp.

References createTexture(), vl::Log::error(), vl::TD_TEXTURE_2D, VL_CHECK_OGL, and VL_DEBUG_SET_OBJECT_NAME.

Texture::Texture ( int  width,
int  height,
int  depth,
ETextureFormat  format = TF_RGBA,
bool  border = false 
)

Constructs an empty 3D texture.

Note:
The OpenGL texture object is created immediately therefore an OpenGL context must be active when calling this constructor.

Definition at line 385 of file Texture.cpp.

References createTexture(), vl::Log::error(), vl::TD_TEXTURE_3D, VL_CHECK_OGL, and VL_DEBUG_SET_OBJECT_NAME.

Texture::Texture (  )

Constructs an null texture that can be initialized later using one of the prepareTexture*() functions or calling createTexture().

Definition at line 446 of file Texture.cpp.

References VL_DEBUG_SET_OBJECT_NAME.

Texture::~Texture (  )

Destructor.

Definition at line 343 of file Texture.cpp.

References destroyTexture().


Member Function Documentation

virtual const char* vl::Texture::className (  ) [inline, virtual]

Returns the name of the class.

Reimplemented from vl::Object.

Definition at line 210 of file Texture.hpp.

TexParameter* vl::Texture::getTexParameter (  ) [inline]

The TexParameter object associated to a Texture.

Definition at line 239 of file Texture.hpp.

Referenced by vl::TextureUnit::apply(), and destroyTexture().

const TexParameter* vl::Texture::getTexParameter (  ) const [inline]

The TexParameter object associated to a Texture.

Definition at line 242 of file Texture.hpp.

GLBufferObject* vl::Texture::bufferObject (  ) [inline]

The buffer object bound to a buffer object texture.

Definition at line 245 of file Texture.hpp.

Referenced by createTexture().

const GLBufferObject* vl::Texture::bufferObject (  ) const [inline]

The buffer object bound to a buffer object texture.

Definition at line 248 of file Texture.hpp.

void Texture::destroyTexture (  )

Destroys the texture.

Definition at line 335 of file Texture.cpp.

References getTexParameter(), vl::TexParameter::mDirty, and mHandle.

Referenced by ~Texture().

bool Texture::createTexture (  )

Creates a texture using the parameters specified by the last prepareTexture*() called.

Remarks:
You can retrieve the currently active texture creation settings using the setupParams() function.
Note:
The OpenGL texture object is created immediately therefore an OpenGL context must be active when calling this function.

Definition at line 1033 of file Texture.cpp.

References vl::Texture::SetupParams::border(), border(), bufferObject(), vl::Texture::SetupParams::depth(), vl::Texture::SetupParams::dimension(), vl::Log::error(), vl::Texture::SetupParams::format(), vl::Texture::SetupParams::genMipmaps(), vl::ref< T >::get(), vl::Texture::SetupParams::height(), vl::Texture::SetupParams::image(), vl::loadImage(), samples(), setMipLevel(), vl::Object::setObjectName(), setupParams(), VL_CHECK_OGL, and vl::Texture::SetupParams::width().

Referenced by vl::Rendering::fillRenderQueue(), and Texture().

bool Texture::createTexture ( ETextureDimension  tex_dimension,
ETextureFormat  tex_format,
int  w,
int  h,
int  d,
bool  border,
GLBufferObject bo,
int  samples,
bool  fixedsamplelocations 
)
bool Texture::setMipLevel ( int  mip_level,
Image img,
bool  gen_mipmaps 
)

Copies the texture image to the specified mip-maping level.

This function can be useful to specify one by one the mipmapping images or to create texture animation effects.

Parameters:
mip_levelThe mip-mapping level to be modified.
imgThe Image containing the pixels to be copied into the specified mip-mapping level.
gen_mipmapsIf true automatically generates the mip-mapping images for the levels below mip_level.
Remarks:
Before calling this function one of the two createTexture() methods must have been called.
Note:
The mip-map level is updated immediately therefore an OpenGL context must be active when calling this function.

Definition at line 802 of file Texture.cpp.

References border(), vl::Log::bug(), vl::Image::byteAlignment(), depth(), vl::Image::depth(), vl::Image::dimension(), dimension(), vl::Log::error(), vl::Image::format(), height(), vl::Image::height(), internalFormat(), isCompressedFormat(), mHandle, vl::Image::pixels(), vl::Image::pixelsXN(), vl::Image::pixelsXP(), vl::Image::pixelsYN(), vl::Image::pixelsYP(), vl::Image::pixelsZN(), vl::Image::pixelsZP(), vl::Image::requiredMemory(), supports(), vl::TD_TEXTURE_1D, vl::TD_TEXTURE_1D_ARRAY, vl::TD_TEXTURE_2D, vl::TD_TEXTURE_2D_ARRAY, vl::TD_TEXTURE_2D_MULTISAMPLE, vl::TD_TEXTURE_2D_MULTISAMPLE_ARRAY, vl::TD_TEXTURE_3D, vl::TD_TEXTURE_BUFFER, vl::TD_TEXTURE_CUBE_MAP, vl::TD_TEXTURE_RECTANGLE, vl::Image::type(), VL_CHECK, VL_CHECK_OGL, VL_IS_POW_2, VL_TRAP, vl::Log::warning(), width(), and vl::Image::width().

Referenced by createTexture().

void vl::Texture::prepareTexture1D ( int  width,
ETextureFormat  format,
bool  border = false 
) [inline]

Prepares for creation an empty 1D texture.

Definition at line 272 of file Texture.hpp.

Referenced by Texture().

void vl::Texture::createTexture1D ( int  width,
ETextureFormat  format,
bool  border = false 
) [inline]

Creates an empty 1D texture.

Definition at line 279 of file Texture.hpp.

void vl::Texture::prepareTexture1D ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Prepares for creation a 1D texture from the specified file.

Definition at line 286 of file Texture.hpp.

void vl::Texture::createTexture1D ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Creates a 1D texture from the specified file.

Definition at line 293 of file Texture.hpp.

void vl::Texture::prepareTexture1D ( Image image,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Prepares for creation a 1D texture from the specified image.

Definition at line 300 of file Texture.hpp.

References vl::Texture::SetupParams::setImage(), and vl::TD_TEXTURE_1D.

void vl::Texture::createTexture1D ( Image image,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Creates a 1D texture from the specified image.

Definition at line 311 of file Texture.hpp.

void vl::Texture::prepareTexture2D ( int  width,
int  height,
ETextureFormat  format,
bool  border = false 
) [inline]

Prepares for creation an empty 2D texture.

Definition at line 318 of file Texture.hpp.

Referenced by Texture().

void vl::Texture::createTexture2D ( int  width,
int  height,
ETextureFormat  format,
bool  border = false 
) [inline]

Creates an empty 2D texture.

Definition at line 326 of file Texture.hpp.

void vl::Texture::prepareTexture2D ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Prepares for creation a 2D texture from the specified file.

Definition at line 333 of file Texture.hpp.

void vl::Texture::createTexture2D ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Creates a 2D texture from the specified file.

Definition at line 340 of file Texture.hpp.

void vl::Texture::prepareTexture2D ( Image image,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Prepares for creation a 2D texture from the specified image.

Definition at line 347 of file Texture.hpp.

References vl::Texture::SetupParams::setImage(), and vl::TD_TEXTURE_2D.

void vl::Texture::createTexture2D ( Image image,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Creates a 2D texture from the specified image.

Definition at line 358 of file Texture.hpp.

void vl::Texture::prepareTexture3D ( int  width,
int  height,
int  depth,
ETextureFormat  format,
bool  border = false 
) [inline]

Prepares for creation an empty 3D texture.

Definition at line 365 of file Texture.hpp.

Referenced by Texture().

void vl::Texture::createTexture3D ( int  width,
int  height,
int  depth,
ETextureFormat  format,
bool  border = false 
) [inline]

Creates an empty 3D texture.

Definition at line 374 of file Texture.hpp.

void vl::Texture::prepareTexture3D ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Prepares for creation a 3D texture from the specified file.

Definition at line 381 of file Texture.hpp.

void vl::Texture::createTexture3D ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Creates a 3D texture from the specified file.

Definition at line 388 of file Texture.hpp.

void vl::Texture::prepareTexture3D ( Image image,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Prepares for creation a 3D texture from the specified image.

Definition at line 395 of file Texture.hpp.

References vl::Texture::SetupParams::setImage(), and vl::TD_TEXTURE_3D.

void vl::Texture::createTexture3D ( Image image,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Creates a 3D texture from the specified image.

Definition at line 406 of file Texture.hpp.

void vl::Texture::prepareTextureCubemap ( int  width,
int  height,
ETextureFormat  format,
bool  border = false 
) [inline]

Prepares for creation an empty cubemap texture.

Definition at line 413 of file Texture.hpp.

Referenced by Texture().

void vl::Texture::createTextureCubemap ( int  width,
int  height,
ETextureFormat  format,
bool  border = false 
) [inline]

Creates an empty cubemap texture.

Definition at line 421 of file Texture.hpp.

void vl::Texture::prepareTextureCubemap ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Prepares for creation a cubemap texture from the specified file.

Definition at line 428 of file Texture.hpp.

void vl::Texture::createTextureCubemap ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Creates creation a cubemap texture from the specified file.

Definition at line 435 of file Texture.hpp.

void vl::Texture::prepareTextureCubemap ( Image image,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Prepares for creation a cubemap texture from the specified image.

Definition at line 442 of file Texture.hpp.

References vl::Texture::SetupParams::setImage(), and vl::TD_TEXTURE_CUBE_MAP.

void vl::Texture::createTextureCubemap ( Image image,
ETextureFormat  format,
bool  mipmaps = true,
bool  border = false 
) [inline]

Creates a cubemap texture from the specified image.

Definition at line 453 of file Texture.hpp.

void vl::Texture::prepareTexture1DArray ( int  width,
int  count,
ETextureFormat  format 
) [inline]

Prepares for creation an empty 1D array texture.

Definition at line 460 of file Texture.hpp.

void vl::Texture::createTexture1DArray ( int  width,
int  count,
ETextureFormat  format 
) [inline]

Creates an empty 1D array texture.

Definition at line 468 of file Texture.hpp.

void vl::Texture::prepareTexture1DArray ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true 
) [inline]

Prepares for creation a 1d texture array from the specified file.

Definition at line 475 of file Texture.hpp.

void vl::Texture::createTexture1DArray ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true 
) [inline]

Creates a 1d texture array from the specified file.

Definition at line 482 of file Texture.hpp.

void vl::Texture::prepareTexture1DArray ( Image image,
ETextureFormat  format,
bool  mipmaps = true 
) [inline]

Prepares for creation a 1d texture array from the specified image.

Definition at line 489 of file Texture.hpp.

References vl::Texture::SetupParams::setImage(), and vl::TD_TEXTURE_1D_ARRAY.

void vl::Texture::createTexture1DArray ( Image image,
ETextureFormat  format,
bool  mipmaps = true 
) [inline]

Creates a 1d texture array from the specified image.

Definition at line 500 of file Texture.hpp.

void vl::Texture::prepareTexture2DArray ( int  width,
int  height,
int  count,
ETextureFormat  format 
) [inline]

Prepares for creation an empty 2D array texture.

Definition at line 507 of file Texture.hpp.

void vl::Texture::createTexture2DArray ( int  width,
int  height,
int  count,
ETextureFormat  format 
) [inline]

Creates an empty 2D array texture.

Definition at line 516 of file Texture.hpp.

void vl::Texture::prepareTexture2DArray ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true 
) [inline]

Prepares for creation a 2d texture array from the specified file.

Definition at line 523 of file Texture.hpp.

void vl::Texture::createTexture2DArray ( const String image_path,
ETextureFormat  format,
bool  mipmaps = true 
) [inline]

Creates a 2d texture array from the specified file.

Definition at line 530 of file Texture.hpp.

void vl::Texture::prepareTexture2DArray ( Image image,
ETextureFormat  format,
bool  mipmaps = true 
) [inline]

Prepares for creation a 2d texture array from the specified image.

Definition at line 537 of file Texture.hpp.

References vl::Texture::SetupParams::setImage(), and vl::TD_TEXTURE_2D_ARRAY.

void vl::Texture::createTexture2DArray ( Image image,
ETextureFormat  format,
bool  mipmaps = true 
) [inline]

Creates a 2d texture array from the specified image.

Definition at line 548 of file Texture.hpp.

void vl::Texture::prepareTextureRectangle ( int  width,
int  height,
ETextureFormat  format 
) [inline]

Prepares for creation an empty texture rectangle.

Definition at line 555 of file Texture.hpp.

void vl::Texture::createTextureRectangle ( int  width,
int  height,
ETextureFormat  format 
) [inline]

Creates an empty texture rectangle.

Definition at line 563 of file Texture.hpp.

void vl::Texture::prepareTextureRectangle ( const String image_path,
ETextureFormat  format 
) [inline]

Prepares for creation a texture rectangle from the specified file.

Definition at line 570 of file Texture.hpp.

void vl::Texture::createTextureRectangle ( const String image_path,
ETextureFormat  format 
) [inline]

Creates a texture rectangle from the specified file.

Definition at line 577 of file Texture.hpp.

void vl::Texture::prepareTextureRectangle ( Image image,
ETextureFormat  format 
) [inline]

Prepares for creation a texture rectangle from the specified image.

Definition at line 584 of file Texture.hpp.

References vl::Texture::SetupParams::setImage(), and vl::TD_TEXTURE_RECTANGLE.

void vl::Texture::createTextureRectangle ( Image image,
ETextureFormat  format 
) [inline]

Creates a texture rectangle from the specified image.

Definition at line 595 of file Texture.hpp.

void vl::Texture::prepareTextureBuffer ( vl::ETextureFormat  format,
GLBufferObject bo 
) [inline]

Prepares a texture buffer texture.

Definition at line 602 of file Texture.hpp.

References vl::Texture::SetupParams::setDimension(), and vl::TD_TEXTURE_BUFFER.

void vl::Texture::createTextureBuffer ( vl::ETextureFormat  format,
GLBufferObject bo 
) [inline]

Creates a texture buffer texture.

Definition at line 613 of file Texture.hpp.

void vl::Texture::prepareTexture2DMultisample ( int  width,
int  height,
vl::ETextureFormat  format,
int  samples,
bool  fixedsamplelocations 
) [inline]

Prepares a 2D multisample texture.

Definition at line 620 of file Texture.hpp.

References vl::Texture::SetupParams::setDimension(), and vl::TD_TEXTURE_2D_MULTISAMPLE.

void vl::Texture::createTexture2DMultisample ( int  width,
int  height,
vl::ETextureFormat  format,
int  samples,
bool  fixedsamplelocations 
) [inline]

Creates a 2D multisample texture.

Definition at line 634 of file Texture.hpp.

void vl::Texture::prepareTexture2DMultisampleArray ( int  width,
int  height,
int  depth,
vl::ETextureFormat  format,
int  samples,
bool  fixedsamplelocations 
) [inline]

Prepares a 3D multisample texture.

Definition at line 641 of file Texture.hpp.

References vl::Texture::SetupParams::setDimension(), and vl::TD_TEXTURE_2D_MULTISAMPLE_ARRAY.

void vl::Texture::createTexture2DMultisampleArray ( int  width,
int  height,
int  depth,
vl::ETextureFormat  format,
int  samples,
bool  fixedsamplelocations 
) [inline]

Creates a 3D multisample texture.

Definition at line 656 of file Texture.hpp.

bool Texture::isValid (  ) const

Returns true if the current texture configuration seems valid.

Definition at line 452 of file Texture.cpp.

References handle(), mDepth, mHeight, and mWidth.

unsigned int vl::Texture::handle (  ) const [inline]

OpenGL texture handle as returned by glGenTextures().

Definition at line 666 of file Texture.hpp.

Referenced by isValid().

void vl::Texture::setHandle ( unsigned int  id ) [inline]

OpenGL texture handle as returned by glGenTextures().

Definition at line 668 of file Texture.hpp.

void vl::Texture::setDimension ( ETextureDimension  dimension ) [inline]

The texture type (1d, 2d, cubemap etc.) as specified by the target parameter of glTexImage*().

Definition at line 671 of file Texture.hpp.

Referenced by createTexture().

ETextureDimension vl::Texture::dimension (  ) const [inline]

The texture type (1d, 2d, cubemap etc.) as specified by the target parameter of glTexImage*().

Definition at line 673 of file Texture.hpp.

Referenced by vl::TextureUnit::apply(), vl::FBOTexture2DAttachment::bindAttachment(), and setMipLevel().

void vl::Texture::setInternalFormat ( ETextureFormat  format ) [inline]

The texture internal format as pecified by the internalFormat parameter of glTexImage*().

Definition at line 676 of file Texture.hpp.

Referenced by createTexture().

ETextureFormat vl::Texture::internalFormat (  ) const [inline]

The texture internal format as pecified by the internalFormat parameter of glTexImage*().

Definition at line 678 of file Texture.hpp.

Referenced by isDepthTexture(), and setMipLevel().

void vl::Texture::setWidth ( int  x ) [inline]

The horizontal dimension of the texture in texels.

Definition at line 681 of file Texture.hpp.

Referenced by createTexture().

int vl::Texture::width (  ) const [inline]
void vl::Texture::setHeight ( int  y ) [inline]

The vertical dimension of the texture in texels.

Definition at line 686 of file Texture.hpp.

Referenced by createTexture().

int vl::Texture::height (  ) const [inline]
void vl::Texture::setDepth ( int  z ) [inline]

The z dimension of the texture in texels.

Definition at line 691 of file Texture.hpp.

Referenced by createTexture().

int vl::Texture::depth (  ) const [inline]

The z dimension of the texture in texels.

Definition at line 693 of file Texture.hpp.

Referenced by setMipLevel().

void vl::Texture::setBorder ( bool  border ) [inline]

Whether the texture has a 1 pixel texture border or not.

Definition at line 696 of file Texture.hpp.

Referenced by createTexture().

bool vl::Texture::border (  ) const [inline]

Whether the texture has a 1 pixel texture border or not.

Definition at line 698 of file Texture.hpp.

Referenced by createTexture(), setMipLevel(), and Texture().

int vl::Texture::samples (  ) const [inline]

Returns the number of samples of a multisample texture.

Definition at line 701 of file Texture.hpp.

Referenced by createTexture().

bool vl::Texture::fixedSamplesLocation (  ) const [inline]

Returns whether the samples location is fixed for a a multisample texture.

Definition at line 704 of file Texture.hpp.

const SetupParams* vl::Texture::setupParams (  ) const [inline]

See SetupParams.

Definition at line 707 of file Texture.hpp.

Referenced by createTexture(), and vl::Rendering::fillRenderQueue().

SetupParams* vl::Texture::setupParams (  ) [inline]

See SetupParams.

Definition at line 710 of file Texture.hpp.

void vl::Texture::setSetupParams ( SetupParams setup_params ) [inline]

See SetupParams.

Definition at line 713 of file Texture.hpp.

bool Texture::supports ( ETextureDimension  tex_dimension,
ETextureFormat  tex_format,
int  mip_level,
EImageDimension  img_dimension,
int  w,
int  h,
int  d,
bool  border,
int  samples,
bool  fixedsamplelocations,
bool  verbose 
) [static]
bool Texture::isCompressedFormat ( int  format ) [static]
bool Texture::isDepthTexture (  ) const
void Texture::clone ( const Texture other )

Copies all the texture parameters form the specified texture, including the OpenGL texture handle.

Mainly useful when you want to use the same texture object with different texture parameters.

Definition at line 1122 of file Texture.cpp.

References mBorder, mBufferObject, mDepth, mDimension, mFixedSamplesLocation, mFormat, mHandle, mHeight, mSamples, mSetupParams, mTexParameter, and mWidth.


Member Data Documentation

unsigned int vl::Texture::mHandle [protected]

Definition at line 734 of file Texture.hpp.

Referenced by clone(), createTexture(), destroyTexture(), and setMipLevel().

Definition at line 735 of file Texture.hpp.

Referenced by clone().

Definition at line 736 of file Texture.hpp.

Referenced by clone().

Definition at line 737 of file Texture.hpp.

Referenced by clone(), and createTexture().

Definition at line 738 of file Texture.hpp.

Referenced by clone().

Definition at line 739 of file Texture.hpp.

Referenced by clone().

int vl::Texture::mWidth [protected]

Definition at line 740 of file Texture.hpp.

Referenced by clone(), and isValid().

int vl::Texture::mHeight [protected]

Definition at line 741 of file Texture.hpp.

Referenced by clone(), and isValid().

int vl::Texture::mDepth [protected]

Definition at line 742 of file Texture.hpp.

Referenced by clone(), and isValid().

int vl::Texture::mSamples [protected]

Definition at line 743 of file Texture.hpp.

Referenced by clone(), and createTexture().

bool vl::Texture::mBorder [protected]

Definition at line 744 of file Texture.hpp.

Referenced by clone().

Definition at line 745 of file Texture.hpp.

Referenced by clone(), and createTexture().


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

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:47.
Permission is granted to use this page to write and publish articles regarding Visualization Library.