We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

Ybombinator
Posts: 4
Joined: Tue Jul 05, 2022 5:35 pm

Vulkan or OpenGL ES?

Fri Apr 28, 2023 4:15 pm

For some context, I want to use the features of the hardware on the raspberry pi 4b (for example ARM NEON and the performance tricks in mesa described here) to optimize 2D/3D rendering . I want to experiment with some throwaway programs to play around with these features, do benchmarks and then maybe create a library which I can use with all those optimizations in the future.

With that said, I don't know if I should learn OpenGL ES or Vulkan. Apparently the latest API versions for both that are supported on the raspberry pi 4b are Vulkan 1.2.217[1] and OpenGL ES 3.1[2]. With which one of these can I currently optimize my programs better? I know Vulkan generally allows you to make more optimizations but does that apply to raspberry pi 4b as well? For example, the ARM NEON I mentioned looks like was made to be used with OpenGL but there is some SDK I have to use to get it to work with Vulkan I think. I know Vulkan is considered more difficult but I'm not on a deadline or anything, just want to learn.

1. https://www.khronos.org/conformance/ado ... ission_700
2. https://www.raspberrypi.com/products/ra ... fications/

RedMarsBlueMoon
Posts: 501
Joined: Mon Apr 06, 2020 3:49 am

Re: Vulkan or OpenGL ES?

Fri Apr 28, 2023 5:30 pm

Do you love the technical and dry side of programming?
Then start looking at Vulkan.

OpenGL/GLES is much easier to use for someone who's not an experienced graphics programmer.
Personally I would recommend doing some tests in GL with what you think is going to be the most demanding parts of your project and see if it works well enough.

pidd
Posts: 6567
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK

Re: Vulkan or OpenGL ES?

Fri Apr 28, 2023 5:44 pm

Vulkan is the way forward, both OpenGL and OpenGL ES are effectively deprecated. The multitude of Vulkan wrappers have already had some casualties perhaps showing that pure Vulkan is the eventual preference for many, or the opposite?

Anonymous

Re: Vulkan or OpenGL ES?

Fri Apr 28, 2023 6:11 pm

RedMarsBlueMoon wrote:
Fri Apr 28, 2023 5:30 pm
Do you love the technical and dry side of programming?
Then start looking at Vulkan.
:shock: That's hilarious!

Vulkan provides much lower level access to the GPU - the original Mantle became an API independent user space driver layer - so many details have to be managed, but the benefit is you can control those details.

Because I want to run on older Pis, I'm using OpenGL ES for a new little project, but expect to port to Vulkan eventually.

In fact, if your priority is learning, writing or just grabbing an existing simple OpenGL ES program and porting it to Vulkan might be a good exercise.

I haven't played with these demos, but the 9.0 version definitely has some Vulkan samples: https://archive.mesa3d.org/demos/

Ybombinator
Posts: 4
Joined: Tue Jul 05, 2022 5:35 pm

Re: Vulkan or OpenGL ES?

Fri Apr 28, 2023 8:17 pm

Thanks for the replies. I'm gonna go with Vulkan then.

andrew_pi
Posts: 721
Joined: Wed Jul 16, 2014 4:45 pm

Re: Vulkan or OpenGL ES?

Sun Apr 30, 2023 10:16 am

OpenGL is very deprecated, some 5 years since 4.6 but its far from dead. I am aware of at least two Unis with comp sci graphics modules that teach on mainly openGL with a bit of rasterisation on the CPU side to show what's happening under the covers. It's much easier way to work on the GPU with shaders beyond the abstractions like sdl2 and sfml.

I think OpenGL is surviving because of the much higher effort to entry into Vulkan.

jiandingzhe
Posts: 47
Joined: Wed Jun 07, 2017 6:00 am

Re: Vulkan or OpenGL ES?

Tue May 02, 2023 8:44 am

Vulkan is purely for optimized speed, and needs much more tedious works to make something start, as it exposes more API details such as command buffer. In my experience, OpenGL needs several hundreds lines to make draw trivial triangle, and I believe Vulkan would need several times more.

As Vulkan and OpenGL are both managed by Khronos, you can consider Vulkan as the de-facto successor of OpenGL. However you probably don't need to worry about the deprecation of OpenGL as there are plenty amount of old devices even only supports GLES 2.

In my opinion, if you are completely new for GPU programming, you can choose any API you like as the underlying rendering pipeline are same. Their difference is the extent of exposure to you.

pidd
Posts: 6567
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK

Re: Vulkan or OpenGL ES?

Wed May 03, 2023 12:32 am

jiandingzhe wrote:
Tue May 02, 2023 8:44 am
OpenGL needs several hundreds lines to make draw trivial triangle, and I believe Vulkan would need several times more.
That's what ChatGPT is for :lol:

