16 #ifndef vtkOpenGLTransferFunction2D_h 17 #define vtkOpenGLTransferFunction2D_h 26 #include <vtkTextureObject.h> 87 if (dims[0] != width || dims[1] !=
height)
122 vtkErrorMacro(
"vtkTextureObject not initialized!");
131 vtkErrorMacro(
"Failed to query max texture size! using default 1024.");
135 if (maxWidth >= idealWidth)
141 vtkWarningMacro(
"This OpenGL implementation does not support the required " 142 "texture size of " << idealWidth <<
", falling back to maximum allowed, " 143 << maxWidth <<
"." <<
"This may cause an incorrect color table mapping.");
221 this->Tables.reserve(static_cast<size_t>(numberOfTables));
223 for (
unsigned int i = 0; i < numberOfTables; i++)
226 this->Tables.push_back(table);
233 size_t const size = this->Tables.size();
234 for (
size_t i = 0; i <
size; i++)
236 this->Tables[i]->Delete();
243 if (i >= this->Tables.size())
247 return this->Tables[i];
253 return this->Tables.size();
259 size_t const size = this->Tables.size();
260 for (
size_t i = 0; i <
size; ++i)
262 this->Tables[i]->ReleaseGraphicsResources(window);
273 std::vector<vtkOpenGLTransferFunction2D*> Tables;
276 #endif // vtkOpenGLTransferFunction2D_h
static vtkOpenGLTransferFunction2D * New()
int GetMaximumSupportedTextureWidth(vtkOpenGLRenderWindow *renWin, int idealWidth)
vtkNew< vtkImageResize > ResizeFilter
virtual void SetOutputDimensions(int, int, int)
The desired output dimensions.
abstract base class for most VTK objects
Container for a set of TransferFunction2D instances.
void SetContext(vtkRenderWindow *)
Get/Set the context.
virtual void * GetVoidPointer(vtkIdType valueIdx)=0
Return a void pointer.
~vtkOpenGLTransferFunctions2D()
~vtkOpenGLTransferFunction2D() override
record modification and/or execution time
void Modified()
Set this objects time to the current time.
vtkStandardNewMacro(vtkOpenGLTransferFunction2D)
void Deactivate(unsigned int texUnit)
Set the active tex unit and bind (using our bind).
void SetInputData(vtkDataObject *)
Assign a data object as input.
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].
vtkImageData * GetOutput()
Get the output data object for a port on this algorithm.
vtkPointData * GetPointData()
Return a pointer to this dataset's point data.
window superclass for vtkRenderWindow
size_t GetNumberOfTables()
vtkOpenGLTransferFunction2D * GetTable(unsigned int i)
static int NearestPowerOfTwo(int x)
Compute the nearest power of two that is not less than x.
vtkDataArray * GetScalars()
Set/Get the scalar data.
virtual int * GetDimensions()
Get dimensions of this structured points dataset.
2D Transfer function container.
topologically and geometrically regular array of data
void ReleaseGraphicsResources(vtkWindow *window)
virtual void SetMinificationFilter(int)
Minification filter mode.
virtual vtkMTimeType GetMTime()
Return this object's modified time.
void ReleaseGraphicsResources(vtkWindow *window)
vtkMTimeType GetMTime() override
Datasets are composite objects and need to check each part for MTime THIS METHOD IS THREAD SAFE...
virtual unsigned int GetHandle()
Returns the OpenGL handle.
void Activate(unsigned int texUnit)
Set the active tex unit and bind (using our bind).
virtual void Update(int port)
Bring this algorithm's outputs up-to-date.
abstracts an OpenGL texture object.
static int GetMaximumTextureSize(vtkOpenGLRenderWindow *context)
Query and return maximum texture size (dimension) supported by the OpenGL driver for a particular con...
void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind the texture.
void SetResizeMethodToOutputDimensions()
The resizing method to use.
static vtkTextureObject * New()
virtual void SetWrapS(int)
Wrap mode for the first texture coordinate "s" Valid values are:
vtkOpenGLTransferFunctions2D(unsigned int numberOfTables)
void Update(vtkImageData *transfer2D, int interpolation, vtkOpenGLRenderWindow *renWin)
int GetTextureUnit()
Return the texture unit used for this texture.
virtual void SetWrapT(int)
Wrap mode for the first texture coordinate "t" Valid values are:
vtkOpenGLTransferFunction2D()
static T Max(const T &a, const T &b)
Returns the maximum of the two arugments provided.
virtual void Delete()
Delete a VTK object.
vtkTextureObject * TextureObject
virtual void SetMagnificationFilter(int)
Magnification filter mode.