VTK  9.5.2
vtkTextureObject.h File Reference
#include "vtkObject.h"
#include "vtkRenderingOpenGL2Module.h"
#include "vtkWeakPointer.h"
#include "vtkWrappingHints.h"
Include dependency graph for vtkTextureObject.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  vtkTextureObject
 In case DepthTextureCompare is true, specify the comparison function in use. More...

Functions

static bool IsSupported (vtkOpenGLRenderWindow *renWin, bool requireTexFloat, bool requireDepthFloat, bool requireTexInt)
 Returns if the context supports the required extensions.
static bool IsSupported (vtkOpenGLRenderWindow *renWin)
 Check for feature support, without any optional features.
void CopyFromFrameBuffer (int srcXmin, int srcYmin, int dstXmin, int dstYmin, int width, int height)
 Copy a sub-part of a logical buffer of the framebuffer (color or depth) to the texture object.
void GetShiftAndScale (float &shift, float &scale)
 Get the shift and scale required in the shader to return the texture values to their original range.
void Resize (unsigned int width, unsigned int height)
void AssignToExistingTexture (unsigned int handle, unsigned int target)
 Assign the TextureObject to a externally provided Handle and Target.
 vtkTextureObject ()
 ~vtkTextureObject () override
bool LoadRequiredExtensions (vtkOpenGLRenderWindow *renWin)
 Load all necessary extensions.
void CreateTexture ()
 Creates a texture handle if not already created.
