Go to the documentation of this file.
16 #ifndef vtkOpenGLVolumeGradientOpacityTable_h
17 #define vtkOpenGLVolumeGradientOpacityTable_h
60 double sampleDistance,
62 double vtkNotUsed(unitDistance),
66 bool needUpdate=
false;
95 delete [] this->
Table;
127 vtkErrorMacro(
"vtkTextureObject not initialized!");
136 vtkErrorMacro(
"Failed to query max texture size! using default 1024.");
140 if (maxWidth >= idealWidth)
146 vtkWarningMacro(
"This OpenGL implementation does not support the required "
147 "texture size of " << idealWidth <<
", falling back to maximum allowed, "
148 << maxWidth <<
"." <<
"This may cause an incorrect color table mapping.");
182 this->
Table =
nullptr;
196 delete[] this->
Table;
224 this->Tables.reserve(static_cast<size_t>(numberOfTables));
226 for (
unsigned int i = 0; i < numberOfTables; i++)
230 this->Tables.push_back(table);
237 size_t const size = this->Tables.size();
238 for (
size_t i = 0; i <
size; i++)
240 this->Tables[i]->Delete();
248 if (i >= this->Tables.size())
252 return this->Tables[i];
259 return this->Tables.size();
265 size_t const size = this->Tables.size();
266 for (
size_t i = 0; i <
size; ++i)
268 this->Tables[i]->ReleaseGraphicsResources(window);
275 std::vector<vtkOpenGLVolumeGradientOpacityTable*> Tables;
284 #endif // vtkOpenGLVolumeGradientOpacityTable_h
void Create(unsigned int numberOfTables)
void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind the texture.
vtkOpenGLVolumeGradientOpacityTable * GetTable(unsigned int i)
vtkOpenGLVolumeGradientOpacityTable(int width=1024)
static int NearestPowerOfTwo(int x)
Compute the nearest power of two that is not less than x.
static vtkOpenGLVolumeGradientOpacityTables * New()
virtual void SetMinificationFilter(int)
vtkTextureObject * TextureObject
size_t GetNumberOfTables()
static T Max(const T &a, const T &b)
Returns the maximum of the two arguments provided.
virtual void SetWrapS(int)
record modification and/or execution time
~vtkOpenGLVolumeGradientOpacityTables()
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...
virtual void Delete()
Delete a VTK object.
int EstimateMinNumberOfSamples(double const &x1, double const &x2)
Estimates the minimum size of a table such that it would correctly sample this function.
static vtkOpenGLVolumeGradientOpacityTable * New()
int GetTextureUnit()
Return the texture unit used for this texture.
window superclass for vtkRenderWindow
vtkMTimeType GetMTime() override
Data objects are composite objects and need to check each part for MTime.
vtkOpenGLVolumeGradientOpacityTables()=default
void ReleaseGraphicsResources(vtkWindow *window)
void Modified()
Set this objects time to the current time.
virtual vtkMTimeType GetMTime()
Return this object's modified time.
void GetTable(double x1, double x2, int size, float *table, int stride=1, int logIncrements=0)
Fills in an array of function values evaluated at regular intervals.
double LastSampleDistance
int GetMaximumSupportedTextureWidth(vtkOpenGLRenderWindow *renWin, int idealWidth)
void Deactivate()
Deactivate and UnBind the texture.
abstracts an OpenGL texture object.
static vtkTextureObject * New()
void Update(vtkPiecewiseFunction *gradientOpacity, double sampleDistance, double range[2], double vtkNotUsed(unitDistance), int filterValue, vtkOpenGLRenderWindow *renWin)
virtual void SetMagnificationFilter(int)
Defines a 1D piecewise function.
virtual unsigned int GetHandle()
Returns the OpenGL handle.
void ReleaseGraphicsResources(vtkWindow *window)
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].
~vtkOpenGLVolumeGradientOpacityTable() override
void Activate()
Activate and Bind the texture.