Not working as intended on Jetson Nano
ahtabrizi opened this issue · 2 comments
Hey,
First of all thanks for this great and minimal library.
I am rendering video frames in a window using OpenGL stuff. Now I want to draw some UI elements (some circles and rectangles) on this video frame. I can do this perfectly on my laptop with Ubuntu 16, where it draws UI elements with video frame as background.
But when I try to do same in Nvidia's Jetson Nano, it draws the UI elements but resets the background to default clear color. So I cannot see the video frame.
It is worthy to note that rendering the video in Jetson is slightly different (uses Nvidia's own buffers) but the algorithm is basically the same.
What am I missing??
Make sure you allocate and clear stencil buffer.
@memononen It didn't work!
But I managed to make it work. Just in case someone stumbles upon this issue, I'll explain the fix.
It seems like for frame rendering part, which is before nanovg rendering, you should set vertex and texture coords using glEnableVertexAttribArray
and glVertexAttribPointer
just before drawing. Setting it only in initialization won't do, it has to be done every draw. Also, don't forget to glUseProgram
the shader and bind the texture.
I'm not sure about the reason. But I suppose, since drawing a frame uses EXTERNAL_OES
textures and nanovg uses simple TEXTURE_2D
when drawing nanovg (or any other 2D texture stuff, tested it) it replaces external textures' vertex pointers. So you need to set it for every frame.