void DestroyTexture ()
 Destroy the texture.
 GetGenerateMipmap ()
 / /** Tells the hardware to generate mipmap textures from the first texture image at BaseLevel.
virtual void SetGenerateMipmap (bool)
 / /** Tells the hardware to generate mipmap textures from the first texture image at BaseLevel.
virtual void SetMaximumAnisotropicFiltering (float)
 Set/Get the maximum anisotropic filtering to use.
virtual float GetMaximumAnisotropicFiltering ()
 Set/Get the maximum anisotropic filtering to use.
static int GetMaximumTextureSize (vtkOpenGLRenderWindow *context)
 Query and return maximum texture size (dimension) supported by the OpenGL driver for a particular context.
static int GetMaximumTextureSize3D (vtkOpenGLRenderWindow *context)
 Query and return maximum texture size (dimension) supported by the OpenGL driver for a particular context.
int GetMaximumTextureSize3D ()
 Overload which uses the internal context to query the maximum 3D texture size.
void CopyToFrameBuffer (vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
 Copy the texture (src) in the current framebuffer.
void CopyToFrameBuffer (int srcXmin, int srcYmin, int srcXmax, int srcYmax, int dstXmin, int dstYmin, int dstXmax, int dstYmax, int dstSizeX, int dstSizeY, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
 Copy the texture (src) in the current framebuffer.
void CopyToFrameBuffer (int srcXmin, int srcYmin, int srcXmax, int srcYmax, int dstXmin, int dstYmin, int dstSizeX, int dstSizeY, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
 Copy the texture (src) in the current framebuffer.
void CopyToFrameBuffer (float *tcoords, float *verts, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
 Copy the texture (src) in the current framebuffer.
virtual bool GetUseSRGBColorSpace ()
 Is this texture using the sRGB color space.
virtual void SetUseSRGBColorSpace (bool)
 Is this texture using the sRGB color space.
virtual void UseSRGBColorSpaceOn ()
 Is this texture using the sRGB color space.
virtual void UseSRGBColorSpaceOff ()
 Is this texture using the sRGB color space.

Variables

vtkGenericOpenGLResourceFreeCallbackResourceCallback
int NumberOfDimensions
unsigned int Width
unsigned int Height
unsigned int Depth
unsigned int Samples
bool UseSRGBColorSpace
float MaximumAnisotropicFiltering
unsigned int Target
unsigned int Format
unsigned int InternalFormat
unsigned int Type
int Components
vtkWeakPointer< vtkOpenGLRenderWindowContext
unsigned int Handle
bool OwnHandle
bool RequireTextureInteger
bool SupportsTextureInteger
bool RequireTextureFloat
bool SupportsTextureFloat
bool RequireDepthBufferFloat
bool SupportsDepthBufferFloat
int WrapS
int WrapT
int WrapR
int MinificationFilter
int MagnificationFilter
float MinLOD
float MaxLOD
int BaseLevel
int MaxLevel
float BorderColor [4]
bool DepthTextureCompare
int DepthTextureCompareFunction
bool GenerateMipmap
int AutoParameters
vtkTimeStamp SendParametersTime
vtkOpenGLHelperShaderProgram
vtkOpenGLBufferObjectBufferObject

Function Documentation

◆ GetGenerateMipmap()

GetGenerateMipmap ( )

/ /** Tells the hardware to generate mipmap textures from the first texture image at BaseLevel.

Initial value is false, as in OpenGL spec.

◆ SetGenerateMipmap()

virtual void 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.

◆ SetMaximumAnisotropicFiltering()

virtual void SetMaximumAnisotropicFiltering ( float )
virtual

Set/Get the maximum anisotropic filtering to use.

1.0 means use no anisotropic filtering. The default value is 1.0 and a high value would be 16. This might not be supported on all machines.

◆ GetMaximumAnisotropicFiltering()

virtual float GetMaximumAnisotropicFiltering ( )
virtual

Set/Get the maximum anisotropic filtering to use.

1.0 means use no anisotropic filtering. The default value is 1.0 and a high value would be 16. This might not be supported on all machines.

◆ GetMaximumTextureSize()

int GetMaximumTextureSize ( vtkOpenGLRenderWindow * context)
static

Query and return maximum texture size (dimension) supported by the OpenGL driver for a particular context.

It should be noted that this size does not consider the internal format of the texture and therefore there is no guarantee that a texture of this size will be allocated by the driver. Also, the method does not make the context current so if the passed context is not valid or current, a value of -1 will be returned.

◆ GetMaximumTextureSize3D() [1/2]

int GetMaximumTextureSize3D ( vtkOpenGLRenderWindow * context)
static

Query and return maximum texture size (dimension) supported by the OpenGL driver for a particular context.

It should be noted that this size does not consider the internal format of the texture and therefore there is no guarantee that a texture of this size will be allocated by the driver. Also, the method does not make the context current so if the passed context is not valid or current, a value of -1 will be returned.

◆ GetMaximumTextureSize3D() [2/2]

int GetMaximumTextureSize3D ( )

Overload which uses the internal context to query the maximum 3D texture size.

Will make the internal context current, returns -1 if anything fails.

◆ IsSupported() [1/2]

bool IsSupported ( vtkOpenGLRenderWindow * renWin,
bool requireTexFloat,
bool requireDepthFloat,
bool requireTexInt )
static

Returns if the context supports the required extensions.

If flags for optional extensions are set then the test fails when support for them is not found.

◆ IsSupported() [2/2]

bool IsSupported ( vtkOpenGLRenderWindow * renWin)
static

Check for feature support, without any optional features.

Definition at line 659 of file vtkTextureObject.h.

◆ CopyToFrameBuffer() [1/4]

void CopyToFrameBuffer ( vtkShaderProgram * program,
vtkOpenGLVertexArrayObject * vao )

Copy the texture (src) in the current framebuffer.

A variety of signatures based on what you want to do Copy the entire texture to the entire current viewport

◆ CopyToFrameBuffer() [2/4]

void CopyToFrameBuffer ( int srcXmin,
int srcYmin,
int srcXmax,
int srcYmax,
int dstXmin,
int dstYmin,
int dstXmax,
int dstYmax,
int dstSizeX,
int dstSizeY,
vtkShaderProgram * program,
vtkOpenGLVertexArrayObject * vao )

Copy the texture (src) in the current framebuffer.

A variety of signatures based on what you want to do Copy the entire texture to the entire current viewport

◆ CopyToFrameBuffer() [3/4]

void CopyToFrameBuffer ( int srcXmin,
int srcYmin,
int srcXmax,
int srcYmax,
int dstXmin,
int dstYmin,
int dstSizeX,
int dstSizeY,
vtkShaderProgram * program,
vtkOpenGLVertexArrayObject * vao )

Copy the texture (src) in the current framebuffer.

A variety of signatures based on what you want to do Copy the entire texture to the entire current viewport

◆ CopyToFrameBuffer() [4/4]

void CopyToFrameBuffer ( float * tcoords,
float * verts,
vtkShaderProgram * program,
vtkOpenGLVertexArrayObject * vao )

Copy the texture (src) in the current framebuffer.

A variety of signatures based on what you want to do Copy the entire texture to the entire current viewport

◆ CopyFromFrameBuffer()

void CopyFromFrameBuffer ( int srcXmin,
int srcYmin,
int dstXmin,
int dstYmin,
int width,
int height )

Copy a sub-part of a logical buffer of the framebuffer (color or depth) to the texture object.

src is the framebuffer, dst is the texture. (srcXmin,srcYmin) is the location of the lower left corner of the rectangle in the framebuffer. (dstXmin,dstYmin) is the location of the lower left corner of the rectangle in the texture. width and height specifies the size of the rectangle in pixels. If the logical buffer is a color buffer, it has to be selected first with glReadBuffer().

Precondition
is2D: GetNumberOfDimensions()==2

◆ GetShiftAndScale()

void GetShiftAndScale ( float & shift,
float & scale )

Get the shift and scale required in the shader to return the texture values to their original range.

This is useful when for example you have unsigned char data and it is being accessed using the floating point texture calls. In that case OpenGL maps the uchar range to a different floating point range under the hood. Applying the shift and scale will return the data to its original values in the shader. The texture's internal format must be set before calling these routines. Creating the texture does set it.

◆ Resize()

void Resize ( unsigned int width,
unsigned int height )

◆ GetUseSRGBColorSpace()

virtual bool GetUseSRGBColorSpace ( )
virtual

Is this texture using the sRGB color space.

If you are using a sRGB framebuffer or window then you probably also want to be using sRGB color textures for proper handling of gamma and associated color mixing.

◆ SetUseSRGBColorSpace()

virtual void SetUseSRGBColorSpace ( bool )
virtual

Is this texture using the sRGB color space.

If you are using a sRGB framebuffer or window then you probably also want to be using sRGB color textures for proper handling of gamma and associated color mixing.

◆ UseSRGBColorSpaceOn()

virtual void UseSRGBColorSpaceOn ( )
virtual

Is this texture using the sRGB color space.

If you are using a sRGB framebuffer or window then you probably also want to be using sRGB color textures for proper handling of gamma and associated color mixing.

◆ UseSRGBColorSpaceOff()

virtual void UseSRGBColorSpaceOff ( )
virtual

Is this texture using the sRGB color space.

If you are using a sRGB framebuffer or window then you probably also want to be using sRGB color textures for proper handling of gamma and associated color mixing.

◆ AssignToExistingTexture()

void AssignToExistingTexture ( unsigned int handle,
unsigned int target )

Assign the TextureObject to a externally provided Handle and Target.

This class will not delete the texture referenced by the handle upon releasing. That is up to whoever created it originally. Note that activating and binding will work. Properties such as wrap/interpolate will also work. But width/height/format etc are left unset.

◆ vtkTextureObject()

vtkTextureObject ( )
protected

◆ ~vtkTextureObject()

~vtkTextureObject ( )
overrideprotected

◆ LoadRequiredExtensions()

bool LoadRequiredExtensions ( vtkOpenGLRenderWindow * renWin)
protected

Load all necessary extensions.

◆ CreateTexture()

void CreateTexture ( )
protected

Creates a texture handle if not already created.

◆ DestroyTexture()

void DestroyTexture ( )
protected

Destroy the texture.

Variable Documentation

◆ ResourceCallback

vtkGenericOpenGLResourceFreeCallback* ResourceCallback
protected

Definition at line 742 of file vtkTextureObject.h.

◆ NumberOfDimensions

int NumberOfDimensions
protected

Definition at line 759 of file vtkTextureObject.h.

◆ Width

unsigned int Width
protected

Definition at line 760 of file vtkTextureObject.h.

◆ Height

unsigned int Height
protected

Definition at line 761 of file vtkTextureObject.h.

◆ Depth

unsigned int Depth
protected

Definition at line 762 of file vtkTextureObject.h.

◆ Samples

unsigned int Samples
protected

Definition at line 763 of file vtkTextureObject.h.

◆ UseSRGBColorSpace

bool UseSRGBColorSpace
protected

Definition at line 764 of file vtkTextureObject.h.

◆ MaximumAnisotropicFiltering

float MaximumAnisotropicFiltering
protected

Definition at line 766 of file vtkTextureObject.h.

◆ Target

unsigned int Target
protected

Definition at line 768 of file vtkTextureObject.h.

◆ Format

unsigned int Format
protected

Definition at line 769 of file vtkTextureObject.h.

◆ InternalFormat

unsigned int InternalFormat
protected

Definition at line 770 of file vtkTextureObject.h.

◆ Type

◆ Components

int Components
protected

Definition at line 772 of file vtkTextureObject.h.

◆ Context

Definition at line 774 of file vtkTextureObject.h.

◆ Handle

unsigned int Handle
protected

Definition at line 775 of file vtkTextureObject.h.

◆ OwnHandle

bool OwnHandle
protected

Definition at line 776 of file vtkTextureObject.h.

◆ RequireTextureInteger

bool RequireTextureInteger
protected

Definition at line 777 of file vtkTextureObject.h.

◆ SupportsTextureInteger

bool SupportsTextureInteger
protected

Definition at line 778 of file vtkTextureObject.h.

◆ RequireTextureFloat

bool RequireTextureFloat
protected

Definition at line 779 of file vtkTextureObject.h.

◆ SupportsTextureFloat

bool SupportsTextureFloat
protected

Definition at line 780 of file vtkTextureObject.h.

◆ RequireDepthBufferFloat

bool RequireDepthBufferFloat
protected

Definition at line 781 of file vtkTextureObject.h.

◆ SupportsDepthBufferFloat

bool SupportsDepthBufferFloat
protected

Definition at line 782 of file vtkTextureObject.h.

◆ WrapS

int WrapS
protected

Definition at line 784 of file vtkTextureObject.h.

◆ WrapT

int WrapT
protected

Definition at line 785 of file vtkTextureObject.h.

◆ WrapR

int WrapR
protected

Definition at line 786 of file vtkTextureObject.h.

◆ MinificationFilter

int MinificationFilter
protected

Definition at line 787 of file vtkTextureObject.h.

◆ MagnificationFilter

int MagnificationFilter
protected

Definition at line 788 of file vtkTextureObject.h.

◆ MinLOD

float MinLOD
protected

Definition at line 790 of file vtkTextureObject.h.

◆ MaxLOD

float MaxLOD
protected

Definition at line 791 of file vtkTextureObject.h.

◆ BaseLevel

int BaseLevel
protected

Definition at line 792 of file vtkTextureObject.h.

◆ MaxLevel

int MaxLevel
protected

Definition at line 793 of file vtkTextureObject.h.

◆ BorderColor

float BorderColor[4]
protected

Definition at line 794 of file vtkTextureObject.h.

◆ DepthTextureCompare

bool DepthTextureCompare
protected

Definition at line 796 of file vtkTextureObject.h.

◆ DepthTextureCompareFunction

int DepthTextureCompareFunction
protected

Definition at line 797 of file vtkTextureObject.h.

◆ GenerateMipmap

bool GenerateMipmap
protected

Definition at line 799 of file vtkTextureObject.h.

◆ AutoParameters

int AutoParameters
protected

Definition at line 801 of file vtkTextureObject.h.

◆ SendParametersTime

vtkTimeStamp SendParametersTime
protected

Definition at line 802 of file vtkTextureObject.h.

◆ ShaderProgram

vtkOpenGLHelper* ShaderProgram
protected

Definition at line 805 of file vtkTextureObject.h.

◆ BufferObject

vtkOpenGLBufferObject* BufferObject
protected

Definition at line 808 of file vtkTextureObject.h.