Requesting tips for starting GL project

Discussion and questions about programming with Ultibo.
Hans
Posts: 17
Joined: Mon Feb 06, 2017 7:28 am
Location: Europe

Requesting tips for starting GL project

Postby Hans » Mon Sep 16, 2019 9:38 am

Hi all,

after a somewhat long absense I'm getting reacquainted with Ultibo to start an OpenGL (GLES?) project. Last week I created a dedicated VM for Ultibo, set up an HTTP service to update the Pi 3B+ (I've shelved my Pi 4 for now..) and then some.

I've had some exposure to OpenGL, but not to GLES. My project is to display and animate what essentialy are instrument dials. Conceptually they are 2D-objects that are layered on top of each other; on each of these layers multiple such animated objects will exist.

Currently I'm looking into how I can get such a project started; do I need to learn GLES or can I still use my old OpenGL stuff (that uses Display Lists on pc's)? Can such a project be done without any external dependency, other than what a default Ultibo install offers?

Any recommendation is very welcome indeed! :D

cheers
Hans
User avatar
Ultibo
Site Admin
Posts: 2303
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Requesting tips for starting GL project

Postby Ultibo » Mon Sep 16, 2019 11:25 pm

Hans wrote:I've had some exposure to OpenGL, but not to GLES. My project is to display and animate what essentialy are instrument dials. Conceptually they are 2D-objects that are layered on top of each other; on each of these layers multiple such animated objects will exist.

Hi Hans,

The Pi hardware (Pi Zero, A, B, 2 and 3) only supports OpenGL ES (1.1 and 2.0) and cannot do OpenGL by itself, while the Pi 4 does support OpenGL there are quite a few reports appearing about the drivers being a fair bit slower than they were in the Pi 3.

If at some point we are able to get the Mesa 3D libraries to compile for Ultibo and provide OpenGL support for the Pi 4 then it would also include some (emulated) support for OpenGL on the Pi 2 and 3 as well, however it is likely to be some time yet before we reach that point.

In any case what you describe doesn't sound like it would be beyond the capability of OpenGL ES, it will just be a matter of learning about the differences and redesigning those parts that are not supported.

Hans wrote:Currently I'm looking into how I can get such a project started; do I need to learn GLES or can I still use my old OpenGL stuff (that uses Display Lists on pc's)?

One of the things that OpenGL ES specifically doesn't support is Display Lists so you will need to find alternative ways to produce the same result, the commonly accepted way to achieve similar performance gains in OpenGL ES seems to be to use Vertex Buffer Objects instead.

Hans wrote:Can such a project be done without any external dependency, other than what a default Ultibo install offers?

It should be completely possible to create a project without any external dependencies, Ultibo contains all of the required libraries and interfaces for OpenGL ES and the supporting EGL and Dispmanx protocols.

The question I would probably ask you is did you rely on any external tools when creating your PC version? There are an enormous number of toolkits, libraries and frameworks around for OpenGL, some of them support OpenGL ES and others don't, so if you have used anything previously you will need to check what it supports and if there is an equivalent available.
Ultibo.org | Make something amazing
https://ultibo.org
pik33
Posts: 891
Joined: Fri Sep 30, 2016 6:30 pm
Location: Poland
Contact:

Re: Requesting tips for starting GL project

Postby pik33 » Tue Sep 17, 2019 4:50 am

2D animated objests are simple and doable in RPi/Ultibo/OpenGLES. What you have to consider, there are only 8 textures available, so you have to use one big texture for your objects and then use a shader to select appropriate fragment of it (unless there is less than 8 different objects)

Texture updating is very slow. Avoid this as much as you can. I made a hack which can access texture memory directly. This can speed up its update, but the structure of the texture is complex: this is not a simple bitmap, it is rather fractal-like structure. This explains why the access to texture from CPU is slow: you have to translate pixel x,y address to memory offset in the texture which involves a lot of bit shifting and logic operations.
.
Gavinmc42
Posts: 1665
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Requesting tips for starting GL project

Postby Gavinmc42 » Tue Sep 17, 2019 6:42 am

As you are doing this on VC4 Pi's use OpenVG for dials.
Layering is just done by the order they are rendered.

AJ Starks is the guy who shows how OpenVG can be done.
I started with the Ultibo OpenVG example and made a clock.
https://github.com/Gavinmc42/Industrial-clock

OpenGLES could use a library with some simple primatives that usually comes with OpenGL libs like FreeGlut.
Been meaning to look at old Android Libraries/SDK's as they are OpenGLES usually.
Hans
Posts: 17
Joined: Mon Feb 06, 2017 7:28 am
Location: Europe

Re: Requesting tips for starting GL project

Postby Hans » Tue Sep 17, 2019 8:57 pm

Thank you all for your suggestions. OpenVG looks rather promising, I'll check it out. I wonder though: could OpenVG be used 'on top' of a GL-ES 3D-scene in the background? I now understand that I'd need to learn about VBO's... :)

cheers
Hans
Gavinmc42
Posts: 1665
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Requesting tips for starting GL project

Postby Gavinmc42 » Wed Sep 18, 2019 12:18 am

could OpenVG be used 'on top' of a GL-ES 3D-scene in the background?

Probably, it has to do with the layer you use.
I have had an OpenVG dial cluster overlayed on video.

There is also the option of windowing.
OpenVG UI surround and a "window" for the GLES/Video etc.

If a video can be overlayed on a rotating cube, then what you want "should" be easier :D
User avatar
Ultibo
Site Admin
Posts: 2303
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Requesting tips for starting GL project

Postby Ultibo » Wed Sep 18, 2019 10:02 am

Hans wrote:I wonder though: could OpenVG be used 'on top' of a GL-ES 3D-scene in the background?

It isn't a combination we have specifically tried but we have done OpenGL over the Framebuffer (and vice-versa) and OpenVG over Framebuffer, since all of them utilize DispmanX as the compositor then it should be possible to output any and all at the same time by setting the transparency values correctly.
Ultibo.org | Make something amazing
https://ultibo.org
Hans
Posts: 17
Joined: Mon Feb 06, 2017 7:28 am
Location: Europe

Re: Requesting tips for starting GL project

Postby Hans » Wed Sep 18, 2019 11:50 am

Thanks for both of your replies - so much to test and try... :D

Return to “General”

Who is online

Users browsing this forum: No registered users and 36 guests