| 269 | } |
| 270 | |
| 271 | void vtkOSOpenGLRenderWindow::CreateOffScreenWindow(int width, int height) |
| 272 | { |
| 273 | if (!this->Internal->OSMesaCreateContext || !this->Internal->OSMesaCreateContextAttribs) |
| 274 | { |
| 275 | return; |
| 276 | } |
| 277 | this->DoubleBuffer = 0; |
| 278 | |
| 279 | if (!this->Internal->OffScreenWindow) |
| 280 | { |
| 281 | this->Internal->OffScreenWindow = vtkOSMesaCreateWindow(width, height); |
| 282 | this->OwnWindow = 1; |
| 283 | } |
| 284 | #if (OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 1102) && \ |
| 285 | defined(OSMESA_CONTEXT_MAJOR_VERSION) |
| 286 | if (!this->Internal->OffScreenContextId) |
| 287 | { |
| 288 | static const int attribs[] = { OSMESA_FORMAT, OSMESA_RGBA, OSMESA_DEPTH_BITS, 32, |
| 289 | OSMESA_STENCIL_BITS, 0, OSMESA_ACCUM_BITS, 0, OSMESA_PROFILE, OSMESA_CORE_PROFILE, |
| 290 | OSMESA_CONTEXT_MAJOR_VERSION, 3, OSMESA_CONTEXT_MINOR_VERSION, 2, 0 }; |
| 291 | |
| 292 | if (this->Internal->OSMesaCreateContextAttribs != nullptr) |
| 293 | { |
| 294 | this->Internal->OffScreenContextId = |
| 295 | this->Internal->OSMesaCreateContextAttribs(attribs, nullptr); |
| 296 | } |
| 297 | } |
| 298 | #endif |
| 299 | // if we still have no context fall back to the generic signature |
| 300 | if (!this->Internal->OffScreenContextId) |
| 301 | { |
| 302 | this->Internal->OffScreenContextId = this->Internal->OSMesaCreateContext(GL_RGBA, nullptr); |
| 303 | } |
| 304 | |
| 305 | this->Mapped = 0; |
| 306 | this->Size[0] = width; |
| 307 | this->Size[1] = height; |
| 308 | |
| 309 | this->MakeCurrent(); |
| 310 | |
| 311 | // tell our renderers about us |
| 312 | vtkRenderer* ren; |
| 313 | for (this->Renderers->InitTraversal(); (ren = this->Renderers->GetNextItem());) |
| 314 | { |
| 315 | ren->SetRenderWindow(nullptr); |
| 316 | ren->SetRenderWindow(this); |
| 317 | } |
| 318 | |
| 319 | this->OpenGLInit(); |
| 320 | } |
| 321 | |
| 322 | void vtkOSOpenGLRenderWindow::DestroyOffScreenWindow() |
| 323 | { |
no test coverage detected