15#ifndef vtkTextureObject_h
16#define vtkTextureObject_h
19#include "vtkRenderingOpenGL2Module.h"
23VTK_ABI_NAMESPACE_BEGIN
193 unsigned int width,
unsigned int height,
int numComps,
int dataType,
void* data);
202 unsigned int width,
unsigned int height,
int numComps,
int dataType,
int nbLayers,
void* data);
210 unsigned int width,
unsigned int height,
int internalFormat,
int rawType,
void* raw);
234 unsigned int width,
unsigned int height,
int numComps,
int dataType,
void* data[6]);
260 bool shaderSupportsTextureInt);
268 bool Create3D(
unsigned int width,
unsigned int height,
unsigned int depth,
int numComps,
275 bool Create3DFromRaw(
unsigned int width,
unsigned int height,
unsigned int depth,
int numComps,
276 int dataType,
void* data);
285 unsigned int width,
unsigned int height,
unsigned int depth,
int numComps,
int dataType);
306 bool AllocateDepth(
unsigned int width,
unsigned int height,
int internalFormat);
317 bool Allocate1D(
unsigned int width,
int numComps,
int vtkType);
324 unsigned int width,
unsigned int height,
int numComps,
int vtkType,
int level = 0);
331 unsigned int width,
unsigned int height,
unsigned int depth,
int numComps,
int vtkType);
337 bool Create2D(
unsigned int width,
unsigned int height,
int numComps,
int vtktype,
bool)
339 return this->
Allocate2D(width, height, numComps, vtktype);
342 unsigned int width,
unsigned int height,
unsigned int depth,
int numComps,
int vtktype,
bool)
344 return this->
Allocate3D(width, height, depth, numComps, vtktype);
379 unsigned int GetFormat(
int vtktype,
int numComps,
bool shaderSupportsTextureInt);
654 bool requireDepthFloat,
bool requireTexInt);
661 return vtkTextureObject::IsSupported(renWin,
false,
false,
false);
673 int dstYmin,
int dstXmax,
int dstYmax,
int dstSizeX,
int dstSizeY,
vtkShaderProgram* program,
696 int srcXmin,
int srcYmin,
int dstXmin,
int dstYmin,
int width,
int height);
714 void Resize(
unsigned int width,
unsigned int height);
a simple class to control print indentation
The VertexArrayObject class uses, or emulates, vertex array objects.
abstracts an OpenGL pixel buffer object.
The ShaderProgram uses one or more Shader objects.
In case DepthTextureCompare is true, specify the comparison function in use.
bool AllocateDepth(unsigned int width, unsigned int height, int internalFormat)
Create a 2D depth texture but does not initialize its values.
void SetContext(vtkOpenGLRenderWindow *)
Get/Set the context.
bool AllocateProxyTexture3D(unsigned int width, unsigned int height, unsigned int depth, int numComps, int dataType)
Create a 3D texture using the GL_PROXY_TEXTURE_3D target.
bool EmulateTextureBufferWith2DTextures(unsigned int numValues, int numComps, int dataType, vtkOpenGLBufferObject *bo)
Emulates a texture buffer with 2D texture.
bool AllocateDepthStencil(unsigned int width, unsigned int height)
Create a 2D septh stencil texture but does not initialize its values.
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.
bool Create2DArrayFromRaw(unsigned int width, unsigned int height, int numComps, int dataType, int nbLayers, void *data)
Create a 2D texture array from client memory data contains a pointer to the layers of the texture arr...
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.
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.
int GetVTKDataType()
Get the data type for the texture as a vtk type int i.e.
virtual void SetMagnificationFilter(int)
Magnification filter mode.
unsigned int GetFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
Get/Set format (OpenGL internal format) that should be used.
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...
unsigned int GetWrapRMode(int vtktype)
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.
unsigned int GetWrapSMode(int vtktype)
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.
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.
unsigned int GetInternalFormat(int vtktype, int numComps, bool shaderSupportsTextureInt)
Get/Set internal format (OpenGL internal format) that should be used.
unsigned int GetTuples()
Get the texture dimensions.
@ NumberOfDepthTextureCompareFunctions
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.
@ NumberOfMinificationModes
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.
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()
bool GetLinearMagnification()
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.
vtkPixelBufferObject * Download()
This is used to download raw data from the texture into a pixel buffer.
vtkPixelBufferObject * Download(unsigned int target, unsigned int level)
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 *)
static int GetMaximumTextureSize(vtkOpenGLRenderWindow *context)
Query and return maximum texture size (dimension) supported by the OpenGL driver for a particular con...
vtkTimeStamp SendParametersTime
bool LoadRequiredExtensions(vtkOpenGLRenderWindow *renWin)
Load all necessary extensions.
vtkWeakPointer< vtkOpenGLRenderWindow > Context
~vtkTextureObject() override
static bool IsSupported(vtkOpenGLRenderWindow *renWin, bool requireTexFloat, bool requireDepthFloat, bool requireTexInt)
Returns if the context supports the required extensions.
void CreateTexture()
Creates a texture handle if not already created.
int DepthTextureCompareFunction
void DestroyTexture()
Destroy the texture.
bool RequireDepthBufferFloat
void Resize(unsigned int width, unsigned int height)
int GetMaximumTextureSize3D()
Overload which uses the internal context to query the maximum 3D texture size.
vtkOpenGLBufferObject * BufferObject
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.
vtkOpenGLHelper * ShaderProgram
bool SupportsDepthBufferFloat
bool RequireTextureInteger
bool SupportsTextureInteger
void GetShiftAndScale(float &shift, float &scale)
Get the shift and scale required in the shader to return the texture values to their original range.
float MaximumAnisotropicFiltering
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
bool SupportsTextureFloat
unsigned int InternalFormat
void AssignToExistingTexture(unsigned int handle, unsigned int target)
Assign the TextureObject to a externally provided Handle and Target.
void CopyToFrameBuffer(vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
Copy the texture (src) in the current framebuffer.