55 int scalarMode,
int arrayAccessMode,
int arrayId,
const char* arrayName,
58 bool needUpdate =
false;
59 bool modified =
false;
69 this->
Texture->SetContext(renWin);
71 if (!this->
Texture->GetHandle())
81 while (!obsolete && i < 6)
83 obsolete = obsolete || this->
LoadedExtent[i] > textureExtent[i];
85 obsolete = obsolete || this->
LoadedExtent[i] < textureExtent[i];
97 input, scalarMode, arrayAccessMode, arrayId, arrayName, this->
LoadedCellFlag);
104 cout <<
"Mask should be VTK_UNSIGNED_CHAR." << endl;
108 cout <<
"Mask should be a one-component scalar field." << endl;
111 GLint internalFormat = GL_R8;
112 GLenum format = GL_RED;
120 textureSize[i] = textureExtent[2 * i + 1] - textureExtent[2 * i] + 1;
125 glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &width);
126 this->
Loaded = textureSize[0] <= width && textureSize[1] <= width && textureSize[2] <= width;
130 this->
Loaded = textureSize[0] * textureSize[1] * textureSize[2] *
135 ostate->vtkglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
137 if (!(textureExtent[1] - textureExtent[0] + cellFlag == dim[0]))
139 ostate->vtkglPixelStorei(GL_UNPACK_ROW_LENGTH, dim[0] - cellFlag);
141 if (!(textureExtent[3] - textureExtent[2] + cellFlag == dim[1]))
143 ostate->vtkglPixelStorei(GL_UNPACK_IMAGE_HEIGHT, dim[1] - cellFlag);
146 ((textureExtent[4] * (dim[1] - cellFlag) + textureExtent[2]) * (dim[0] - cellFlag) +
150 this->
Texture->SetDataType(type);
151 this->
Texture->SetFormat(format);
152 this->
Texture->SetInternalFormat(internalFormat);
153 this->
Texture->Create3DFromRaw(
154 textureSize[0], textureSize[1], textureSize[2], 1, scalarType, dataPtr);
160 this->
Texture->SetBorderColor(0.0f, 0.0f, 0.0f, 0.0f);
163 ostate->vtkglPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
164 ostate->vtkglPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
179 swapBounds[0] = (spacing[0] < 0);
180 swapBounds[1] = (spacing[1] < 0);
181 swapBounds[2] = (spacing[2] < 0);
197 origin[0] +
static_cast<double>(this->
LoadedExtent[0 + swapBounds[0]]) * spacing[0];
199 origin[1] +
static_cast<double>(this->
LoadedExtent[2 + swapBounds[1]]) * spacing[1];
200 this->LoadedBounds[4] =
201 origin[2] +
static_cast<double>(this->
LoadedExtent[4 + swapBounds[2]]) * spacing[2];
202 this->LoadedBounds[1] =
203 origin[0] +
static_cast<double>(this->
LoadedExtent[1 - swapBounds[0]]) * spacing[0];
204 this->LoadedBounds[3] =
205 origin[1] +
static_cast<double>(this->
LoadedExtent[3 - swapBounds[1]]) * spacing[1];
206 this->LoadedBounds[5] =
207 origin[2] +
static_cast<double>(this->
LoadedExtent[5 - swapBounds[2]]) * spacing[2];
211 int wholeTextureExtent[6];
216 wholeTextureExtent[i]--;
223 if (this->
LoadedExtent[2 * i] == wholeTextureExtent[2 * i])
230 origin[i] + (
static_cast<double>(this->
LoadedExtent[2 * i]) + 0.5) * spacing[i];
233 if (this->
LoadedExtent[2 * i + 1] == wholeTextureExtent[2 * i + 1])
235 this->
LoadedBounds[2 * i + 1 - swapBounds[i]] = origin[i] +
236 (
static_cast<double>(this->
LoadedExtent[2 * i + 1]) + 1.0) * spacing[i];
240 this->
LoadedBounds[2 * i + 1 - swapBounds[i]] = origin[i] +
241 (
static_cast<double>(this->
LoadedExtent[2 * i + 1]) + 0.5) * spacing[i];