memononen / nanovg

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

Rendering Artifacts OpenglES2 #582

Open cejasmasmas opened 4 years ago

cejasmasmas commented 4 years ago

Hi, first great library, thank you for it, I have an issue with artifacts while rendering, doesn't happen on Windows the other platform i've tested, only on the raspberry pi3B, Everything works fine but, it would seem that it doesn't clear the stencil buffer or is misaligned I took the color wheel from the example and I'm attaching an image, it looks like quads are drawing behind whenever a "hole" is present dump

thank you

mulle-kybernetik-tv commented 4 years ago

When you are clearing the framebuffer, are you clearing all the relevant bits ? This works for me:

glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
Calvin-L commented 3 years ago

I recently had the same problem. In my case, the device had chosen a configuration with no stencil buffer. If possible, try adjusting your call to eglChooseConfig:

const EGLint desiredAttributes[] = {
    ...
    EGL_STENCIL_SIZE, 8, // NanoVG requires the stencil buffer
    ...
    EGL_NONE
};
eglChooseConfig(..., desiredAttributes, ...);
cejasmasmas commented 3 years ago

thank you for your comments, the STENCIL BUFFER is ENABLED, thas is why I find this strange