andrew_pi
Posts: 721
Joined: Wed Jul 16, 2014 4:45 pm

Re: Vulkan or OpenGL ES?

Wed May 03, 2023 6:51 am

Several hundred lines if you count the code in the gl3w or whatever your choice of libraries etc.

But excluding the includes (interesting language there) a nice colour blended triangle in OpenGL is just a screenful of code.

User avatar
Gavinmc42
Posts: 8345
Joined: Wed Aug 28, 2013 3:31 am

Re: Vulkan or OpenGL ES?

Wed May 03, 2023 10:04 am

I have run the OpenSceneGraph and VulkanSceneGraph demo app on Pi's.
OSC is a bit slow, VSG is usable.
Twice as fast, if not faster.

Because the Pi is so borderline, the extra speed of Vulkan is useful.
Depends on the applications but learning Vulkan is probably going to be better long term.

There are some other Vulkan libs apart from VSG making it easier to do Vulkan stuff.
How many will work on Pi's?

We don't know what will be in the Pi5 re GPU magic but the next Linux kernel 6+ with Mesa 23+ should be even better on Pi4's.
That might improve OpenGL too.

Running 64Bit OS also adds about a 15% speed advantage.
Manjaro is probably the best OS at the moment to try things until the new Debian is out.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

cleverca22
Posts: 9564
Joined: Sat Aug 18, 2012 2:33 pm

Re: Vulkan or OpenGL ES?

Wed May 03, 2023 1:14 pm

there is also several other questions

do you want only 2d rendering, or stuff that requires the 3d core?
do you run under X or bare console?

some API's may be far simpler, if your needs match up


https://www.youtube.com/watch?v=JFmCin3EJIs
this is an example of what you can do with only the 2d core, in bare console

Ybombinator
Posts: 4
Joined: Tue Jul 05, 2022 5:35 pm

Re: Vulkan or OpenGL ES?

Sun Jun 04, 2023 1:39 pm

Gavinmc42 wrote:
Wed May 03, 2023 10:04 am
I have run the OpenSceneGraph and VulkanSceneGraph demo app on Pi's.
OSC is a bit slow, VSG is usable.
Twice as fast, if not faster.

Because the Pi is so borderline, the extra speed of Vulkan is useful.
Depends on the applications but learning Vulkan is probably going to be better long term.

There are some other Vulkan libs apart from VSG making it easier to do Vulkan stuff.
How many will work on Pi's?

We don't know what will be in the Pi5 re GPU magic but the next Linux kernel 6+ with Mesa 23+ should be even better on Pi4's.
That might improve OpenGL too.

Running 64Bit OS also adds about a 15% speed advantage.
Manjaro is probably the best OS at the moment to try things until the new Debian is out.
Is there something Manjaro offers for the raspberry pis that isn't there on Arch on ARM in this context?

Ybombinator
Posts: 4
Joined: Tue Jul 05, 2022 5:35 pm

Re: Vulkan or OpenGL ES?

Sun Jun 04, 2023 1:42 pm

cleverca22 wrote:
Wed May 03, 2023 1:14 pm
there is also several other questions

do you want only 2d rendering, or stuff that requires the 3d core?
do you run under X or bare console?

some API's may be far simpler, if your needs match up


https://www.youtube.com/watch?v=JFmCin3EJIs
this is an example of what you can do with only the 2d core, in bare console
Yes I was interested in learning how to render things in console similar to that link you posted and kmscube. I think I am not going to continue with Linux anymore though and instead try to do this in OpenBSD because of the goals they list on their website despite it being slower.

bwindrim
Posts: 8
Joined: Thu Jan 19, 2023 9:16 pm

Re: Vulkan or OpenGL ES?

Wed Jul 19, 2023 12:20 pm

Am I right in thinking that Vulkan for RPi4 is still in development, and not yet included in the standard Raspberry Pi Bullseye images?

Apologies for the tenuously-related question, but I can't find confirmation of this anywhere.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8404
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Vulkan or OpenGL ES?

Wed Jul 19, 2023 12:41 pm

bwindrim wrote:
Wed Jul 19, 2023 12:20 pm
Am I right in thinking that Vulkan for RPi4 is still in development, and not yet included in the standard Raspberry Pi Bullseye images?

Apologies for the tenuously-related question, but I can't find confirmation of this anywhere.
It is supported by latest mesa. But bullseye uses an older stable version of mesa (20.3.5).
So you'll have to build mesa from source (or find someone else who has) to use it.

bwindrim
Posts: 8
Joined: Thu Jan 19, 2023 9:16 pm

Re: Vulkan or OpenGL ES?

Tue Jul 25, 2023 8:29 am

