MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / DrawToFramebuffer

Method DrawToFramebuffer

Source/Push2Control.cpp:431–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429}
430
431void Push2Control::DrawToFramebuffer(NVGcontext* vg, NVGLUframebuffer* fb, float t, float pxRatio)
432{
433 int winWidth, winHeight;
434 int fboWidth, fboHeight;
435
436 if (fb == NULL)
437 return;
438
439 nvgImageSize(vg, fb->image, &fboWidth, &fboHeight);
440 winWidth = (int)(fboWidth / pxRatio);
441 winHeight = (int)(fboHeight / pxRatio);
442
443 nvgluBindFramebuffer(fb);
444 glViewport(0, 0, fboWidth, fboHeight);
445 glClearColor(0, 0, 0, 0);
446 glClear(juce::gl::GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
447 nvgBeginFrame(vg, winWidth, winHeight, pxRatio);
448
449 nvgLineCap(vg, NVG_ROUND);
450 nvgLineJoin(vg, NVG_ROUND);
451 static float sSpacing = -.3f;
452 nvgTextLetterSpacing(vg, sSpacing);
453
454 mModules.clear();
455 std::vector<IDrawableModule*> modules;
456 TheSynth->GetAllModules(modules);
457 for (int i = 0; i < modules.size(); ++i)
458 {
459 if (!IsIgnorableModule(modules[i]))
460 mModules.push_back(modules[i]);
461 }
462 mModules = SortModules(mModules);
463
464 SetModuleGridLights();
465
466 mModuleViewOffsetSmoothed = ofLerp(mModuleViewOffsetSmoothed, mModuleViewOffset, .3f);
467 mModuleListOffsetSmoothed = ofLerp(mModuleListOffsetSmoothed, round(mModuleListOffset), .3f);
468
469 if (mScreenDisplayMode == ScreenDisplayMode::kNormal || mScreenDisplayMode == ScreenDisplayMode::kMap)
470 {
471 DrawLowerModuleSelector();
472 DrawDisplayModuleControls();
473
474 std::string stateInfo = "";
475 if (gTime - mTextPopupTime < 1000)
476 stateInfo = mTextPopup;
477 else if (AllowRepatch() && mHeldModule != nullptr)
478 stateInfo = "repatch mode: tap destination for " + std::string(mHeldModule->Name());
479 else if (mNewButtonHeld)
480 stateInfo = "tap control to add favorite...";
481 else if (mDeleteButtonHeld)
482 stateInfo = "tap control to remove favorite...";
483 else if (mLFOButtonHeld)
484 stateInfo = "tap a control to add/edit LFO...";
485 else if (mAutomateButtonHeld && mCurrentControlRecorder == nullptr)
486 stateInfo = "move a control to record automation...";
487 else if (mAutomateButtonHeld && mCurrentControlRecorder != nullptr)
488 stateInfo = "recording automation, length = " + ofToString(mCurrentControlRecorder->GetLength(), 2);

Callers

nothing calls this directly

Calls 15

nvgImageSizeFunction · 0.85
nvgluBindFramebufferFunction · 0.85
nvgBeginFrameFunction · 0.85
nvgLineCapFunction · 0.85
nvgLineJoinFunction · 0.85
nvgTextLetterSpacingFunction · 0.85
ofLerpFunction · 0.85
ofToStringFunction · 0.85
ofPushStyleFunction · 0.85
ofFillFunction · 0.85
ofMapFunction · 0.85
ofSetColorFunction · 0.85

Tested by

no test coverage detected