RenderTools::Sampler Class Reference

#include <Sampler.h>

Inheritance diagram for RenderTools::Sampler:

RenderTools::BindingInterface RenderTools::Image RenderTools::AbstractPropertyContainer RenderTools::ContainerProperty RenderTools::AbstractProperty RenderTools::InitializeInterface

List of all members.

Public Member Functions

 Sampler (GLuint width, GLuint height, GLubyte *data=0)
 Sampler (void)
virtual ~Sampler (void)
virtual void createProperties (void)
virtual const string getTypeName (bool ofComponent=false) const
virtual void onInitialize (void)
virtual void onBind (int unit)
virtual void onUnbind (int unit)
void setTexEnv (void)
void setData (const void *data)
void clear (void)
void download (string filename="")
void setDefaultColor (const Vec4 &color)
const Vec4getDefaultColor (void) const
GLuint getWidth (void) const
GLuint getHeight (void) const
GLuint getWidth2 (void) const
GLuint getHeight2 (void) const
Vec2 getSize (void) const
Vec2 getSize2 (void) const
GLuint getID (void) const
GLenum getInternalFormat (void) const
GLenum getTarget (void) const
GLenum getMode (void) const
GLenum getWrap (void) const
GLenum getFilter (void) const
GLboolean isResident (void) const

Static Public Member Functions

static PropertyPtr create (const XMLNodePtr &xml=XMLNodePtr())

Protected Attributes

GLuint m_w2
 power of two width
GLuint m_h2
 power of 2 height
GLuint m_id
 sampler object id ( glGenSamplers )
GLenum m_internal
GLenum m_target
 depending on m_makePOT being true or false, resp.
GLenum m_mode
 GL_MODULATE, GL_DECAL, GL_BLEND, or GL_REPLACE.
GLenum m_wrap
 GL_CLAMP, GL_CLAMP_TO_EDGE, or GL_REPEAT.
GLenum m_filter
GLuint m_formatGL
GLuint m_typeGL
GLboolean m_makePOT
 if true, sampler is forced to be Power of Two
GLboolean m_doMipMap
 if true, mipmaps are generated before upload
GLboolean m_doCleanup
 if set, all datablocks are freed after construction
Vec4 m_defaultColor
bool m_overrideDefaultColor


Detailed Description

Definition at line 23 of file Sampler.h.


Constructor & Destructor Documentation

Sampler::Sampler ( GLuint  width,
GLuint  height,
GLubyte *  data = 0 
)

Definition at line 14 of file Sampler.cpp.

Sampler::Sampler ( void   ) 

Definition at line 34 of file Sampler.cpp.

Sampler::~Sampler ( void   )  [virtual]

delete the texture object

Definition at line 349 of file Sampler.cpp.


Member Function Documentation

void Sampler::clear ( void   ) 

Reimplemented from RenderTools::AbstractProperty.

Definition at line 611 of file Sampler.cpp.

PropertyPtr Sampler::create ( const XMLNodePtr xml = XMLNodePtr()  )  [static]

Reimplemented from RenderTools::Image.

Definition at line 53 of file Sampler.cpp.

void Sampler::createProperties ( void   )  [virtual]

Reimplemented from RenderTools::Image.

Definition at line 61 of file Sampler.cpp.

void Sampler::download ( string  filename = ""  ) 

Definition at line 628 of file Sampler.cpp.

const Vec4 & Sampler::getDefaultColor ( void   )  const

Definition at line 354 of file Sampler.cpp.

GLenum Sampler::getFilter ( void   )  const

Definition at line 406 of file Sampler.cpp.

GLuint Sampler::getHeight ( void   )  const

Reimplemented from RenderTools::Image.

Definition at line 366 of file Sampler.cpp.

GLuint Sampler::getHeight2 ( void   )  const

Definition at line 374 of file Sampler.cpp.

GLuint Sampler::getID ( void   )  const

Definition at line 386 of file Sampler.cpp.

GLenum Sampler::getInternalFormat ( void   )  const

Definition at line 390 of file Sampler.cpp.

GLenum Sampler::getMode ( void   )  const

Definition at line 398 of file Sampler.cpp.

Vec2 Sampler::getSize ( void   )  const

Definition at line 378 of file Sampler.cpp.

Vec2 Sampler::getSize2 ( void   )  const

Definition at line 382 of file Sampler.cpp.

GLenum Sampler::getTarget ( void   )  const

Definition at line 394 of file Sampler.cpp.

const string Sampler::getTypeName ( bool  ofComponent = false  )  const [virtual]

Reimplemented from RenderTools::Image.

Definition at line 345 of file Sampler.cpp.

GLuint Sampler::getWidth ( void   )  const

Reimplemented from RenderTools::Image.

Definition at line 362 of file Sampler.cpp.

GLuint Sampler::getWidth2 ( void   )  const

Definition at line 370 of file Sampler.cpp.

GLenum Sampler::getWrap ( void   )  const

Definition at line 402 of file Sampler.cpp.

GLboolean Sampler::isResident ( void   )  const

returns wether or not the Texture is resident

Definition at line 814 of file Sampler.cpp.

void Sampler::onBind ( int  unit  )  [virtual]

Implements RenderTools::BindingInterface.

Definition at line 719 of file Sampler.cpp.

