Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends

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
 SetupParams wraps all the parameters needed to crate a Texture. More...

Public Member Functions

 Texture (const String &image_path, ETextureFormat format=TF_RGBA, bool mipmaps=true, bool border=false)
 Constructs a 1D, 2D, 3D or Cubemap texture from the specified file.
 Texture (const Image *image, ETextureFormat format=TF_RGBA, bool mipmaps=true, bool border=false)
 Constructs a 1D, 2D, 3D or Cubemap 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.
const TexParametergetTexParameterOverride () const
 The TexParameter belonging to a TextureSampler that is currently overriding the Texture's own TexParameter.
BufferObjectbufferObject ()
 The buffer object bound to a buffer object texture.
const BufferObjectbufferObject () 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, BufferObject *bo, int samples, bool fixedsamplelocations)
 Creates an empty texture, with no mipmaps, of the specified type, format and dimensions.
bool setMipLevel (int mip_level, const 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.
bool 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.
bool createTexture1D (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates a 1D texture from the specified file.
void prepareTexture1D (const Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a 1D texture from the specified image.
bool createTexture1D (const 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.
bool 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.
bool createTexture2D (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates a 2D texture from the specified file.
void prepareTexture2D (const Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a 2D texture from the specified image.
bool createTexture2D (const 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.
bool 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.
bool createTexture3D (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates a 3D texture from the specified file.
void prepareTexture3D (const Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a 3D texture from the specified image.
bool createTexture3D (const 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.
bool 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.
bool createTextureCubemap (const String &image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
 Creates creation a cubemap texture from the specified file.
void prepareTextureCubemap (const Image *image, ETextureFormat format, bool mipmaps=true, bool border=false)
 Prepares for creation a cubemap texture from the specified image.
bool createTextureCubemap (const 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.
bool 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.
bool createTexture1DArray (const String &image_path, ETextureFormat format, bool mipmaps=true)
 Creates a 1d texture array from the specified file.
void prepareTexture1DArray (const Image *image, ETextureFormat format, bool mipmaps=true)
 Prepares for creation a 1d texture array from the specified image.
bool createTexture1DArray (const 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.
bool 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.
bool createTexture2DArray (const String &image_path, ETextureFormat format, bool mipmaps=true)
 Creates a 2d texture array from the specified file.
void prepareTexture2DArray (const Image *image, ETextureFormat format, bool mipmaps=true)
 Prepares for creation a 2d texture array from the specified image.
bool createTexture2DArray (const 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.
bool 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.
bool createTextureRectangle (const String &image_path, ETextureFormat format)
 Creates a texture rectangle from the specified file.
void prepareTextureRectangle (const Image *image, ETextureFormat format)
 Prepares for creation a texture rectangle from the specified image.
bool createTextureRectangle (const Image *image, ETextureFormat format)
 Creates a texture rectangle from the specified image.
void prepareTextureBuffer (vl::ETextureFormat format, BufferObject *bo)
 Prepares a texture buffer texture.
bool createTextureBuffer (vl::ETextureFormat format, BufferObject *bo)
 Creates a texture buffer texture.
void prepareTexture2DMultisample (int width, int height, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
 Prepares a 2D multisample texture.
bool 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.
bool createTexture2DMultisampleArray (int width, int height, int depth, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
 Creates a 3D multisample texture.
void setHandle (unsigned int id)
 OpenGL texture handle as returned by glGenTextures().
unsigned int handle () const
 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.
void setSamples (int samples)
 The number of samples of a multisample texture.
int samples () const
 The number of samples of a multisample texture.
void setFixedSamplesLocation (bool fixed)
 Whether the samples location is fixed for a a multisample texture.
bool fixedSamplesLocation () const
 Whether the samples location is fixed for a a multisample texture.
void setSetupParams (SetupParams *setup_params)
 See SetupParams.
const SetupParamssetupParams () const
 See SetupParams.
SetupParamssetupParams ()
 See SetupParams.
bool isValid () const
 Returns true if the current texture configuration seems valid.
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
ref< TexParametermTexParameter
ref< TexParametermTexParameterOverride
ref< SetupParamsmSetupParams
ref< BufferObjectmBufferObject
ETextureFormat mFormat
ETextureDimension mDimension
int mWidth
int mHeight
int mDepth
int mSamples
bool mBorder
bool mFixedSamplesLocation

Friends

class TextureSampler

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 TextureSampler.
See also:

Definition at line 142 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 1D, 2D, 3D or Cubemap 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 448 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(), mTexParameter, prepareTexture1D(), prepareTexture2D(), prepareTexture3D(), prepareTextureCubemap(), and VL_DEBUG_SET_OBJECT_NAME.

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

Constructs a 1D, 2D, 3D or Cubemap 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 420 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(), mTexParameter, 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 387 of file Texture.cpp.

References createTexture(), vl::Log::error(), mTexParameter, NULL, vl::TD_TEXTURE_1D, 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 398 of file Texture.cpp.

References createTexture(), vl::Log::error(), mTexParameter, NULL, vl::TD_TEXTURE_2D, 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 409 of file Texture.cpp.

References createTexture(), vl::Log::error(), mTexParameter, NULL, vl::TD_TEXTURE_3D, 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 478 of file Texture.cpp.

References mTexParameter, and VL_DEBUG_SET_OBJECT_NAME.

Texture::~Texture (  )

Destructor.

Definition at line 367 of file Texture.cpp.

References destroyTexture().


Member Function Documentation

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

The TexParameter object associated to a Texture.

Definition at line 248 of file Texture.hpp.

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

The TexParameter belonging to a TextureSampler that is currently overriding the Texture's own TexParameter.

Definition at line 251 of file Texture.hpp.

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

The buffer object bound to a buffer object texture.

Definition at line 254 of file Texture.hpp.

Referenced by createTexture().

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

The buffer object bound to a buffer object texture.

Definition at line 257 of file Texture.hpp.

void Texture::destroyTexture (  )

Destroys the texture.

Definition at line 359 of file Texture.cpp.

References 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 1085 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(), NULL, samples(), vl::Texture::SetupParams::setImage(), setMipLevel(), vl::Object::setObjectName(), setupParams(), vl::TF_UNKNOWN, 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,
BufferObject bo,
int  samples,
bool  fixedsamplelocations 
)
bool Texture::setMipLevel ( int  mip_level,
const 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 846 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(), vl::Has_GL_GENERATE_MIPMAP, vl::Has_glGenerateMipmaps, 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 281 of file Texture.hpp.

References NULL.

Referenced by Texture().

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

Creates an empty 1D texture.

Definition at line 288 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 295 of file Texture.hpp.

References NULL.

bool 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 302 of file Texture.hpp.

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

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

Definition at line 309 of file Texture.hpp.

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

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

Creates a 1D texture from the specified image.

Definition at line 320 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 327 of file Texture.hpp.

References NULL.

Referenced by Texture().

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

Creates an empty 2D texture.

Definition at line 335 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 342 of file Texture.hpp.

References NULL.

bool 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 349 of file Texture.hpp.

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

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

Definition at line 356 of file Texture.hpp.

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

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

Creates a 2D texture from the specified image.

Definition at line 367 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 374 of file Texture.hpp.

References NULL.

Referenced by Texture().

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

Creates an empty 3D texture.

Definition at line 383 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 390 of file Texture.hpp.

References NULL.

bool 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 397 of file Texture.hpp.

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

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

Definition at line 404 of file Texture.hpp.

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

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

Creates a 3D texture from the specified image.

Definition at line 415 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 422 of file Texture.hpp.

References NULL.

Referenced by Texture().

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

Creates an empty cubemap texture.

Definition at line 430 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 437 of file Texture.hpp.

References NULL.

bool 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 444 of file Texture.hpp.

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

Prepares for creation a cubemap texture from the specified image.

Definition at line 451 of file Texture.hpp.

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

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

Creates a cubemap texture from the specified image.

Definition at line 462 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 469 of file Texture.hpp.

References NULL.

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

Creates an empty 1D array texture.

Definition at line 477 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 484 of file Texture.hpp.

References NULL.

bool 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 491 of file Texture.hpp.

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

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

Definition at line 498 of file Texture.hpp.

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

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

Creates a 1d texture array from the specified image.

Definition at line 509 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 516 of file Texture.hpp.

References NULL.

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

Creates an empty 2D array texture.

Definition at line 525 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 532 of file Texture.hpp.

References NULL.

bool 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 539 of file Texture.hpp.

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

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

Definition at line 546 of file Texture.hpp.

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

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

Creates a 2d texture array from the specified image.

Definition at line 557 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 564 of file Texture.hpp.

References NULL.

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

Creates an empty texture rectangle.

Definition at line 572 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 579 of file Texture.hpp.

References NULL.

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

Creates a texture rectangle from the specified file.

Definition at line 586 of file Texture.hpp.

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

Prepares for creation a texture rectangle from the specified image.

Definition at line 593 of file Texture.hpp.

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

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

Creates a texture rectangle from the specified image.

Definition at line 604 of file Texture.hpp.

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

Prepares a texture buffer texture.

The BufferObject can come from an Array* or from ImagePBO or can be a stand-alone BufferObject as well.

Definition at line 611 of file Texture.hpp.

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

bool vl::Texture::createTextureBuffer ( vl::ETextureFormat  format,
BufferObject bo 
) [inline]

Creates a texture buffer texture.

The BufferObject can come from an Array* or from ImagePBO or can be a stand-alone BufferObject as well.

Definition at line 622 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 629 of file Texture.hpp.

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

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

Creates a 2D multisample texture.

Definition at line 643 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 650 of file Texture.hpp.

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

bool 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 665 of file Texture.hpp.

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

OpenGL texture handle as returned by glGenTextures().

Definition at line 672 of file Texture.hpp.

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

OpenGL texture handle as returned by glGenTextures().

Definition at line 674 of file Texture.hpp.

Referenced by isValid().

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 677 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 679 of file Texture.hpp.

Referenced by vl::TextureSampler::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 682 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 684 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 687 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 692 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 697 of file Texture.hpp.

Referenced by createTexture().

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

The z dimension of the texture in texels.

Definition at line 699 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 702 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 704 of file Texture.hpp.

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

void vl::Texture::setSamples ( int  samples ) [inline]

The number of samples of a multisample texture.

Definition at line 707 of file Texture.hpp.

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

The number of samples of a multisample texture.

Definition at line 709 of file Texture.hpp.

Referenced by createTexture().

void vl::Texture::setFixedSamplesLocation ( bool  fixed ) [inline]

Whether the samples location is fixed for a a multisample texture.

Definition at line 712 of file Texture.hpp.

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

Whether the samples location is fixed for a a multisample texture.

Definition at line 714 of file Texture.hpp.

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

See SetupParams.

Definition at line 717 of file Texture.hpp.

Referenced by vl::VLXClassWrapper_Texture::importTexture().

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

See SetupParams.

Definition at line 723 of file Texture.hpp.

bool Texture::isValid (  ) const

Returns true if the current texture configuration seems valid.

Definition at line 485 of file Texture.cpp.

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

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 1186 of file Texture.cpp.

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

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]

Friends And Related Function Documentation

friend class TextureSampler [friend]

Definition at line 145 of file Texture.hpp.


Member Data Documentation

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

Definition at line 747 of file Texture.hpp.

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

Definition at line 748 of file Texture.hpp.

Referenced by clone(), and Texture().

Definition at line 749 of file Texture.hpp.

Referenced by vl::TextureSampler::apply().

Definition at line 750 of file Texture.hpp.

Referenced by clone().

Definition at line 751 of file Texture.hpp.

Referenced by clone(), and createTexture().

Definition at line 752 of file Texture.hpp.

Referenced by clone().

Definition at line 753 of file Texture.hpp.

Referenced by clone().

int vl::Texture::mWidth [protected]

Definition at line 754 of file Texture.hpp.

Referenced by clone(), and isValid().

int vl::Texture::mHeight [protected]

Definition at line 755 of file Texture.hpp.

Referenced by clone(), and isValid().

int vl::Texture::mDepth [protected]

Definition at line 756 of file Texture.hpp.

Referenced by clone(), and isValid().

int vl::Texture::mSamples [protected]

Definition at line 757 of file Texture.hpp.

Referenced by clone(), and createTexture().

bool vl::Texture::mBorder [protected]

Definition at line 758 of file Texture.hpp.

Referenced by clone().

Definition at line 759 of file Texture.hpp.

Referenced by clone(), and createTexture().


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:12.
Permission is granted to use this page to write and publish articles regarding Visualization Library.