Go to the documentation of this file.
24 #ifndef vtkTextureObject_h
25 #define vtkTextureObject_h
27 #include "vtkRenderingOpenGL2Module.h"
39 #if GL_ES_VERSION_2_0 != 1 || GL_ES_VERSION_3_0 == 1
58 NumberOfDepthTextureCompareFunctions
63 #if GL_ES_VERSION_2_0 != 1
91 NumberOfMinificationModes
122 NumberOfDepthModeFormats
148 vtkGetMacro(Width,
unsigned int);
149 vtkGetMacro(Height,
unsigned int);
150 vtkGetMacro(Depth,
unsigned int);
151 vtkGetMacro(Components,
int);
153 {
return this->Width*this->Height*this->Depth; }
156 vtkGetMacro(NumberOfDimensions,
int);
162 vtkGetMacro(Target,
unsigned int);
169 vtkGetMacro(Handle,
unsigned int);
217 vtkGetMacro(AutoParameters,
int);
225 int numComps,
int dataType,
void *
data);
232 int internalFormat,
int rawType,
248 int numComps,
int dataType,
void *
data[6]);
251 #if GL_ES_VERSION_2_0 != 1
265 bool shaderSupportsTextureInt);
271 int dataType,
void *
data);
283 #if GL_ES_VERSION_2_0 != 1 || GL_ES_VERSION_3_0 == 1
293 bool shaderSupportsTextureInt);
303 bool shaderSupportsTextureInt);
310 unsigned int depth,
int numComps,
311 int dataType,
void *
data);
342 bool Allocate1D(
unsigned int width,
int numComps,
int vtkType);
356 unsigned int depth,
int numComps,
365 int vtktype,
bool shaderSupportsTextureInt);
367 int numComps,
int vtktype,
bool shaderSupportsTextureInt);
391 bool shaderSupportsTextureInt);
394 bool shaderSupportsTextureInt);
404 bool shaderSupportsTextureInt);
407 bool shaderSupportsTextureInt);
434 vtkGetMacro(RequireDepthBufferFloat,
bool);
435 vtkGetMacro(SupportsDepthBufferFloat,
bool);
446 vtkGetMacro(RequireTextureFloat,
bool);
447 vtkGetMacro(SupportsTextureFloat,
bool);
458 vtkGetMacro(RequireTextureInteger,
bool);
459 vtkGetMacro(SupportsTextureInteger,
bool);
473 vtkGetMacro(WrapS,
int);
488 vtkGetMacro(WrapT,
int);
503 vtkGetMacro(WrapR,
int);
521 vtkGetMacro(MinificationFilter,
int);
533 vtkGetMacro(MagnificationFilter,
int);
542 { this->SetMagnificationFilter(val?Linear:Nearest); }
545 {
return this->MagnificationFilter==Linear; }
553 vtkSetVector4Macro(BorderColor,
float);
554 vtkGetVector4Macro(BorderColor,
float);
563 vtkGetMacro(MinLOD,
float);
572 vtkGetMacro(MaxLOD,
float);
582 vtkGetMacro(BaseLevel,
int);
592 vtkGetMacro(MaxLevel,
int);
606 vtkGetMacro(DepthTextureCompare,
bool);
631 vtkGetMacro(DepthTextureCompareFunction,
int);
641 vtkGetMacro(GenerateMipmap,
bool);
663 bool requireTexFloat,
664 bool requireDepthFloat,
683 int srcXmax,
int srcYmax,
684 int dstXmin,
int dstYmin,
685 int dstXmax,
int dstYmax,
686 int dstSizeX,
int dstSizeY,
692 int srcXmax,
int srcYmax,
693 int dstXmin,
int dstYmin,
694 int dstSizeX,
int dstSizeY,
759 int NumberOfDimensions;
772 bool RequireTextureInteger;
773 bool SupportsTextureInteger;
774 bool RequireTextureFloat;
775 bool SupportsTextureFloat;
776 bool RequireDepthBufferFloat;
777 bool SupportsDepthBufferFloat;
782 int MinificationFilter;
783 int MagnificationFilter;
789 float BorderColor[4];
791 bool DepthTextureCompare;
792 int DepthTextureCompareFunction;
bool Allocate2D(unsigned int width, unsigned int height, int numComps, int vtkType)
Create a 2D color texture but does not initialize its values.
void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind the texture.
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)
unsigned int GetDefaultInternalFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
bool Create3DFromRaw(unsigned int width, unsigned int height, unsigned int depth, int numComps, int dataType, void *data)
Create a 3D texture from client memory numComps must be in [1-4].
bool Create1D(int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
Create a 1D texture using the PBO.
vtkOpenGLBufferObject * BufferObject
bool CreateCubeFromRaw(unsigned int width, unsigned int height, int numComps, int dataType, void *data[6])
Create a cube texture from 6 buffers from client memory.
bool Create3D(unsigned int width, unsigned int height, unsigned int depth, int numComps, int vtktype, bool shaderSupportsTextureInt)
void CopyToFrameBuffer(int srcXmin, int srcYmin, int srcXmax, int srcYmax, int dstXmin, int dstYmin, int dstSizeX, int dstSizeY, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
void CopyToFrameBuffer(float *tcoords, float *verts, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
bool CreateTextureBuffer(unsigned int numValues, int numComps, int dataType, vtkOpenGLBufferObject *bo)
Create a texture buffer basically a 1D texture that can be very large for passing data into the fragm...
record modification and/or execution time
vtkPixelBufferObject * Download()
This is used to download raw data from the texture into a pixel bufer.
bool LoadRequiredExtensions(vtkOpenGLRenderWindow *renWin)
Load all necessary extensions.
void SetFormat(unsigned int glFormat)
void SetContext(vtkOpenGLRenderWindow *)
Get/Set the context.
abstract base class for most VTK objects
static int GetMaximumTextureSize(vtkOpenGLRenderWindow *context)
Query and return maximum texture size (dimension) supported by the OpenGL driver for a particular con...
void SetInternalFormat(unsigned int glInternalFormat)
unsigned int GetFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
Get/Set format (OpenGL internal format) that should be used.
bool AllocateDepth(unsigned int width, unsigned int height, int internalFormat)
Create a 2D depth texture but does not initialize its values.
int GetVTKDataType()
Get the data type for the texture as a vtk type int i.e.
bool GetLinearMagnification()
int GetTextureUnit()
Return the texture unit used for this texture.
void GetShiftAndScale(float &shift, float &scale)
Get the shift and scale required in the shader to return the texture values to their original range.
bool CreateDepth(unsigned int width, unsigned int height, int internalFormat, vtkPixelBufferObject *pbo)
Create a 2D depth texture using a PBO.
window superclass for vtkRenderWindow
vtkWeakPointer< vtkOpenGLRenderWindow > Context
unsigned int GetInternalFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
Get/Set internal format (OpenGL internal format) that should be used.
unsigned int GetMinificationFilterMode(int vtktype)
unsigned int GetMagnificationFilterMode(int vtktype)
unsigned int GetDefaultFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
void CreateTexture()
Creates a texture handle if not already created.
vtkOpenGLHelper * ShaderProgram
unsigned int GetWrapRMode(int vtktype)
static bool IsSupported(vtkOpenGLRenderWindow *renWin, bool requireTexFloat, bool requireDepthFloat, bool requireTexInt)
Returns if the context supports the required extensions.
The ShaderProgram uses one or more Shader objects.
void Deactivate()
Deactivate and UnBind the texture.
bool Create2D(unsigned int width, unsigned int height, int numComps, int vtktype, bool shaderSupportsTextureInt)
Create texture without uploading any data.
a simple class to control print indentation
abstracts an OpenGL texture object.
static vtkTextureObject * New()
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.
bool Create3D(unsigned int width, unsigned int height, unsigned int depth, int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
Create a 3D texture using the PBO.
bool CreateAlphaFromRaw(unsigned int width, int internalFormat, int rawType, void *raw)
Create a 1D alpha texture using a raw pointer.
void ResetFormatAndType()
Reset format, internal format, and type of the texture.
vtkOpenGLRenderWindow * GetContext()
bool Allocate1D(unsigned int width, int numComps, int vtkType)
Create a 1D color texture but does not initialize its values.
void SetDataType(unsigned int glType)
void SendParameters()
Send all the texture object parameters to the hardware if not done yet.
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
bool Allocate3D(unsigned int width, unsigned int height, unsigned int depth, int numComps, int vtkType)
Create a 3D color texture but does not initialize its values.
bool Create2D(unsigned int width, unsigned int height, int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
Create a 2D texture using the PBO.
bool Create1DFromRaw(unsigned int width, int numComps, int dataType, void *data)
Create 1D texture from client memory.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
bool IsBound()
Tells if the texture object is bound to the active texture image unit.
int GetDataType(int vtk_scalar_type)
Get the data type for the texture as GLenum type.
int GetDefaultDataType(int vtk_scalar_type)
void CopyToFrameBuffer(vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
Copy the texture (src) in the current framebuffer.
unsigned int GetWrapSMode(int vtktype)
bool CreateDepthFromRaw(unsigned int width, unsigned int height, int internalFormat, int rawType, void *raw)
Create a 2D depth texture using a raw pointer.
void Bind()
Bind UnBind The texture must have been created using Create().
unsigned int GetWrapTMode(int vtktype)
bool Create2DFromRaw(unsigned int width, unsigned int height, int numComps, int dataType, void *data)
Create a 2D texture from client memory numComps must be in [1-4].
static bool IsSupported(vtkOpenGLRenderWindow *renWin)
Check for feature support, without any optional features.
void SetLinearMagnification(bool val)
Tells if the magnification mode is linear (true) or nearest (false).
void DestroyTexture()
Destroy the texture.
The VertexArrayObject class uses, or emulates, vertex array objects.
abstracts an OpenGL pixel buffer object.
void Activate()
Activate and Bind the texture.
unsigned int InternalFormat
static bool IsSupported(vtkRenderWindow *renWin, bool requireTexFloat, bool requireDepthFloat, bool requireTexInt)
Returns if the context supports the required extensions.