void Sampler::onInitialize ( void   )  [virtual]

checks if the image data is already power of two and then uploads. if not power-of-two, allocates a new datablock and copies the image data into it. The image data and texture power-of-two data are detroyed after the upload.

copy the internal format from the format set by image

set default if no file was specified OR if it could not be found

if we dont have an initial buffer, create one.

we have non-power-of-two width & height, but no RECTANGLE_EXT,

TODO:FIXME bug in reading .tif ? crashes here -presumably on wrong data

oopsie. this happens when the image reads a different format than specified by the Sampler

DEBUG 0XDE1 = GL_TEXTURE_2D

Reimplemented from RenderTools::Image.

Definition at line 416 of file Sampler.cpp.

void Sampler::onUnbind ( int  unit  )  [virtual]

i > 7 results in a GL_INVALID_VALUE error, contradicting http://www.opengl.org/sdk/docs/man/xhtml/glActiveTexture.xml resolved by taking the smaller of GL_MAX_TEXTURE_COORDS and GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS instead of the documented larger

Implements RenderTools::BindingInterface.

Definition at line 772 of file Sampler.cpp.

void Sampler::setData ( const void *  data  ) 

Definition at line 711 of file Sampler.cpp.

void Sampler::setDefaultColor ( const Vec4 color  ) 

Definition at line 358 of file Sampler.cpp.

void Sampler::setTexEnv ( void   ) 

Definition at line 735 of file Sampler.cpp.


Member Data Documentation

Definition at line 108 of file Sampler.h.

GLboolean RenderTools::Sampler::m_doCleanup [protected]

if set, all datablocks are freed after construction

Definition at line 107 of file Sampler.h.

GLboolean RenderTools::Sampler::m_doMipMap [protected]

if true, mipmaps are generated before upload

Definition at line 106 of file Sampler.h.

GLenum RenderTools::Sampler::m_filter [protected]

mipmap filtering, one of: GL_NEAREST, GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_LINEAR

Definition at line 93 of file Sampler.h.

data format in GL, corresponds to image format, one of: GL_COLOR_INDEX, GL_ALPHA, GL_RGB, GL_RGBA, GL_LUMINANCE, or GL_LUMINANCE_ALPHA.

Definition at line 97 of file Sampler.h.

GLuint RenderTools::Sampler::m_h2 [protected]

power of 2 height

Definition at line 60 of file Sampler.h.

GLuint RenderTools::Sampler::m_id [protected]

sampler object id ( glGenSamplers )

Definition at line 61 of file Sampler.h.

internal GL mode, one of the following : GL_ALPHA, GL_ALPHA4, GL_ALPHA8, GL_ALPHA12, GL_ALPHA16, GL_LUMINANCE, GL_LUMINANCE4, GL_LUMINANCE8, GL_LUMINANCE12, GL_LUMINANCE16, GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12, GL_LUMINANCE16_ALPHA16, GL_INTENSITY, GL_INTENSITY4, GL_INTENSITY8, GL_INTENSITY12, GL_INTENSITY16, GL_RGB, GL_R3_G3_B2, GL_RGB4, GL_RGB5, GL_RGB8, GL_RGB10, GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4, GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12, GL_RGBA16, GL_RGBA32F_ARB, GL_RGB32F_ARB, GL_ALPHA32F_ARB, GL_INTENSITY32F_ARB, GL_LUMINANCE32F_ARB, GL_LUMINANCE_ALPHA32F_ARB, GL_RGBA16F_ARB, GL_RGB16F_ARB, GL_ALPHA16F_ARB, GL_INTENSITY16F_ARB, GL_LUMINANCE16F_ARB, GL_LUMINANCE_ALPHA16F_ARB GL_STENCIL_INDEX1, GL_STENCIL_INDEX4, GL_STENCIL_INDEX8, GL_STENCIL_INDEX16, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT32F_NV, GL_DEPTH_BUFFER_FLOAT_MODE_NV

Definition at line 62 of file Sampler.h.

GLboolean RenderTools::Sampler::m_makePOT [protected]

if true, sampler is forced to be Power of Two

Definition at line 105 of file Sampler.h.

GLenum RenderTools::Sampler::m_mode [protected]

GL_MODULATE, GL_DECAL, GL_BLEND, or GL_REPLACE.

sampler mode, one of:

Definition at line 89 of file Sampler.h.

Definition at line 109 of file Sampler.h.

GLenum RenderTools::Sampler::m_target [protected]

depending on m_makePOT being true or false, resp.

set to either GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_EXT,

Definition at line 87 of file Sampler.h.

GLuint RenderTools::Sampler::m_typeGL [protected]

data type in GL, corresponds to image data type, one of: GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, GL_FLOAT, or GL_HALF_FLOAT.

Definition at line 100 of file Sampler.h.

GLuint RenderTools::Sampler::m_w2 [protected]

power of two width

Definition at line 59 of file Sampler.h.

GLenum RenderTools::Sampler::m_wrap [protected]

GL_CLAMP, GL_CLAMP_TO_EDGE, or GL_REPEAT.

sampler wrapping mode, one of:

Definition at line 91 of file Sampler.h.


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

Generated on Wed Jan 26 00:15:37 2011 for RenderTools by  doxygen 1.5.8