Recent

Author Topic: ThorVG - test (lightweight vector graphics engine)  (Read 4141 times)

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1186
Re: ThorVG - test (lightweight vector graphics engine)
« Reply #45 on: February 16, 2026, 11:19:41 am »
@Antek
For OpenGL, you probably need to create a context. I haven't worked with OpenGL before. You either need to study examples of working with OpenGL from Lazarus and ThorVG yourself, or wait until someone adapts the examples

SW animation can be accelerated; at least 50% is lost in the depths of LCL when rendering Bitmap (I'm talking about Windows; in other widget sets, everything may be different; in general, you need to adapt the rendering everywhere for minimal overhead)
Good information.

hermet

  • Newbie
  • Posts: 3
Re: ThorVG - test (lightweight vector graphics engine)
« Reply #46 on: February 23, 2026, 04:25:05 pm »
I tested the project provided by @Boleeman.
It just worked on win11 64bit.
But the cpu usage is (very) high. One core is running with nearly 100%, with given "driving.json" and 25fps.
I think this is because of sofware(cpu) rendering:
Code: Pascal  [Select][+][-]
  1. tvgCanvas := tvg_swcanvas_create(TVG_ENGINE_OPTION_SMART_RENDER);
  2.  tvg_swcanvas_set_target(tvgCanvas, PUInt32(b.RawImage.Data), PaintBox1.Width, PaintBox1.Width, PaintBox1.Height, TVG_COLORSPACE_ARGB8888S);

Code: Pascal  [Select][+][-]
  1. tvg_glcanvas_set_target(tvgCanvas, PUInt32(b.RawImage.Data), ......

But I think hw rendering is crucial for apps when using animations (heavily).

Great work!


I don't know how to use opengl rendering backend.
Code: Pascal  [Select][+][-]
  1. tvgCanvas := tvg_glcanvas_create( TVG_ENGINE_OPTION_DEFAULT);


Hi, somehow it seems a bit late but leave a comment for your information. basically, software engine is very fast but the driving animation includes post-effects such as blur. It may require more CPU processing than typical animations. The recommended number of threads is 4 in normal scenario, it's enough. Using more threads may consume additional resources, which could block your app’s main loop cycle. Regarding OpenGL, I’m not sure which framework or window system Lazarus uses. OpenGL initialization and context creation must be handled on the user side with thorvg. If you are using a specific framework such as SDL, you can pass the created OpenGL context to ThorVG. The best practice is described here: https://github.com/thorvg/thorvg.example And WebGPU is designed for web browser running. I guess it's not a case you're concern.

 

TinyPortal © 2005-2018