memononen / nanovg

Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
zlib License
5.06k stars 767 forks source link

`Error 00000501 after tex paint tex` spamming the terminal #635

Closed frutas-fruit closed 2 years ago

frutas-fruit commented 2 years ago

I've started getting this message show up and spam the terminal: Error 00000501 after tex paint tex I've enabled NVG_DEBUG, so maybe that's why it prints these error messages excessively. Here is my nanovg render loop (called on update):


  nvgBeginFrame(nvg_ctx, window_size.x, window_size.y, static_cast<float>(framebuffer_size.x)/static_cast<float>(framebuffer_size.y));

    /*
    =================
    ADD MULTILINE TEXT
    =================
    */
    {
      float color_change = std::abs( std::sin(time* 2.5f) );

      const float ROW_WIDTH = 250.f;
      nvgFontSize(nvg_ctx, 11.f);
      nvgFontFace(nvg_ctx, "sans-bold");
      nvgFillColor(nvg_ctx, nvgRGBAf(color_change, 1.f - color_change, 0.f, 1.f));
      nvgTextAlign(nvg_ctx, NVG_ALIGN_LEFT | NVG_ALIGN_TOP);
      nvgTextBox(nvg_ctx, window_size.x*0.5f, window_size.y*0.5f + 64.f, ROW_WIDTH, "NanoVG placeholder text", nullptr);
    }
  nvgEndFrame(nvg_ctx);

  /* restore OpenGL modes */
  glDisable(GL_BLEND);
  glDisable(GL_SCISSOR_TEST);
  glEnable(GL_DEPTH_TEST);

I've tried using other render primitives like lines, rect and circles, but still returns that error. Any ideas what could be wrong?

mulle-nat commented 2 years ago

These kinds of problems you have to figure out for yourself, it's part of programming. The problem may very well be outside of the code snippet you posted. Then again it might just be typo in the font name or something. tex error is often OpenGL complaining about a wrong texture id. What helps is placing your nanovg code into known working code (like the nanovg demo) and get it to work there first.

frutas-fruit commented 2 years ago

These kinds of problems you have to figure out for yourself, it's part of programming.

This is an error which only cropped up after integrating NanoVG in my renderer (which already has a separate 2D backend running with no issues). So it makes perfect sense to open an issue here, because it could potentially be a bug in NanoVG itself (but equally could be a mistake(s) in my codebase).

What helps is placing your nanovg code into known working code (like the nanovg demo) and get it to work there first.

Yup, that's exactly what I've already done. The code above works perfectly fine with NVG_DEBUG enabled in the demo version. I should note that all images/primitives/text etc is rendering and working as expected, it's just this error message that shows up. Anyhow, I don't see this a stopper currently (no observed issues atm), and given that it works normally in the demo, I'll mark this as closed.

mulle-nat commented 2 years ago

So, If i read you correctly, you are saying these errors are happening with NVM_DEBUG enabled in the unmodified nanovg demo as well ? If that's the case, I would keep the bug report open.