------------------------------------------------------------------------------
| 127 | |
| 128 | //------------------------------------------------------------------------------ |
| 129 | void vtkOpenGLVolumeLookupTable::Update(vtkObject* func, double scalarRange[2], int blendMode, |
| 130 | double sampleDistance, double unitDistance, int filterValue, vtkOpenGLRenderWindow* renWin) |
| 131 | { |
| 132 | if (!func || !renWin) |
| 133 | { |
| 134 | return; |
| 135 | } |
| 136 | |
| 137 | if (!this->TextureObject) |
| 138 | { |
| 139 | this->TextureObject = vtkTextureObject::New(); |
| 140 | } |
| 141 | |
| 142 | this->TextureObject->SetContext(renWin); |
| 143 | |
| 144 | if (this->NeedsUpdate(func, scalarRange, blendMode, sampleDistance)) |
| 145 | { |
| 146 | int idealW = 1024; |
| 147 | int newHeight = 1; |
| 148 | this->ComputeIdealTextureSize(func, idealW, newHeight, renWin); |
| 149 | int const newWidth = this->GetMaximumSupportedTextureWidth(renWin, idealW); |
| 150 | if (!this->Table || this->TextureWidth != newWidth || this->TextureHeight != newHeight) |
| 151 | { |
| 152 | this->TextureWidth = newWidth; |
| 153 | this->TextureHeight = newHeight; |
| 154 | this->AllocateTable(); |
| 155 | } |
| 156 | |
| 157 | this->InternalUpdate(func, blendMode, sampleDistance, unitDistance, filterValue); |
| 158 | this->LastInterpolation = filterValue; |
| 159 | this->BuildTime.Modified(); |
| 160 | } |
| 161 | |
| 162 | if (this->LastInterpolation != filterValue) |
| 163 | { |
| 164 | this->LastInterpolation = filterValue; |
| 165 | this->TextureObject->SetMagnificationFilter(filterValue); |
| 166 | this->TextureObject->SetMinificationFilter(filterValue); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | //------------------------------------------------------------------------------ |
| 171 | void vtkOpenGLVolumeLookupTable::AllocateTable() |