thorvg / thorvg

Thor Vector Graphics is a lightweight portable library used for drawing vector-based scenes and animations including SVG and Lottie. It can be freely utilized across various software platforms and applications to visualize graphical contents.
https://www.thorvg.org
MIT License
665 stars 100 forks source link

Replace examples ui toolkits #1244

Closed hermet closed 2 months ago

hermet commented 2 years ago

Currently thorvg examples use EFL lib to run a window & animation loop. But EFL is difficult to use in windows platform. Probably we can replace it with an other toolkit which is more portable and maintainable among OSs (i.e. glfw?) Any suggestions?

vtorri commented 2 years ago

It is not difficult to use on Windows ! :-D If you need help, I can provide it. You know I'm the Windows maintainer of the EFL. Please tell me what the problems are and what you need

vtorri commented 2 years ago

@hermet i have written ewpi for the dependencies of the EFL on Windows. I also have written an NSIS installer for the dependencies and the EFL. It's on my local computer at home (i'm on holydays). If you want I'll release them.

Also, I have enabled all the options for the EFL. If you want a minimal set of options, please tell me what you need

hermet commented 2 years ago

@vtorri I know. :) I raised this issue because @projectitis looks struggle with EFL on windows. Probably you can help him.

vtorri commented 2 years ago

@projectitis if you use IRC, you can join #e on libera.chat.

projectitis commented 2 years ago

Sorry, it's bedtime here :)

I have GLFW3 working with ThorVG that we could provide as an option, but I would gladly accept advice on how to get EFL working. Then I will update the readme with steps for windows users and we won't have to update the examples 😁

It might be good to have a GLFW implementation as an option as it's a reasonably popular framework.

vtorri commented 2 years ago

@projectitis the simplest way for you is to use msys2. You install with pacman the dependencies, and you can compile the EFL with meson.

or you wait 1 or 2 weeks for me to create the needed installers.

vpxyz commented 1 year ago

Another option is SDL2. It is simple to use and widely used.

RuiwenTang commented 1 year ago

Do we still consider another option? I am trying to rewrite the OpenGL backend for thorvg. And the biggest problem is the OpenGL context creation when using EFL.

My usual working environment is macbook, but EFL can not create the OpenGL context as I mentioned in #1531

In Ubuntu, EFL creates Open GLES contexts up to version 3.1. Even if the GPU driver provides OpenGL 4.6 capability.

BTW. If we plan to choose WebGPU in the future #1479 , I can not find the API to get the raw window handler which is needed to create a WebGPU surface

hermet commented 1 year ago

@RuiwenTang Yes, it's still an open question. Someone should take on this task. So far, I'm considering GLFW as the candidate. Our examples are quite simple apps to show visuals. GLFW is the proper option for this.

btw, Ultimately, thorvg needs own windows port backends implementation.

capnm commented 1 year ago

Our examples are quite simple apps to show visuals. GLFW is the proper option for this.

I fully agree with this from my own experience. GLFW is small and the code is well written (in contrast to SDL2;). The need to install a (huge dependency tree) windowing system just for testing is/was a overkill from my point of view.

vtorri commented 1 year ago

or write your own opengl code. less dependencies. note that using opengl on Windows is not so easy, i would use Direct3D (i can help with that task) maybe on mac, use metal

so struct with function pointers and fill them with the code corresponding to the windowin system.

could be funny to do :-)

hermet commented 1 year ago

https://github.com/mmaciola/thorvg-freeglut

projectitis commented 1 year ago

I use GLFW on windows with TVG. I will share it shortly and you can consider if you like it or not :)

Here is what I use: GLFW + ImGUI https://github.com/DeriveSDK/experiments/tree/main/glfw_imgui_tvg_window

My example is the RiveTizen viewer

hermet commented 1 year ago

@projectitis Cool! I'm curious to know if you'd be interested in contributing the TVG window feature to the thorvg project. I believe TVG can aim to add this window feature in TVG 2.0. During the early stages of development, we can begin by supporting this as the beta feature with a GLFW dependency.

// Only enabled when the Windows build is activated. thorvg/src/windows/

vpxyz commented 1 year ago

Hi, how about support for both EFL and SDL2 ? I've almost finished writing the patch, I just have to implement something similar to EFL transitions, the rest already works (on linux, I'm on vacation and haven't tried it with Windows or Mac OS). I extracted the toolkit-dependent code from the examples, then wrote an SDL2 implementation of these functions. During configuration you can choose to compile for EFL, SDL2 or both. I think I can make a pull request by the end of the month.

hermet commented 1 year ago

@vpxyz Hello, thank you for your cooperation.

Firstly, I would prefer not to depend on both frameworks due to the maintenance burden.

Secondly, while I would prefer to use glfw for examples due to its lightweight nature, and its suitability for our examples, if SDL works well with most operating systems (Windows, Linux, iOS), we can replace EFL with it now.

Ultimately, we should consider a more appropriate direction, utilizing the thorvg glue-layer window as mentioned eariler discussion, and creating examples that make use of it.

hermet commented 4 months ago

@SergeyLebedkin Please review and confirm that webgpu + glfw would be compatible for all major platforms (windows/mac/ubuntu), thanks.

onecoolx commented 3 months ago

I wrote some code to port thorvg to GTK2, using gtkgl support the opengl backend. Currently seems to be working normally. https://github.com/thorvg/thorvg/pull/2285

SergeyLebedkin commented 3 months ago

@SergeyLebedkin Please review and confirm that webgpu + glfw would be compatible for all major platforms (windows/mac/ubuntu), thanks.

Yes.... It's ok to use glfw and webgpu on any platform

vtorri commented 3 months ago

to install the EFL on Windows: https://download.enlightenment.org/rel/win/efl/

these are NSIS installers made on linux

i plan to update the dependencies and EFL soon

in case it helps...