66 int scalarMode,
int arrayAccessMode,
int arrayId,
const char* arrayName,
69 bool needUpdate =
false;
70 bool modified =
false;
80 this->
Texture->SetContext(renWin);
82 if (!this->
Texture->GetHandle())
92 while (!obsolete && i < 6)
94 obsolete = obsolete || this->
LoadedExtent[i] > textureExtent[i];
96 obsolete = obsolete || this->
LoadedExtent[i] < textureExtent[i];
108 input, scalarMode, arrayAccessMode, arrayId, arrayName, this->
LoadedCellFlag);
115 cout <<
"Mask should be VTK_UNSIGNED_CHAR." << endl;
119 cout <<
"Mask should be a one-component scalar field." << endl;
122 GLint internalFormat = GL_R8;
123 GLenum format = GL_RED;
131 textureSize[i] = textureExtent[2 * i + 1] - textureExtent[2 * i] + 1;
136 glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &width);
137 this->
Loaded = textureSize[0] <= width && textureSize[1] <= width && textureSize[2] <= width;
141 this->
Loaded = textureSize[0] * textureSize[1] * textureSize[2] *
146 ostate->vtkglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
148 if (!(textureExtent[1] - textureExtent[0] + cellFlag == dim[0]))
150 ostate->vtkglPixelStorei(GL_UNPACK_ROW_LENGTH, dim[0] - cellFlag);
152 if (!(textureExtent[3] - textureExtent[2] + cellFlag == dim[1]))
154 ostate->vtkglPixelStorei(GL_UNPACK_IMAGE_HEIGHT, dim[1] - cellFlag);
157 ((textureExtent[4] * (dim[1] - cellFlag) + textureExtent[2]) * (dim[0] - cellFlag) +
161 this->
Texture->SetDataType(type);
162 this->
Texture->SetFormat(format);
163 this->
Texture->SetInternalFormat(internalFormat);
164 this->
Texture->Create3DFromRaw(
165 textureSize[0], textureSize[1], textureSize[2], 1, scalarType, dataPtr);
171 this->
Texture->SetBorderColor(0.0f, 0.0f, 0.0f, 0.0f);
174 ostate->vtkglPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
175 ostate->vtkglPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
190 swapBounds[0] = (spacing[0] < 0);
191 swapBounds[1] = (spacing[1] < 0);
192 swapBounds[2] = (spacing[2] < 0);
208 origin[0] +
static_cast<double>(this->
LoadedExtent[0 + swapBounds[0]]) * spacing[0];
210 origin[1] +
static_cast<double>(this->
LoadedExtent[2 + swapBounds[1]]) * spacing[1];
211 this->LoadedBounds[4] =
212 origin[2] +
static_cast<double>(this->
LoadedExtent[4 + swapBounds[2]]) * spacing[2];
213 this->LoadedBounds[1] =
214 origin[0] +
static_cast<double>(this->
LoadedExtent[1 - swapBounds[0]]) * spacing[0];
215 this->LoadedBounds[3] =
216 origin[1] +
static_cast<double>(this->
LoadedExtent[3 - swapBounds[1]]) * spacing[1];
217 this->LoadedBounds[5] =
218 origin[2] +
static_cast<double>(this->
LoadedExtent[5 - swapBounds[2]]) * spacing[2];
222 int wholeTextureExtent[6];
227 wholeTextureExtent[i]--;
234 if (this->
LoadedExtent[2 * i] == wholeTextureExtent[2 * i])
241 origin[i] + (
static_cast<double>(this->
LoadedExtent[2 * i]) + 0.5) * spacing[i];
244 if (this->
LoadedExtent[2 * i + 1] == wholeTextureExtent[2 * i + 1])
246 this->
LoadedBounds[2 * i + 1 - swapBounds[i]] = origin[i] +
247 (
static_cast<double>(this->
LoadedExtent[2 * i + 1]) + 1.0) * spacing[i];
251 this->
LoadedBounds[2 * i + 1 - swapBounds[i]] = origin[i] +
252 (
static_cast<double>(this->
LoadedExtent[2 * i + 1]) + 0.5) * spacing[i];