Closed IngwiePhoenix closed 3 years ago
Hard to say without knowing much about LVGL. If it's a vector-based API, then sokol-gl might help as an intermediate layer:
https://github.com/floooh/sokol/blob/master/util/sokol_gl.h
The MicroUI sample here does all the rendering via sokol-gl:
https://floooh.github.io/sokol-html5/sgl-microui-sapp.html
...via this code:
However, the example code in the documentation you posted looks more like it's a framebuffer based API. In that case you'd want to copy the LVGL framebuffer into a sokol-gfx texture once per frame, and then render that texture somehow. The closest simple example code is the game-of-life sample here:
https://floooh.github.io/sokol-html5/dyntex-sapp.html
The pixels are generated by the CPU and copied into a dynamic texture, which is then used for rendering:
However, the example code in the documentation you posted looks more like it's a framebuffer based API
Spot on! Yes, it's a framebuffer approach. The user provided callback is to return if buffering is still in process or if drawing is done.
Thank you for the pointer! I think I can work from there.
Fun fact: While taking to members of the Playstation Vita community, they had recommended me drawing the buffer into a texture for a LVGL port to the Vita as well. I still got a long way to go in terms of graphics programming...
Have a nice day :)
An LVGL + Sokol example drawing something like a button and label would be awesome.
Hello!
I am currently looking into making an LVGL simulator using Sokol. In terms of porting LVGL, it only needs to know a few things - one, is to have callbacks implemented to handle drawing and filling (https://docs.lvgl.io/latest/en/html/get-started/quick-overview.html#add-lvgl-into-your-project).
Now, LVGL is pretty much a 2D GUI - with only very tiny 3D elements since it's more intended for embedded devices. How do I create a 2D drawing context with Sokol?
Kind regards, Ingwie