MCPcopy Create free account
hub / github.com/Kitware/VTK / CreateOffScreenWindow

Method CreateOffScreenWindow

Rendering/OpenGL2/vtkOSOpenGLRenderWindow.cxx:271–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271void 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
322void vtkOSOpenGLRenderWindow::DestroyOffScreenWindow()
323{

Callers 2

CreateAWindowMethod · 0.95
InitializeMethod · 0.95

Calls 6

MakeCurrentMethod · 0.95
vtkOSMesaCreateWindowFunction · 0.85
InitTraversalMethod · 0.45
GetNextItemMethod · 0.45
SetRenderWindowMethod · 0.45
OpenGLInitMethod · 0.45

Tested by

no test coverage detected