Recent

Author Topic: LCL Scene Graph implementation  (Read 2136 times)

mateli

  • New member
  • *
  • Posts: 8
LCL Scene Graph implementation
« on: August 21, 2021, 12:25:32 pm »
While the QT implementation is sufficient for many use cases there are some problem with using it. One is that it is no longer free for all platform. They made a new highly optimized version that runs on many devices and it is NOT open source.

Making a custom drawn LCL implementation that is based on a Scene Graph and renders on TinyGL (fast software rendering), OpenGL, GL ES, Direct X and other hardware would have several advantages. Using less CPU, full custom rendering and portability would be the the most obvious one. OpenGL ES is supported by virtually all embedded devices as well as desktop MESA drivers.

Other advantages outside of the LCL context:

LCL + game/2D/3D integration. Having a scene graph as the layer below LCL means that other things can be drawn using 2D and 3D hardware acceleration. Game can run top level and contain an LCL UI as one of its nodes. And a game can run inside an LCL control. This could even be nested in various ways. Some of this can probably already be done but not in the same rendering pipeline. Rendering a non-GL gui on top of GL means CPU usage as well as unnecessary texture copying.

Hardware media integration. VAAPI, OpenMAX, and Vulcan are a few different way to use hardware together with zero copy rendering of video onto an OpenGL Scene. I am sure that DirectX have something similar. Implementing this inside a Scene Graph means that neither game nor LCL developers have to care what the underlying hardware is.

Raspberry Pi support. There are two ways to run applicatins on Raspberry Pi. Using Xorg either with or without OpenGL ES or using the Frambuffer with or without GL ES. The latter provides heavy advantages as Xorg consumes a lot of memory even when just running OpenGL ES applications. Wayland is also an alternative but it is not really in an usable state. I would suggest an implementation that can run directly on the framebuffer. This means that it will have to take car of all graphics such as rendering a desktop, window borders etc.

Android/Mobile support. I know that there are some attempt to implement LCL for OpenGL ES on Android. I would suggest that developing on desktop and then porting to android has several advantages. Lazarus itself currently only runs on desktop which means that developing for Android includes cross compilation and less than easy debugging. To implement a desktop solution perhaps on top of SDL and then port it to Android means that only platform specific bugs has to be hammered out on the Android platform. In short it will allow for a much faster development cycle. Also this means that all applications that works on desktop will then automatically work on Android, once bugs are hammered out.

AlexTP

  • Hero Member
  • *****
  • Posts: 2406
    • UVviewsoft
Re: LCL Scene Graph implementation
« Reply #1 on: August 21, 2021, 11:31:42 pm »
So what do you suggest, making new widget-set based on Scene Graph?

mateli

  • New member
  • *
  • Posts: 8
Re: LCL Scene Graph implementation
« Reply #2 on: August 22, 2021, 02:48:46 pm »
Pretty much. It is possible that the custom drawn components can be easily ported to render on a Scene Graph so we may not have to start entirely from scratch. There may also be some work done for Android. I remember seeing somewhere that there is an incomplete OpenGL ES LCL implementation for Android but I have not spend much time digging into that.

I also suggest that a Scene Graph has other usages outside of being the rendering backed of a widget set. Delphi has its FireMonkey which has been used to make games. The Java counterpart is JavaFX which is a nice idea however the implementation is rather horrible.

mateli

  • New member
  • *
  • Posts: 8
Re: LCL Scene Graph implementation
« Reply #3 on: September 05, 2021, 11:41:00 am »
So I am the only one interested in this?

Handoko

  • Hero Member
  • *****
  • Posts: 5159
  • My goal: build my own game engine using Lazarus
Re: LCL Scene Graph implementation
« Reply #4 on: September 05, 2021, 04:22:52 pm »
I am extremely interested.
But I only have very limited knowledge in OpenGL, not much I can do.

I visit BASIC forums regularly. I am both admire and envy some of the modern BASIC variants can be used to write games easily even without using third any party library. Because they internally use OpenGL or SDL.

I spent some time learning OpenGL, unfortunately almost all of the examples I found were in C/C++, which I am not good at. But I made some progress. I have written my graphics/UI module that can be used on Windows and Linux. So far, it only has basic features like texture/image loading and showing, glShape, glLabel, glEdit, glButton.

I saw LAMW have jCanvasES2, so I thought maybe I could make my module to support Android by using jCanvasES2 internally. Unfortunately, jCanvasES2 has many unsolved issues. So I tried jCanvasES1 but it does not support z-order.
https://forum.lazarus.freepascal.org/index.php/topic,32951.msg212717.html#msg212717
https://forum.lazarus.freepascal.org/index.php/topic,39714.msg280170.html#msg280170

I also saw someone shared his Lazarus-SDL Android development package. Unfortunately the project was stopped:
https://forum.lazarus.freepascal.org/index.php/topic,33008.0.html

 

TinyPortal © 2005-2018