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

Method sendVGL

server/VirtualWin.cpp:480–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478
479
480void VirtualWin::sendVGL(GLint drawBuf, bool spoilLast, bool doStereo,
481 int stereoMode, int compress, int qual, int subsamp)
482{
483 int w = oglDraw->getWidth(), h = oglDraw->getHeight();
484
485 if(spoilLast && fconfig.spoil && !vglconn->isReady())
486 return;
487 Frame *f;
488
489 if(oglDraw->getRGBSize() != 24)
490 THROW("The VGL Transport requires 8 bits per component");
491 int glFormat = GL_RGB, pixelFormat = PF_RGB;
492 if(compress != RRCOMP_RGB)
493 {
494 glFormat = oglDraw->getFormat();
495 if(glFormat == GL_RGBA) pixelFormat = PF_RGBX;
496 else if(glFormat == GL_BGR) pixelFormat = PF_BGR;
497 else if(glFormat == GL_BGRA) pixelFormat = PF_BGRX;
498 }
499
500 if(!fconfig.spoil) vglconn->synchronize();
501 ERRIFNOT(f = vglconn->getFrame(w, h, pixelFormat, FRAME_BOTTOMUP,
502 doStereo && stereoMode == RRSTEREO_QUADBUF));
503 if(doStereo && IS_ANAGLYPHIC(stereoMode))
504 {
505 stereoFrame.deInit();
506 makeAnaglyph(f, drawBuf, stereoMode);
507 }
508 else if(doStereo && IS_PASSIVE(stereoMode))
509 {
510 rFrame.deInit(); gFrame.deInit(); bFrame.deInit();
511 makePassive(f, drawBuf, glFormat, stereoMode);
512 }
513 else
514 {
515 rFrame.deInit(); gFrame.deInit(); bFrame.deInit(); stereoFrame.deInit();
516 GLint readBuf = drawBuf;
517 if(doStereo || stereoMode == RRSTEREO_LEYE) readBuf = LEYE(drawBuf);
518 if(stereoMode == RRSTEREO_REYE) readBuf = REYE(drawBuf);
519 readPixels(0, 0, f->hdr.framew, f->pitch, f->hdr.frameh, glFormat, f->pf,
520 f->bits, readBuf, doStereo);
521 if(doStereo && f->rbits)
522 readPixels(0, 0, f->hdr.framew, f->pitch, f->hdr.frameh, glFormat, f->pf,
523 f->rbits, REYE(drawBuf), doStereo);
524 }
525 f->hdr.winid = x11Draw;
526 f->hdr.framew = f->hdr.width;
527 f->hdr.frameh = f->hdr.height;
528 f->hdr.x = 0;
529 f->hdr.y = 0;
530 f->hdr.qual = qual;
531 f->hdr.subsamp = subsamp;
532 f->hdr.compress = (unsigned char)compress;
533 if(!syncdpy) { XSync(dpy, False); syncdpy = true; }
534 if(fconfig.logo) f->addLogo();
535 vglconn->sendFrame(f);
536}
537

Callers

nothing calls this directly

Calls 11

readPixelsFunction · 0.85
getRGBSizeMethod · 0.80
getFormatMethod · 0.80
deInitMethod · 0.80
addLogoMethod · 0.80
getWidthMethod · 0.45
getHeightMethod · 0.45
isReadyMethod · 0.45
synchronizeMethod · 0.45
getFrameMethod · 0.45
sendFrameMethod · 0.45

Tested by

no test coverage detected