27 #ifndef vtkTextureObject_h
28 #define vtkTextureObject_h
30 #include "vtkRenderingOpenGL2Module.h"
42 #if GL_ES_VERSION_2_0 != 1 || GL_ES_VERSION_3_0 == 1
61 NumberOfDepthTextureCompareFunctions
66 #if GL_ES_VERSION_2_0 != 1
94 NumberOfMinificationModes
125 NumberOfDepthModeFormats
151 vtkGetMacro(Width,
unsigned int);
152 vtkGetMacro(Height,
unsigned int);
153 vtkGetMacro(Depth,
unsigned int);
154 vtkGetMacro(Components,
int);
156 {
return this->Width*this->Height*this->Depth; }
159 vtkGetMacro(NumberOfDimensions,
int);
165 vtkGetMacro(Target,
unsigned int);
172 vtkGetMacro(Handle,
unsigned int);
220 vtkGetMacro(AutoParameters,
int);
228 int numComps,
int dataType,
void *
data);
235 int internalFormat,
int rawType,
251 int numComps,
int dataType,
void *
data[6]);
254 #if GL_ES_VERSION_2_0 != 1
268 bool shaderSupportsTextureInt);
274 int dataType,
void *
data);
286 #if GL_ES_VERSION_2_0 != 1 || GL_ES_VERSION_3_0 == 1
296 bool shaderSupportsTextureInt);
306 bool shaderSupportsTextureInt);
313 unsigned int depth,
int numComps,
314 int dataType,
void *
data);
345 bool Allocate1D(
unsigned int width,
int numComps,
int vtkType);
359 unsigned int depth,
int numComps,
368 int vtktype,
bool shaderSupportsTextureInt);
370 int numComps,
int vtktype,
bool shaderSupportsTextureInt);
394 bool shaderSupportsTextureInt);
397 bool shaderSupportsTextureInt);
407 bool shaderSupportsTextureInt);
410 bool shaderSupportsTextureInt);
437 vtkGetMacro(RequireDepthBufferFloat,
bool);
438 vtkGetMacro(SupportsDepthBufferFloat,
bool);
449 vtkGetMacro(RequireTextureFloat,
bool);
450 vtkGetMacro(SupportsTextureFloat,
bool);
461 vtkGetMacro(RequireTextureInteger,
bool);
462 vtkGetMacro(SupportsTextureInteger,
bool);
476 vtkGetMacro(WrapS,
int);
491 vtkGetMacro(WrapT,
int);
506 vtkGetMacro(WrapR,
int);
524 vtkGetMacro(MinificationFilter,
int);
536 vtkGetMacro(MagnificationFilter,
int);
545 { this->SetMagnificationFilter(val?Linear:Nearest); }
548 {
return this->MagnificationFilter==Linear; }
556 vtkSetVector4Macro(BorderColor,
float);
557 vtkGetVector4Macro(BorderColor,
float);
566 vtkGetMacro(MinLOD,
float);
575 vtkGetMacro(MaxLOD,
float);
585 vtkGetMacro(BaseLevel,
int);
595 vtkGetMacro(MaxLevel,
int);
609 vtkGetMacro(DepthTextureCompare,
bool);
634 vtkGetMacro(DepthTextureCompareFunction,
int);
644 vtkGetMacro(GenerateMipmap,
bool);
666 bool requireTexFloat,
667 bool requireDepthFloat,
686 int srcXmax,
int srcYmax,
687 int dstXmin,
int dstYmin,
688 int dstXmax,
int dstYmax,
689 int dstSizeX,
int dstSizeY,
695 int srcXmax,
int srcYmax,
696 int dstXmin,
int dstYmin,
697 int dstSizeX,
int dstSizeY,
762 int NumberOfDimensions;
775 bool RequireTextureInteger;
776 bool SupportsTextureInteger;
777 bool RequireTextureFloat;
778 bool SupportsTextureFloat;
779 bool RequireDepthBufferFloat;
780 bool SupportsDepthBufferFloat;
785 int MinificationFilter;
786 int MagnificationFilter;
792 float BorderColor[4];
794 bool DepthTextureCompare;
795 int DepthTextureCompareFunction;
a simple class to control print indentation
abstract base class for most VTK objects
The VertexArrayObject class uses, or emulates, vertex array objects.
abstracts an OpenGL pixel buffer object.
The ShaderProgram uses one or more Shader objects.
abstracts an OpenGL texture object.
static bool IsSupported(vtkOpenGLRenderWindow *renWin, bool requireTexFloat, bool requireDepthFloat, bool requireTexInt)
Returns if the context supports the required extensions.
unsigned int InternalFormat
bool AllocateDepth(unsigned int width, unsigned int height, int internalFormat)
Create a 2D depth texture but does not initialize its values.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetContext(vtkOpenGLRenderWindow *)
Get/Set the context.
void Activate()
Activate and Bind the texture.
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].
vtkOpenGLHelper * ShaderProgram
bool IsBound()
Tells if the texture object is bound to the active texture image unit.
void SetInternalFormat(unsigned int glInternalFormat)
int GetDefaultDataType(int vtk_scalar_type)
void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind the texture.
bool Allocate1D(unsigned int width, int numComps, int vtkType)
Create a 1D color texture but does not initialize its values.
unsigned int GetWrapTMode(int vtktype)
bool Create1D(int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
Create a 1D texture using the PBO.
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)
int GetVTKDataType()
Get the data type for the texture as a vtk type int i.e.
void GetShiftAndScale(float &shift, float &scale)
Get the shift and scale required in the shader to return the texture values to their original range.
unsigned int GetFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
Get/Set format (OpenGL internal format) that should be used.
void DestroyTexture()
Destroy the texture.
void SetLinearMagnification(bool val)
Tells if the magnification mode is linear (true) or nearest (false).
unsigned int GetMinificationFilterMode(int vtktype)
int GetTextureUnit()
Return the texture unit used for this texture.
void ResetFormatAndType()
Reset format, internal format, and type of the texture.
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...
static vtkTextureObject * New()
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
void CreateTexture()
Creates a texture handle if not already created.
static int GetMaximumTextureSize(vtkOpenGLRenderWindow *context)
Query and return maximum texture size (dimension) supported by the OpenGL driver for a particular con...
vtkOpenGLBufferObject * BufferObject
unsigned int GetWrapRMode(int vtktype)
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.
unsigned int GetWrapSMode(int vtktype)
void CopyToFrameBuffer(float *tcoords, float *verts, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
bool Create3D(unsigned int width, unsigned int height, unsigned int depth, int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
Create a 3D texture using the PBO.
static bool IsSupported(vtkOpenGLRenderWindow *renWin)
Check for feature support, without any optional features.
void SetDataType(unsigned int glType)
void Deactivate()
Deactivate and UnBind the texture.
vtkWeakPointer< vtkOpenGLRenderWindow > Context
bool CreateDepthFromRaw(unsigned int width, unsigned int height, int internalFormat, int rawType, void *raw)
Create a 2D depth texture using a raw pointer.
void SetFormat(unsigned int glFormat)
unsigned int GetInternalFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
Get/Set internal format (OpenGL internal format) that should be used.
unsigned int GetMagnificationFilterMode(int vtktype)
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].
static bool IsSupported(vtkRenderWindow *renWin, bool requireTexFloat, bool requireDepthFloat, bool requireTexInt)
Returns if the context supports the required extensions.
bool Create2D(unsigned int width, unsigned int height, int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
Create a 2D texture using the PBO.
bool Create3D(unsigned int width, unsigned int height, unsigned int depth, int numComps, int vtktype, bool shaderSupportsTextureInt)
int GetDataType(int vtk_scalar_type)
Get the data type for the texture as GLenum type.
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, int vtktype, bool shaderSupportsTextureInt)
Create texture without uploading any data.
unsigned int GetDefaultFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
bool CreateDepth(unsigned int width, unsigned int height, int internalFormat, vtkPixelBufferObject *pbo)
Create a 2D depth texture using a PBO.
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 GetLinearMagnification()
bool LoadRequiredExtensions(vtkOpenGLRenderWindow *renWin)
Load all necessary extensions.
vtkOpenGLRenderWindow * GetContext()
unsigned int GetDefaultInternalFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
bool CreateAlphaFromRaw(unsigned int width, int internalFormat, int rawType, void *raw)
Create a 1D alpha texture using a raw pointer.
void SendParameters()
Send all the texture object parameters to the hardware if not done yet.
void Bind()
Bind UnBind The texture must have been created using Create().
bool Allocate2D(unsigned int width, unsigned int height, int numComps, int vtkType)
Create a 2D color texture but does not initialize its values.
bool Create1DFromRaw(unsigned int width, int numComps, int dataType, void *data)
Create 1D texture from client memory.
void CopyToFrameBuffer(int srcXmin, int srcYmin, int srcXmax, int srcYmax, int dstXmin, int dstYmin, int dstSizeX, int dstSizeY, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
vtkPixelBufferObject * Download()
This is used to download raw data from the texture into a pixel bufer.
record modification and/or execution time
window superclass for vtkRenderWindow
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.