| 147 | } |
| 148 | |
| 149 | void SetTexture(vtkTextureObject* val, unsigned int attachment, unsigned int target = 0, |
| 150 | unsigned int mipmapLevel = 0) |
| 151 | { |
| 152 | |
| 153 | // always reset to false |
| 154 | this->CreatedByFO = false; |
| 155 | |
| 156 | if (this->Texture == val && this->Attachment == attachment) |
| 157 | { |
| 158 | return; |
| 159 | } |
| 160 | this->Attached = false; |
| 161 | val->Register(nullptr); |
| 162 | if (this->Texture) |
| 163 | { |
| 164 | this->Texture->Delete(); |
| 165 | this->Texture = nullptr; |
| 166 | } |
| 167 | if (this->Renderbuffer) |
| 168 | { |
| 169 | this->Renderbuffer->Delete(); |
| 170 | this->Renderbuffer = nullptr; |
| 171 | } |
| 172 | this->Texture = val; |
| 173 | this->Attachment = attachment; |
| 174 | // if target not specified, used texture target |
| 175 | // a custom target is useful for cubemap |
| 176 | this->Target = target ? target : val->GetTarget(); |
| 177 | this->MipmapLevel = mipmapLevel; |
| 178 | } |
| 179 | |
| 180 | void SetRenderbuffer(vtkRenderbuffer* val, unsigned int attachment) |
| 181 | { |