Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed nanoVG purple edge glitch #1002

Open
Youlean opened this issue Aug 15, 2023 · 0 comments
Open

Fixed nanoVG purple edge glitch #1002

Youlean opened this issue Aug 15, 2023 · 0 comments

Comments

@Youlean
Copy link
Contributor

Youlean commented Aug 15, 2023

void IGraphicsNanoVG::EndFrame()
{
  const float width = std::ceil(Width() * GetDrawScale());
  const float height = std::ceil(Height() * GetDrawScale());
  
  nvgEndFrame(mVG); // end main frame buffer update
  nvgBindFramebuffer(nullptr);
  nvgBeginFrame(mVG, width, height, GetScreenScale());
  
  NVGpaint img = nvgImagePattern(mVG, 0, 0, width, height, 0, mMainFrameBuffer->image, 1.0f);

  nvgSave(mVG);
  nvgResetTransform(mVG);
  nvgTranslate(mVG, mXTranslation, mYTranslation);
  nvgBeginPath(mVG);
  nvgRect(mVG, 0, 0, width, height);
  nvgFillPaint(mVG, img);
  nvgFill(mVG);
  nvgRestore(mVG);
  
#if defined OS_MAC && defined IGRAPHICS_GL
  glBindFramebuffer(GL_FRAMEBUFFER, mInitialFBO); // restore apple fbo
#endif

  nvgEndFrame(mVG);

#if defined IGRAPHICS_IMGUI && defined IGRAPHICS_GL
  if(mImGuiRenderer)
    mImGuiRenderer->NewFrame();
#endif
  
  mInDraw = false;
  ClearFBOStack();
}

This will fix the annoying purple glitch. (right edge here)

Screenshot 2023-08-15 at 21 22 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant