# Visualization Library

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

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Attributes

# vl::TextureSampler Class Reference

The TextureSampler class associates a Texture object to an OpenGL texture unit. More...

`#include <Shader.hpp>`

Inheritance diagram for vl::TextureSampler:

List of all members.

## Public Member Functions

| TextureSampler ()
virtual ERenderState | type () const
virtual void | apply (int index, const Camera *, OpenGLContext *ctx) const
| The parameter cameara is NULL if we are disabling the state, non-NULL if we are enabling it.
void | setTexture (Texture *texture)
| The texture sampler by a texture unit.
Texture * | texture ()
| The texture sampler by a texture unit.
const Texture * | texture () const
| The texture sampler by a texture unit.
void | setTexParameter (TexParameter *tex_param)
| The TexParameter used by the sampler used to override the one specified by the bound Texture.
TexParameter * | getTexParameter ()
| The TexParameter used by the sampler used to override the one specified by the bound Texture.
const TexParameter * | getTexParameter () const
| The TexParameter used by the sampler used to override the one specified by the bound Texture.
bool | hasTexture () const
virtual ref< RenderState > | clone () const

## Protected Attributes

ref< Texture > | mTexture
ref< TexParameter > | mTexParameter

## Detailed Description

The TextureSampler class associates a Texture object to an OpenGL texture unit.

See also:
  Texture, TexParameter, Shader, TextureMatrix, TexEnv, TexGen, Effect, Actor

Definition at line 1747 of file Shader.hpp.

## Constructor & Destructor Documentation

vl::TextureSampler::TextureSampler | ( | ) | `[inline]`

Definition at line 1752 of file Shader.hpp.

References VL_DEBUG_SET_OBJECT_NAME.

## Member Function Documentation

virtual ERenderState vl::TextureSampler::type | ( | ) | const`[inline, virtual]`

Reimplemented from vl::RenderState.

Definition at line 1757 of file Shader.hpp.

References vl::RS_TextureSampler.

void TextureSampler::apply | ( | int | index,
|  | const Camera * | camera,
|  | OpenGLContext * | ctx
| ) |  | const`[virtual]`

The parameter cameara is NULL if we are disabling the state, non-NULL if we are enabling it.

Implements vl::RenderState.

Definition at line 1142 of file Shader.cpp.

References vl::TexParameter::apply(), vl::Log::bug(), vl::Texture::dimension(), vl::Texture::getTexParameter(), getTexParameter(), vl::Has_Fixed_Function_Pipeline, hasTexture(), vl::Texture::mTexParameterOverride, vl::Object::objectName(), vl::TexParameter::setDirty(), vl::OpenGLContext::setTexUnitBinding(), vl::TD_TEXTURE_1D_ARRAY, vl::TD_TEXTURE_2D_ARRAY, vl::TD_TEXTURE_2D_MULTISAMPLE, vl::TD_TEXTURE_2D_MULTISAMPLE_ARRAY, vl::TD_TEXTURE_BUFFER, vl::TD_TEXTURE_CUBE_MAP, texture(), vl::OpenGLContext::texUnitBinding(), vl::TPF_LINEAR_MIPMAP_LINEAR, vl::TPF_LINEAR_MIPMAP_NEAREST, vl::TPF_NEAREST_MIPMAP_LINEAR, vl::TPF_NEAREST_MIPMAP_NEAREST, VL_CHECK, VL_CHECK_OGL, VL_MAX_TEXTURE_UNITS, and VL_TRAP.

void vl::TextureSampler::setTexture | ( | Texture * | texture ) | `[inline]`

The texture sampler by a texture unit.

Note:
  You can override the Texture's TexParameter on a per-TextureSampler basis using the setTexParameter() method.

Definition at line 1762 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_TextureSampler::importTextureSampler().

Texture* vl::TextureSampler::texture | ( | ) | `[inline]`

The texture sampler by a texture unit.

Definition at line 1765 of file Shader.hpp.

Referenced by apply(), vl::VLXClassWrapper_TextureSampler::exportTextureSampler(), and vl::Rendering::fillRenderQueue().

const Texture* vl::TextureSampler::texture | ( | ) | const`[inline]`

The texture sampler by a texture unit.

Definition at line 1768 of file Shader.hpp.

void vl::TextureSampler::setTexParameter | ( | TexParameter * | tex_param ) | `[inline]`

The TexParameter used by the sampler used to override the one specified by the bound Texture.

Note:
  Using this method some performance penalty might incur as the Texture's TexParameter might need to be setup and restored several times during the rendering.

Definition at line 1772 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_TextureSampler::importTextureSampler().

TexParameter* vl::TextureSampler::getTexParameter | ( | ) | `[inline]`

The TexParameter used by the sampler used to override the one specified by the bound Texture.

Definition at line 1775 of file Shader.hpp.

Referenced by apply(), and vl::VLXClassWrapper_TextureSampler::exportTextureSampler().

const TexParameter* vl::TextureSampler::getTexParameter | ( | ) | const`[inline]`

The TexParameter used by the sampler used to override the one specified by the bound Texture.

Definition at line 1778 of file Shader.hpp.

bool TextureSampler::hasTexture | ( | ) | const

Definition at line 1137 of file Shader.cpp.

References mTexture.

Referenced by apply().

virtual ref<RenderState> vl::TextureSampler::clone | ( | ) | const`[inline, virtual]`

Implements vl::RenderState.

Definition at line 1782 of file Shader.hpp.

## Member Data Documentation

ref<Texture> vl::TextureSampler::mTexture`[protected]`

Definition at line 1790 of file Shader.hpp.

Referenced by hasTexture().

ref<TexParameter> vl::TextureSampler::mTexParameter`[protected]`

Definition at line 1791 of file Shader.hpp.

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/Shader.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/Shader.cpp

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:53.
Permission is granted to use this page to write and publish articles regarding Visualization Library.