27#ifndef vtkTextureObject_h
28#define vtkTextureObject_h
31#include "vtkRenderingOpenGL2Module.h"
57 NumberOfDepthTextureCompareFunctions
62#ifndef GL_ES_VERSION_3_0
63 enum { ClampToEdge = 0, Repeat, MirroredRepeat,
ClampToBorder, NumberOfWrapModes };
83 NumberOfMinificationModes
122 vtkGetMacro(Width,
unsigned int);
123 vtkGetMacro(Height,
unsigned int);
124 vtkGetMacro(Depth,
unsigned int);
125 vtkGetMacro(Samples,
unsigned int);
126 vtkGetMacro(Components,
int);
127 unsigned int GetTuples() {
return this->Width * this->Height * this->Depth; }
130 vtkGetMacro(NumberOfDimensions,
int);
133 vtkSetMacro(Samples,
unsigned int);
139 vtkGetMacro(Target,
unsigned int);
146 vtkGetMacro(Handle,
unsigned int);
197 vtkSetMacro(AutoParameters,
int);
198 vtkGetMacro(AutoParameters,
int);
199 vtkBooleanMacro(AutoParameters,
int);
207 unsigned int width,
unsigned int height,
int numComps,
int dataType,
void* data);
215 unsigned int width,
unsigned int height,
int internalFormat,
int rawType,
void* raw);
230 unsigned int width,
unsigned int height,
int numComps,
int dataType,
void* data[6]);
256 bool shaderSupportsTextureInt);
264 bool Create3D(
unsigned int width,
unsigned int height,
unsigned int depth,
int numComps,
271 bool Create3DFromRaw(
unsigned int width,
unsigned int height,
unsigned int depth,
int numComps,
272 int dataType,
void* data);
281 unsigned int const depth,
int const numComps,
int const dataType);
302 bool AllocateDepth(
unsigned int width,
unsigned int height,
int internalFormat);
313 bool Allocate1D(
unsigned int width,
int numComps,
int vtkType);
320 unsigned int width,
unsigned int height,
int numComps,
int vtkType,
int level = 0);
327 unsigned int width,
unsigned int height,
unsigned int depth,
int numComps,
int vtkType);
333 bool Create2D(
unsigned int width,
unsigned int height,
int numComps,
int vtktype,
bool)
335 return this->Allocate2D(width, height, numComps, vtktype);
338 unsigned int width,
unsigned int height,
unsigned int depth,
int numComps,
int vtktype,
bool)
340 return this->Allocate3D(width, height, depth, numComps, vtktype);
375 unsigned int GetFormat(
int vtktype,
int numComps,
bool shaderSupportsTextureInt);
403 vtkSetMacro(RequireDepthBufferFloat,
bool);
404 vtkGetMacro(RequireDepthBufferFloat,
bool);
405 vtkGetMacro(SupportsDepthBufferFloat,
bool);
415 vtkSetMacro(RequireTextureFloat,
bool);
416 vtkGetMacro(RequireTextureFloat,
bool);
417 vtkGetMacro(SupportsTextureFloat,
bool);
427 vtkSetMacro(RequireTextureInteger,
bool);
428 vtkGetMacro(RequireTextureInteger,
bool);
429 vtkGetMacro(SupportsTextureInteger,
bool);
443 vtkGetMacro(WrapS,
int);
444 vtkSetMacro(WrapS,
int);
458 vtkGetMacro(WrapT,
int);
459 vtkSetMacro(WrapT,
int);
473 vtkGetMacro(WrapR,
int);
474 vtkSetMacro(WrapR,
int);
491 vtkGetMacro(MinificationFilter,
int);
492 vtkSetMacro(MinificationFilter,
int);
503 vtkGetMacro(MagnificationFilter,
int);
504 vtkSetMacro(MagnificationFilter,
int);
521 vtkSetVector4Macro(BorderColor,
float);
522 vtkGetVector4Macro(BorderColor,
float);
530 vtkSetMacro(MinLOD,
float);
531 vtkGetMacro(MinLOD,
float);
539 vtkSetMacro(MaxLOD,
float);
540 vtkGetMacro(MaxLOD,
float);
549 vtkSetMacro(BaseLevel,
int);
550 vtkGetMacro(BaseLevel,
int);
559 vtkSetMacro(MaxLevel,
int);
560 vtkGetMacro(MaxLevel,
int);
574 vtkGetMacro(DepthTextureCompare,
bool);
575 vtkSetMacro(DepthTextureCompare,
bool);
599 vtkGetMacro(DepthTextureCompareFunction,
int);
600 vtkSetMacro(DepthTextureCompareFunction,
int);
609 vtkGetMacro(GenerateMipmap,
bool);
610 vtkSetMacro(GenerateMipmap,
bool);
619 vtkSetMacro(MaximumAnisotropicFiltering,
float);
620 vtkGetMacro(MaximumAnisotropicFiltering,
float);
669 int dstYmin,
int dstXmax,
int dstYmax,
int dstSizeX,
int dstSizeY,
vtkShaderProgram* program,
692 int srcXmin,
int srcYmin,
int dstXmin,
int dstYmin,
int width,
int height);
710 void Resize(
unsigned int width,
unsigned int height);
719 vtkGetMacro(UseSRGBColorSpace,
bool);
720 vtkSetMacro(UseSRGBColorSpace,
bool);
721 vtkBooleanMacro(UseSRGBColorSpace,
bool);
785 float BorderColor[4];
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.
unsigned int InternalFormat
bool AllocateDepth(unsigned int width, unsigned int height, int internalFormat)
Create a 2D depth texture but does not initialize its values.
static bool IsSupported(vtkOpenGLRenderWindow *, bool, bool, bool)
Returns if the context supports the required extensions.
void SetContext(vtkOpenGLRenderWindow *)
Get/Set the context.
bool AllocateDepthStencil(unsigned int width, unsigned int height)
Create a 2D septh stencil texture but does not initialize its values.
float MaximumAnisotropicFiltering
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].
vtkOpenGLRenderWindow * GetContext()
Get/Set the context.
vtkOpenGLHelper * ShaderProgram
bool IsBound()
Tells if the texture object is bound to the active texture image unit.
void SetInternalFormat(unsigned int glInternalFormat)
Get/Set internal format (OpenGL internal format) that should be used.
int GetDefaultDataType(int vtk_scalar_type)
Get the data type for the texture as GLenum type.
void Resize(unsigned int width, unsigned int height)
bool Allocate1D(unsigned int width, int numComps, int vtkType)
Create a 1D color texture but does not initialize its values.
virtual void Activate()
Activate and Bind the texture.
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)
Copy the texture (src) in the current framebuffer.
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).
bool AllocateProxyTexture3D(unsigned int const width, unsigned int const height, unsigned int const depth, int const numComps, int const dataType)
Create a 3D texture using the GL_PROXY_TEXTURE_3D target.
bool SupportsTextureInteger
vtkTimeStamp SendParametersTime
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...
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
void AssignToExistingTexture(unsigned int handle, unsigned int target)
Assign the TextureObject to a externally provided Handle and Target.
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 SupportsDepthBufferFloat
bool Create3D(unsigned int width, unsigned int height, unsigned int depth, int numComps, int vtktype, bool)
Create texture without uploading any data.
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 RequireTextureInteger
unsigned int GetWrapSMode(int vtktype)
void CopyToFrameBuffer(float *tcoords, float *verts, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
Copy the texture (src) in the current framebuffer.
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 Create2D(unsigned int width, unsigned int height, int numComps, int vtktype, bool)
Create texture without uploading any data.
virtual void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind the texture.
void SetDataType(unsigned int glType)
Get the data type for the texture as GLenum type.
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)
Get/Set format (OpenGL internal format) that should be used.
~vtkTextureObject() override
unsigned int GetInternalFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
Get/Set internal format (OpenGL internal format) that should be used.
static bool IsSupported(vtkOpenGLRenderWindow *)
Check for feature support, without any optional features.
unsigned int GetTuples()
Get the texture dimensions.
bool SupportsTextureFloat
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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].
bool Create2D(unsigned int width, unsigned int height, int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
Create a 2D texture using the PBO.
int DepthTextureCompareFunction
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.
unsigned int GetDefaultFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
Get/Set format (OpenGL internal format) that should be used.
static int GetMaximumTextureSize3D(vtkOpenGLRenderWindow *context)
Query and return maximum texture size (dimension) supported by the OpenGL driver for a particular con...
bool CreateDepth(unsigned int width, unsigned int height, int internalFormat, vtkPixelBufferObject *pbo)
Create a 2D depth texture using a PBO.
bool Allocate2D(unsigned int width, unsigned int height, int numComps, int vtkType, int level=0)
Create a 2D color texture but does not initialize its values.
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 GetLinearMagnification()
int GetMaximumTextureSize3D()
Overload which uses the internal context to query the maximum 3D texture size.
unsigned int GetDefaultInternalFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
Get/Set internal format (OpenGL internal format) that should be used.
void SendParameters()
Send all the texture object parameters to the hardware if not done yet.
void Bind()
Bind the texture, must have been created using Create().
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)
Copy the texture (src) in the current framebuffer.
vtkPixelBufferObject * Download()
This is used to download raw data from the texture into a pixel buffer.
vtkPixelBufferObject * Download(unsigned int target, unsigned int level)
bool RequireDepthBufferFloat
record modification and/or execution time
a weak reference to a vtkObject.
window superclass for vtkRenderWindow
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)