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

Method sendPlugin

server/VirtualWin.cpp:392–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390
391
392void VirtualWin::sendPlugin(GLint drawBuf, bool spoilLast, bool sync,
393 bool doStereo, int stereoMode)
394{
395 Frame f;
396 int w = oglDraw->getWidth(), h = oglDraw->getHeight();
397 RRFrame *rrframe = NULL;
398 TempContext *tc = NULL;
399
400 try
401 {
402 if(!plugin)
403 {
404 tc = setupPluginTempContext(drawBuf);
405 plugin = new TransPlugin(dpy, x11Draw, fconfig.transport);
406 plugin->connect(
407 strlen(fconfig.client) > 0 ? fconfig.client : DisplayString(dpy),
408 fconfig.port);
409 }
410
411 if(spoilLast && fconfig.spoil && !plugin->ready())
412 {
413 delete tc; return;
414 }
415 if(!tc) tc = setupPluginTempContext(drawBuf);
416 if(!fconfig.spoil) plugin->synchronize();
417
418 if(oglDraw->getRGBSize() != 24)
419 THROW("Transport plugins require 8 bits per component");
420 int desiredFormat = RRTRANS_RGB;
421 if(oglDraw->getFormat() == GL_BGR) desiredFormat = RRTRANS_BGR;
422 else if(oglDraw->getFormat() == GL_BGRA) desiredFormat = RRTRANS_BGRA;
423 else if(oglDraw->getFormat() == GL_RGBA) desiredFormat = RRTRANS_RGBA;
424
425 rrframe = plugin->getFrame(w, h, desiredFormat,
426 doStereo && stereoMode == RRSTEREO_QUADBUF);
427 if(rrframe->bits)
428 {
429 f.init(rrframe->bits, rrframe->w, rrframe->pitch, rrframe->h,
430 trans2pf[rrframe->format], FRAME_BOTTOMUP);
431
432 if(doStereo && stereoMode == RRSTEREO_QUADBUF && rrframe->rbits == NULL)
433 {
434 static bool message = false;
435 if(!message)
436 {
437 vglout.println("[VGL] NOTICE: Quad-buffered stereo is not supported by the plugin.");
438 vglout.println("[VGL] Using anaglyphic stereo instead.");
439 message = true;
440 }
441 stereoMode = RRSTEREO_REDCYAN;
442 }
443 if(doStereo && IS_ANAGLYPHIC(stereoMode))
444 {
445 stereoFrame.deInit();
446 makeAnaglyph(&f, drawBuf, stereoMode);
447 }
448 else if(doStereo && IS_PASSIVE(stereoMode))
449 {

Callers

nothing calls this directly

Calls 14

readPixelsFunction · 0.85
getRGBSizeMethod · 0.80
getFormatMethod · 0.80
printlnMethod · 0.80
deInitMethod · 0.80
addLogoMethod · 0.80
getWidthMethod · 0.45
getHeightMethod · 0.45
connectMethod · 0.45
readyMethod · 0.45
synchronizeMethod · 0.45
getFrameMethod · 0.45

Tested by

no test coverage detected