It is supported by latest mesa. But bullseye uses an older stable version of mesa (20.3.5).
So you'll have to build mesa from source (or find someone else who has) to use it.
Thanks for this. There's no real urgency on my part so I'll probably wait until Vulkan finds its way into the official Bullseye (or later) release images.

User avatar
Gavinmc42
Posts: 8345
Joined: Wed Aug 28, 2013 3:31 am

Re: Vulkan or OpenGL ES?

Wed Jul 26, 2023 12:44 pm

You could try installing newer drivers with PiKiss, that has worked for me many times.
https://github.com/jmcerrejon/PiKISS/tr ... pts/config

But these days I am just waiting for the new Debian Bookworm, I am over installing Vulkan/Mesa etc.
Been doing it for years but it breaks on the standard update/upgrade ;)

Still learning/waiting for a decent game engine to use it.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 8345
Joined: Wed Aug 28, 2013 3:31 am

Re: Vulkan or OpenGL ES?

Wed Jul 26, 2023 1:30 pm

Nice to check on the commits once in a while to see what is happening.
https://gitlab.freedesktop.org/mesa/mes ... com/vulkan

Someone must be using it if issues get identified and fixed/added?

If I am reading v3dv_device.c file correctly it looks like there is some Vulkan 1.3 stuff in there now.
But this says 1.2.246 with mesa 23.1.4
http://vulkan.gpuinfo.org/listdevices.p ... form=linux

And sometimes there is info on progress on the Planet Igalia blog.

I notice a lot of Wayland stuff in commits and search found this.
https://www.phoronix.com/news/MPV-0.36-Released

Hmm, latest MPV we have is 0.32.0 on current Raspberry OS.
Might be interesting to try a Wayland based OS on the Pi?

I guess I would wait for mesa 23.x to show up.
https://www.phoronix.com/news/V3DV-New- ... on-Queries
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 8345
Joined: Wed Aug 28, 2013 3:31 am

Re: Vulkan or OpenGL ES?

Thu Jul 27, 2023 2:58 am

Might be worth tying a new library
https://www.khronos.org/blog/meta-uses- ... cs-library

Some examples too.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

cjan
Posts: 1192
Joined: Sun May 06, 2012 12:00 am

Re: Vulkan or OpenGL ES?

Thu Jul 27, 2023 12:32 pm

Gavinmc42 wrote:
Wed Jul 26, 2023 1:30 pm
Nice to check on the commits once in a while to see what is happening.
https://gitlab.freedesktop.org/mesa/mes ... com/vulkan

Someone must be using it if issues get identified and fixed/added?

If I am reading v3dv_device.c file correctly it looks like there is some Vulkan 1.3 stuff in there now.
But this says 1.2.246 with mesa 23.1.4
http://vulkan.gpuinfo.org/listdevices.p ... form=linux

And sometimes there is info on progress on the Planet Igalia blog.

I notice a lot of Wayland stuff in commits and search found this.
https://www.phoronix.com/news/MPV-0.36-Released

Hmm, latest MPV we have is 0.32.0 on current Raspberry OS.
Might be interesting to try a Wayland based OS on the Pi?

I guess I would wait for mesa 23.x to show up.
https://www.phoronix.com/news/V3DV-New- ... on-Queries
im on mesa-23.3-git & mpv-0.36, sway/wayland/vulkan no issue.
https://www.phoronix.com/news/MPV-0.36-Released

User avatar
Gavinmc42
Posts: 8345
Joined: Wed Aug 28, 2013 3:31 am

Re: Vulkan or OpenGL ES?

Fri Jul 28, 2023 7:02 am

im on mesa-23.3-git & mpv-0.36, sway/wayland/vulkan no issue.
Rolled your own OS or off the shelf Linux?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges


User avatar
radiolistener
Posts: 622
Joined: Thu Aug 03, 2023 6:49 am

Re: Vulkan or OpenGL ES?

Sun Sep 10, 2023 7:39 am

Thanks for links.

I have a question. How can I make sure if I'm using Mesa’s VC4 graphics driver as opengl renderer?

glGetString reports renderer V3D 4.2, and Open GL 2.1 Mesa 20.3.5.

It seems that V3D is not VC4. Then how I can install VC4 graphics driver?

User avatar
Gavinmc42
Posts: 8345
Joined: Wed Aug 28, 2013 3:31 am

Re: Vulkan or OpenGL ES?

Sun Sep 10, 2023 9:33 am

V3D is the Mesa Videocore 3D, VC4/VC6 driver.
V3DV is the Vulkan driver.
Both are aware of the Videocore4/6 differences.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
radiolistener
Posts: 622
Joined: Thu Aug 03, 2023 6:49 am

Re: Vulkan or OpenGL ES?

Sun Sep 10, 2023 9:37 am

if V3D uses VC4, then how to check if it really uses it?

Return to “Graphics programming”