Go to the documentation of this file.
16 #ifndef vtkOpenGLVolumeRGBTable_h
17 #define vtkOpenGLVolumeRGBTable_h
21 #include <vtkTextureObject.h>
62 bool needUpdate =
false;
78 if (scalarRGB->
GetMTime() > this->BuildTime ||
79 this->TextureObject->GetMTime() > this->BuildTime ||
80 needUpdate || !this->TextureObject->GetHandle())
89 delete [] this->
Table;
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.");
192 delete[] this->
Table;
223 this->Tables.reserve(
static_cast<size_t>(numberOfTables));
225 for (
unsigned int i = 0; i < numberOfTables; i++)
228 this->Tables.push_back(table);
235 size_t const size = this->Tables.size();
236 for (
size_t i = 0; i <
size; i++)
238 this->Tables[i]->Delete();
246 if (i >= this->Tables.size())
250 return this->Tables[i];
257 return this->Tables.size();
263 size_t const size = this->Tables.size();
264 for (
size_t i = 0; i <
size; ++i)
266 this->Tables[i]->ReleaseGraphicsResources(window);
271 std::vector<vtkOpenGLVolumeRGBTable*> Tables;
280 #endif // vtkOpenGLVolumeRGBTable_h
void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind the texture.
int NumberOfColorComponents
~vtkOpenGLVolumeRGBTables()
static int NearestPowerOfTwo(int x)
Compute the nearest power of two that is not less than x.
virtual void SetMinificationFilter(int)
static T Max(const T &a, const T &b)
Returns the maximum of the two arugments provided.
virtual void SetWrapS(int)
record modification and/or execution time
abstract base class for most VTK objects
void GetTable(double x1, double x2, int n, double *table)
Fills in a table of n colors mapped from values mapped with even spacing between x1 and x2,...
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.
void ReleaseGraphicsResources(vtkWindow *window)
Defines a transfer function for mapping a property to an RGB color value.
void Activate(unsigned int texUnit)
Set the active tex unit and bind (using our bind).
int GetTextureUnit()
Return the texture unit used for this texture.
window superclass for vtkRenderWindow
~vtkOpenGLVolumeRGBTable()
virtual void SetWrapT(int)
void Modified()
Set this objects time to the current time.
void SetContext(vtkRenderWindow *)
Get/Set the context.
virtual vtkMTimeType GetMTime()
Return this object's modified time.
abstracts an OpenGL texture object.
void Update(vtkColorTransferFunction *scalarRGB, double range[2], int filterValue, vtkOpenGLRenderWindow *renWin)
static vtkTextureObject * New()
void Deactivate(unsigned int texUnit)
virtual void SetMagnificationFilter(int)
vtkTextureObject * TextureObject
static vtkOpenGLVolumeRGBTable * New()
vtkOpenGLVolumeRGBTable()
vtkOpenGLVolumeRGBTables(unsigned int numberOfTables)
int GetMaximumSupportedTextureWidth(vtkOpenGLRenderWindow *renWin, int idealWidth)
int EstimateMinNumberOfSamples(double const &x1, double const &x2)
Estimates the minimum size of a table such that it would correctly sample this function.
vtkStandardNewMacro(vtkOpenGLVolumeRGBTable)
vtkOpenGLVolumeRGBTable * GetTable(unsigned int i)
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].
size_t GetNumberOfTables()
void ReleaseGraphicsResources(vtkWindow *window)