------------------------------------------------------------------------------ Implement base class method.
| 116 | //------------------------------------------------------------------------------ |
| 117 | // Implement base class method. |
| 118 | void vtkOpenGLTexture::Load(vtkRenderer* ren) |
| 119 | { |
| 120 | vtkOpenGLRenderWindow* renWin = static_cast<vtkOpenGLRenderWindow*>(ren->GetRenderWindow()); |
| 121 | vtkOpenGLState* ostate = renWin->GetState(); |
| 122 | |
| 123 | if (!this->ExternalTextureObject) |
| 124 | { |
| 125 | if (this->GetInputDataObject(0, 0) == nullptr) |
| 126 | { |
| 127 | return; |
| 128 | } |
| 129 | vtkImageData* input = this->GetInput(); |
| 130 | int numIns = 1; |
| 131 | vtkMTimeType inputTime = input->GetMTime(); |
| 132 | |
| 133 | if (this->CubeMap) |
| 134 | { |
| 135 | for (int i = 1; i < this->GetNumberOfInputPorts(); ++i) |
| 136 | { |
| 137 | vtkImageData* in = vtkImageData::SafeDownCast(this->GetInputDataObject(i, 0)); |
| 138 | if (!in) |
| 139 | { |
| 140 | break; |
| 141 | } |
| 142 | inputTime = std::max(inputTime, in->GetMTime()); |
| 143 | numIns++; |
| 144 | } |
| 145 | |
| 146 | if (numIns < 6) |
| 147 | { |
| 148 | vtkErrorMacro("Cube Maps require 6 inputs"); |
| 149 | return; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | if (this->RenderWindow == nullptr && this->LoadTime.GetMTime() > this->GetMTime()) |
| 154 | { |
| 155 | vtkErrorMacro("A render window was deleted without releasing graphics resources"); |
| 156 | } |
| 157 | |
| 158 | // Need to reload the texture. |
| 159 | // There used to be a check on the render window's mtime, but |
| 160 | // this is too broad of a check (e.g. it would cause all textures |
| 161 | // to load when only the desired update rate changed). |
| 162 | // If a better check is required, check something more specific, |
| 163 | // like the graphics context. |
| 164 | |
| 165 | // has something changed so that we need to rebuild the texture? |
| 166 | if (this->GetMTime() > this->LoadTime.GetMTime() || inputTime > this->LoadTime.GetMTime() || |
| 167 | (this->GetLookupTable() && this->GetLookupTable()->GetMTime() > this->LoadTime.GetMTime()) || |
| 168 | (this->RenderWindow == nullptr || |
| 169 | renWin->GetGenericContext() != this->RenderWindow->GetGenericContext()) || |
| 170 | renWin->GetContextCreationTime() > this->LoadTime) |
| 171 | { |
| 172 | int size[3]; |
| 173 | int xsize, ysize; |
| 174 | |
| 175 | this->RenderWindow = renWin; |
no test coverage detected