MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / setupPluginTempContext

Method setupPluginTempContext

server/VirtualWin.cpp:361–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359
360
361TempContext *VirtualWin::setupPluginTempContext(GLint drawBuf)
362{
363 // This code is largely copied from VirtualDrawable::readPixels(). It
364 // establishes a temporary OpenGL context suitable for creating GPU-based
365 // buffer objects in RRTransGetFrame() and reading back the rendered frame in
366 // RRTransSendFrame(), should a plugin choose to do so.
367 TempContext *tc = NULL;
368
369 int renderMode = 0;
370 _glGetIntegerv(GL_RENDER_MODE, &renderMode);
371 if(renderMode != GL_RENDER && renderMode != 0)
372 {
373 if(!alreadyWarnedPluginRenderMode && fconfig.verbose)
374 {
375 vglout.print("[VGL] WARNING: Failed to establish temporary OpenGL context for image\n");
376 vglout.print("[VGL] transport plugin one or more times because render mode != GL_RENDER.\n");
377 alreadyWarnedPluginRenderMode = true;
378 }
379 }
380 else
381 {
382 initReadbackContext();
383 tc = new TempContext(edpy != EGL_NO_DISPLAY ? (Display *)edpy : dpy,
384 getGLXDrawable(), getGLXDrawable(), ctx, edpy != EGL_NO_DISPLAY);
385 backend::readBuffer(drawBuf);
386 }
387
388 return tc;
389}
390
391
392void VirtualWin::sendPlugin(GLint drawBuf, bool spoilLast, bool sync,

Callers

nothing calls this directly

Calls 2

readBufferFunction · 0.85
printMethod · 0.45

Tested by

no test coverage detected