vtkTextureObject Class Reference

#include <vtkTextureObject.h>

Inheritance diagram for vtkTextureObject:

Inheritance graph
[legend]
Collaboration diagram for vtkTextureObject:

Collaboration graph
[legend]

List of all members.


Detailed Description

abstracts an OpenGL texture object.

vtkTextureObject represents an OpenGL texture object. It provides API to create textures using data already loaded into pixel buffer objects. It can also be used to create textures without uploading any data.

Warning:
DON'T PLAY WITH IT YET.

Definition at line 35 of file vtkTextureObject.h.


Public Types

enum  {
  Lequal = 0, Gequal, Less, Greater,
  Equal, NotEqual, AlwaysTrue, Never
}
enum  { Luminance = 0, Intensity, Alpha }
enum  {
  Clamp = 0, ClampToEdge, Repeat, ClampToBorder,
  MirroredRepeat
}
enum  {
  Nearest = 0, Linear, NearestMipmapNearest, NearestMipmapLinear,
  LinearMipmapNearest, LinearMipmapLinear
}
typedef vtkObject Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
virtual int GetNumberOfDimensions ()
bool IsBound ()
void SendParameters ()
vtkPixelBufferObjectDownload ()
int GetDataType ()
int GetInternalFormat (int vtktype, int numComps, bool shaderSupportsTextureInt)
int GetFormat (int vtktype, int numComps, bool shaderSupportsTextureInt)
void SetContext (vtkRenderWindow *)
vtkRenderWindowGetContext ()
virtual unsigned int GetWidth ()
virtual unsigned int GetHeight ()
virtual unsigned int GetDepth ()
virtual int GetComponents ()
virtual int GetTarget ()
virtual unsigned int GetHandle ()
void Bind ()
void UnBind ()
bool Create1D (int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
bool Create2D (unsigned int width, unsigned int height, int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
bool Create3D (unsigned int width, unsigned int height, unsigned int depth, int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
bool Create2D (unsigned int width, unsigned int height, int numComps, int vtktype, bool shaderSupportsTextureInt)
bool Create3D (unsigned int width, unsigned int height, unsigned int depth, int numComps, int vtktype, bool shaderSupportsTextureInt)
virtual int GetWrapS ()
virtual void SetWrapS (int)
virtual int GetWrapT ()
virtual void SetWrapT (int)
virtual int GetWrapR ()
virtual void SetWrapR (int)
virtual int GetMinificationFilter ()
virtual void SetMinificationFilter (int)
virtual bool GetLinearMagnification ()
virtual void SetLinearMagnification (bool)
virtual void SetBorderColor (float, float, float, float)
virtual void SetBorderColor (float[4])
virtual float * GetBorderColor ()
virtual void GetBorderColor (float &, float &, float &, float &)
virtual void GetBorderColor (float[4])
virtual void SetPriority (float)
virtual float GetPriority ()
virtual void SetMinLOD (float)
virtual float GetMinLOD ()
virtual void SetMaxLOD (float)
virtual float GetMaxLOD ()
virtual void SetBaseLevel (int)
virtual int GetBaseLevel ()
virtual void SetMaxLevel (int)
virtual int GetMaxLevel ()
virtual bool GetDepthTextureCompare ()
virtual void SetDepthTextureCompare (bool)
virtual int GetDepthTextureCompareFunction ()
virtual void SetDepthTextureCompareFunction (int)
virtual int GetDepthTextureMode ()
virtual void SetDepthTextureMode (int)
virtual bool GetGenerateMipmap ()
virtual void SetGenerateMipmap (bool)

Static Public Member Functions

static vtkTextureObjectNew ()
static int IsTypeOf (const char *type)
static vtkTextureObjectSafeDownCast (vtkObject *o)
static bool IsSupported (vtkRenderWindow *renWin)

Protected Member Functions

 vtkTextureObject ()
 ~vtkTextureObject ()
bool LoadRequiredExtensions (vtkOpenGLExtensionManager *)
void CreateTexture ()
void DestroyTexture ()

Protected Attributes

int NumberOfDimensions
unsigned int Width
unsigned int Height
unsigned int Depth
int Target
int Format
int Type
int Components
vtkWeakPointer< vtkRenderWindowContext
unsigned int Handle
bool SupportsTextureInteger
int WrapS
int WrapT
int WrapR
int MinificationFilter
bool LinearMagnification
float BorderColor [4]
float Priority
float MinLOD
float MaxLOD
int BaseLevel
int MaxLevel
bool DepthTextureCompare
int DepthTextureCompareFunction
int DepthTextureMode
bool GenerateMipmap
vtkTimeStamp SendParametersTime

Member Typedef Documentation

Reimplemented from vtkObject.

Definition at line 84 of file vtkTextureObject.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
Lequal 
Gequal 
Less 
Greater 
Equal 
NotEqual 
AlwaysTrue 
Never 

Definition at line 41 of file vtkTextureObject.h.

anonymous enum

Enumerator:
Luminance 
Intensity 
Alpha 

Definition at line 54 of file vtkTextureObject.h.

anonymous enum

Enumerator:
Clamp 
ClampToEdge 
Repeat 
ClampToBorder 
MirroredRepeat 

Definition at line 62 of file vtkTextureObject.h.

anonymous enum

Enumerator:
Nearest 
Linear 
NearestMipmapNearest 
NearestMipmapLinear 
LinearMipmapNearest 
LinearMipmapLinear 

Definition at line 72 of file vtkTextureObject.h.


Constructor & Destructor Documentation

vtkTextureObject::vtkTextureObject (  )  [protected]

vtkTextureObject::~vtkTextureObject (  )  [protected]


Member Function Documentation

static vtkTextureObject* vtkTextureObject::New (  )  [static]

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkObject.

virtual const char* vtkTextureObject::GetClassName (  )  [virtual]

Reimplemented from vtkObject.

static int vtkTextureObject::IsTypeOf ( const char *  name  )  [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

virtual int vtkTextureObject::IsA ( const char *  name  )  [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

static vtkTextureObject* vtkTextureObject::SafeDownCast ( vtkObject o  )  [static]

Reimplemented from vtkObject.

void vtkTextureObject::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

void vtkTextureObject::SetContext ( vtkRenderWindow  ) 

Get/Set the context. This does not increase the reference count of the context to avoid reference loops. SetContext() may raise an error is the OpenGL context does not support the required OpenGL extensions.

vtkRenderWindow* vtkTextureObject::GetContext (  ) 

Get/Set the context. This does not increase the reference count of the context to avoid reference loops. SetContext() may raise an error is the OpenGL context does not support the required OpenGL extensions.

virtual unsigned int vtkTextureObject::GetWidth (  )  [virtual]

Get the texture dimensions. These are the properties of the OpenGL texture this instance represents.

virtual unsigned int vtkTextureObject::GetHeight (  )  [virtual]

Get the texture dimensions. These are the properties of the OpenGL texture this instance represents.

virtual unsigned int vtkTextureObject::GetDepth (  )  [virtual]

Get the texture dimensions. These are the properties of the OpenGL texture this instance represents.

virtual int vtkTextureObject::GetComponents (  )  [virtual]

Get the texture dimensions. These are the properties of the OpenGL texture this instance represents.

virtual int vtkTextureObject::GetNumberOfDimensions (  )  [virtual]

virtual int vtkTextureObject::GetTarget (  )  [virtual]

Returns OpenGL texture target to which the texture is/can be bound.

virtual unsigned int vtkTextureObject::GetHandle (  )  [virtual]

Returns the OpenGL handle.

void vtkTextureObject::Bind (  ) 

Activate the texture. The texture must have been created using Create(). RenderWindow must be set before calling this.

void vtkTextureObject::UnBind (  ) 

Activate the texture. The texture must have been created using Create(). RenderWindow must be set before calling this.

bool vtkTextureObject::IsBound (  ) 

Tells if the texture object is bound.

void vtkTextureObject::SendParameters (  ) 

Send all the texture object parameters to the hardware if not done yet.

Precondition:
is_bound: IsBound()

bool vtkTextureObject::Create1D ( int  numComps,
vtkPixelBufferObject pbo,
bool  shaderSupportsTextureInt 
)

Create a 1D texture using the PBO. Eventually we may start supporting creating a texture from subset of data in the PBO, but for simplicity we'll begin with entire PBO data. numComps must be in [1-4]. shaderSupportsTextureInt is true if the shader has an alternate implementation supporting sampler with integer values. Even if the card supports texture int, it does not mean that the implementor of the shader made a version that supports texture int.

bool vtkTextureObject::Create2D ( unsigned int  width,
unsigned int  height,
int  numComps,
vtkPixelBufferObject pbo,
bool  shaderSupportsTextureInt 
)

Create a 2D texture using the PBO. Eventually we may start supporting creating a texture from subset of data in the PBO, but for simplicity we'll begin with entire PBO data. numComps must be in [1-4].

bool vtkTextureObject::Create3D ( unsigned int  width,
unsigned int  height,
unsigned int  depth,
int  numComps,
vtkPixelBufferObject pbo,
bool  shaderSupportsTextureInt 
)

Create a 3D texture using the PBO. Eventually we may start supporting creating a texture from subset of data in the PBO, but for simplicity we'll begin with entire PBO data. numComps must be in [1-4].

bool vtkTextureObject::Create2D ( unsigned int  width,
unsigned int  height,
int  numComps,
int  vtktype,
bool  shaderSupportsTextureInt 
)

Create texture without uploading any data. To create a DEPTH_COMPONENT texture, vtktype must be set to VTK_VOID and numComps must be 1.

bool vtkTextureObject::Create3D ( unsigned int  width,
unsigned int  height,
unsigned int  depth,
int  numComps,
int  vtktype,
bool  shaderSupportsTextureInt 
)

Create texture without uploading any data. To create a DEPTH_COMPONENT texture, vtktype must be set to VTK_VOID and numComps must be 1.

vtkPixelBufferObject* vtkTextureObject::Download (  ) 

This is used to download raw data from the texture into a pixel bufer. The pixel buffer API can then be used to download the pixel buffer data to CPU arrays. The caller takes on the responsibility of deleting the returns vtkPixelBufferObject once it done with it.

int vtkTextureObject::GetDataType (  ) 

Get the data type for the texture as a vtk type int i.e. VTK_INT etc.

int vtkTextureObject::GetInternalFormat ( int  vtktype,
int  numComps,
bool  shaderSupportsTextureInt 
)

int vtkTextureObject::GetFormat ( int  vtktype,
int  numComps,
bool  shaderSupportsTextureInt 
)

virtual int vtkTextureObject::GetWrapS (  )  [virtual]

Wrap mode for the first texture coordinate "s" Valid values are: - Clamp - ClampToEdge - Repeat - ClampToBorder - MirroredRepeat Initial value is Repeat (as in OpenGL spec)

virtual void vtkTextureObject::SetWrapS ( int   )  [virtual]

Wrap mode for the first texture coordinate "s" Valid values are: - Clamp - ClampToEdge - Repeat - ClampToBorder - MirroredRepeat Initial value is Repeat (as in OpenGL spec)

virtual int vtkTextureObject::GetWrapT (  )  [virtual]

Wrap mode for the first texture coordinate "t" Valid values are: - Clamp - ClampToEdge - Repeat - ClampToBorder - MirroredRepeat Initial value is Repeat (as in OpenGL spec)

virtual void vtkTextureObject::SetWrapT ( int   )  [virtual]

Wrap mode for the first texture coordinate "t" Valid values are: - Clamp - ClampToEdge - Repeat - ClampToBorder - MirroredRepeat Initial value is Repeat (as in OpenGL spec)

virtual int vtkTextureObject::GetWrapR (  )  [virtual]

Wrap mode for the first texture coordinate "r" Valid values are: - Clamp - ClampToEdge - Repeat - ClampToBorder - MirroredRepeat Initial value is Repeat (as in OpenGL spec)

virtual void vtkTextureObject::SetWrapR ( int   )  [virtual]

Wrap mode for the first texture coordinate "r" Valid values are: - Clamp - ClampToEdge - Repeat - ClampToBorder - MirroredRepeat Initial value is Repeat (as in OpenGL spec)

virtual int vtkTextureObject::GetMinificationFilter (  )  [virtual]

Minification filter mode. Valid values are: - Nearest - Linear - NearestMipmapNearest - NearestMipmapLinear - LinearMipmapNearest - LinearMipmapLinear Initial value is NearestMipMapLinear (note initial value in OpenGL spec is NearestMipMapLinear but this is error-prone because it makes the texture object incomplete. ).

virtual void vtkTextureObject::SetMinificationFilter ( int   )  [virtual]

Minification filter mode. Valid values are: - Nearest - Linear - NearestMipmapNearest - NearestMipmapLinear - LinearMipmapNearest - LinearMipmapLinear Initial value is NearestMipMapLinear (note initial value in OpenGL spec is NearestMipMapLinear but this is error-prone because it makes the texture object incomplete. ).

virtual bool vtkTextureObject::GetLinearMagnification (  )  [virtual]

Tells if the magnification mode is linear (true) or nearest (false). Initial value is false (initial value in OpenGL spec is true).

virtual void vtkTextureObject::SetLinearMagnification ( bool   )  [virtual]

Tells if the magnification mode is linear (true) or nearest (false). Initial value is false (initial value in OpenGL spec is true).

virtual void vtkTextureObject::SetBorderColor ( float  ,
float  ,
float  ,
float   
) [virtual]

Border Color (RGBA). Each component is in [0.0f,1.0f]. Initial value is (0.0f,0.0f,0.0f,0.0f), as in OpenGL spec.

virtual void vtkTextureObject::SetBorderColor ( float  [4]  )  [virtual]

Border Color (RGBA). Each component is in [0.0f,1.0f]. Initial value is (0.0f,0.0f,0.0f,0.0f), as in OpenGL spec.

virtual float* vtkTextureObject::GetBorderColor (  )  [virtual]

Border Color (RGBA). Each component is in [0.0f,1.0f]. Initial value is (0.0f,0.0f,0.0f,0.0f), as in OpenGL spec.

virtual void vtkTextureObject::GetBorderColor ( float &  ,
float &  ,
float &  ,
float &   
) [virtual]

Border Color (RGBA). Each component is in [0.0f,1.0f]. Initial value is (0.0f,0.0f,0.0f,0.0f), as in OpenGL spec.

virtual void vtkTextureObject::GetBorderColor ( float  [4]  )  [virtual]

Border Color (RGBA). Each component is in [0.0f,1.0f]. Initial value is (0.0f,0.0f,0.0f,0.0f), as in OpenGL spec.

virtual void vtkTextureObject::SetPriority ( float   )  [virtual]

Priority of the texture object to be resident on the card for higher performance in the range [0.0f,1.0f]. Initial value is 1.0f, as in OpenGL spec.

virtual float vtkTextureObject::GetPriority (  )  [virtual]

Priority of the texture object to be resident on the card for higher performance in the range [0.0f,1.0f]. Initial value is 1.0f, as in OpenGL spec.

virtual void vtkTextureObject::SetMinLOD ( float   )  [virtual]

Lower-clamp the computed LOD against this value. Any float value is valid. Initial value is -1000.0f, as in OpenGL spec.

virtual float vtkTextureObject::GetMinLOD (  )  [virtual]

Lower-clamp the computed LOD against this value. Any float value is valid. Initial value is -1000.0f, as in OpenGL spec.

virtual void vtkTextureObject::SetMaxLOD ( float   )  [virtual]

Upper-clamp the computed LOD against this value. Any float value is valid. Initial value is 1000.0f, as in OpenGL spec.

virtual float vtkTextureObject::GetMaxLOD (  )  [virtual]

Upper-clamp the computed LOD against this value. Any float value is valid. Initial value is 1000.0f, as in OpenGL spec.

virtual void vtkTextureObject::SetBaseLevel ( int   )  [virtual]

Level of detail of the first texture image. A texture object is a list of texture images. It is a non-negative integer value. Initial value is 0, as in OpenGL spec.

virtual int vtkTextureObject::GetBaseLevel (  )  [virtual]

Level of detail of the first texture image. A texture object is a list of texture images. It is a non-negative integer value. Initial value is 0, as in OpenGL spec.

virtual void vtkTextureObject::SetMaxLevel ( int   )  [virtual]

Level of detail of the first texture image. A texture object is a list of texture images. It is a non-negative integer value. Initial value is 1000, as in OpenGL spec.

virtual int vtkTextureObject::GetMaxLevel (  )  [virtual]

Level of detail of the first texture image. A texture object is a list of texture images. It is a non-negative integer value. Initial value is 1000, as in OpenGL spec.

virtual bool vtkTextureObject::GetDepthTextureCompare (  )  [virtual]

Tells if the output of a texture unit with a depth texture uses comparison or not. Comparison happens between D_t the depth texture value in the range [0,1] and with R the interpolated third texture coordinate clamped to range [0,1]. The result of the comparison is noted `r'. If this flag is false, r=D_t. Initial value is false, as in OpenGL spec. Ignored if the texture object is not a depth texture.

virtual void vtkTextureObject::SetDepthTextureCompare ( bool   )  [virtual]

Tells if the output of a texture unit with a depth texture uses comparison or not. Comparison happens between D_t the depth texture value in the range [0,1] and with R the interpolated third texture coordinate clamped to range [0,1]. The result of the comparison is noted `r'. If this flag is false, r=D_t. Initial value is false, as in OpenGL spec. Ignored if the texture object is not a depth texture.

virtual int vtkTextureObject::GetDepthTextureCompareFunction (  )  [virtual]

In case DepthTextureCompare is true, specify the comparison function in use. The result of the comparison is noted `r'. Valid values are:

  • Value - Lequal: r=R<=Dt ? 1.0 : 0.0 - Gequal: r=R>=Dt ? 1.0 : 0.0 - Less: r=R<D_t ? 1.0 : 0.0 - Greater: r=R>Dt ? 1.0 : 0.0 - Equal: r=R==Dt ? 1.0 : 0.0 - NotEqual: r=R!=Dt ? 1.0 : 0.0 - AlwaysTrue: r=1.0 - Never: r=0.0 If the magnification of minification factor are not nearest, percentage closer filtering (PCF) is used: R is compared to several D_t and r is the average of the comparisons (it is NOT the average of D_t compared once to R). Initial value is Lequal, as in OpenGL spec. Ignored if the texture object is not a depth texture.

virtual void vtkTextureObject::SetDepthTextureCompareFunction ( int   )  [virtual]

In case DepthTextureCompare is true, specify the comparison function in use. The result of the comparison is noted `r'. Valid values are:

  • Value - Lequal: r=R<=Dt ? 1.0 : 0.0 - Gequal: r=R>=Dt ? 1.0 : 0.0 - Less: r=R<D_t ? 1.0 : 0.0 - Greater: r=R>Dt ? 1.0 : 0.0 - Equal: r=R==Dt ? 1.0 : 0.0 - NotEqual: r=R!=Dt ? 1.0 : 0.0 - AlwaysTrue: r=1.0 - Never: r=0.0 If the magnification of minification factor are not nearest, percentage closer filtering (PCF) is used: R is compared to several D_t and r is the average of the comparisons (it is NOT the average of D_t compared once to R). Initial value is Lequal, as in OpenGL spec. Ignored if the texture object is not a depth texture.

virtual int vtkTextureObject::GetDepthTextureMode (  )  [virtual]

Defines the mapping from depth component `r' to RGBA components. Ignored if the texture object is not a depth texture. Valid modes are: - Luminance: (R,G,B,A)=(r,r,r,1) - Intensity: (R,G,B,A)=(r,r,r,r) - Alpha: (R.G.B.A)=(0,0,0,r) Initial value is Luminance, as in OpenGL spec.

virtual void vtkTextureObject::SetDepthTextureMode ( int   )  [virtual]

Defines the mapping from depth component `r' to RGBA components. Ignored if the texture object is not a depth texture. Valid modes are: - Luminance: (R,G,B,A)=(r,r,r,1) - Intensity: (R,G,B,A)=(r,r,r,r) - Alpha: (R.G.B.A)=(0,0,0,r) Initial value is Luminance, as in OpenGL spec.

virtual bool vtkTextureObject::GetGenerateMipmap (  )  [virtual]

Tells the hardware to generate mipmap textures from the first texture image at BaseLevel. Initial value is false, as in OpenGL spec.

virtual void vtkTextureObject::SetGenerateMipmap ( bool   )  [virtual]

Tells the hardware to generate mipmap textures from the first texture image at BaseLevel. Initial value is false, as in OpenGL spec.

static bool vtkTextureObject::IsSupported ( vtkRenderWindow renWin  )  [static]

Returns if the context supports the required extensions.

bool vtkTextureObject::LoadRequiredExtensions ( vtkOpenGLExtensionManager  )  [protected]

Load all necessary extensions.

void vtkTextureObject::CreateTexture (  )  [protected]

Creates a texture handle if not already created.

void vtkTextureObject::DestroyTexture (  )  [protected]

Destory the texture.


Member Data Documentation

Definition at line 334 of file vtkTextureObject.h.

unsigned int vtkTextureObject::Width [protected]

Definition at line 335 of file vtkTextureObject.h.

unsigned int vtkTextureObject::Height [protected]

Definition at line 336 of file vtkTextureObject.h.

unsigned int vtkTextureObject::Depth [protected]

Definition at line 337 of file vtkTextureObject.h.

int vtkTextureObject::Target [protected]

Definition at line 339 of file vtkTextureObject.h.

int vtkTextureObject::Format [protected]

Definition at line 340 of file vtkTextureObject.h.

int vtkTextureObject::Type [protected]

Definition at line 341 of file vtkTextureObject.h.

Definition at line 342 of file vtkTextureObject.h.

Definition at line 344 of file vtkTextureObject.h.

unsigned int vtkTextureObject::Handle [protected]

Definition at line 345 of file vtkTextureObject.h.

Definition at line 346 of file vtkTextureObject.h.

int vtkTextureObject::WrapS [protected]

Definition at line 348 of file vtkTextureObject.h.

int vtkTextureObject::WrapT [protected]

Definition at line 349 of file vtkTextureObject.h.

int vtkTextureObject::WrapR [protected]

Definition at line 350 of file vtkTextureObject.h.

Definition at line 351 of file vtkTextureObject.h.

Definition at line 352 of file vtkTextureObject.h.

float vtkTextureObject::BorderColor[4] [protected]

Definition at line 353 of file vtkTextureObject.h.

float vtkTextureObject::Priority [protected]

Definition at line 355 of file vtkTextureObject.h.

float vtkTextureObject::MinLOD [protected]

Definition at line 356 of file vtkTextureObject.h.

float vtkTextureObject::MaxLOD [protected]

Definition at line 357 of file vtkTextureObject.h.

int vtkTextureObject::BaseLevel [protected]

Definition at line 358 of file vtkTextureObject.h.

int vtkTextureObject::MaxLevel [protected]

Definition at line 359 of file vtkTextureObject.h.

Definition at line 362 of file vtkTextureObject.h.

Definition at line 363 of file vtkTextureObject.h.

Definition at line 364 of file vtkTextureObject.h.

Definition at line 366 of file vtkTextureObject.h.

Definition at line 368 of file vtkTextureObject.h.


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

Generated on Wed Jun 3 19:39:45 2009 for VTK by  doxygen 1.5.6