rainier
Posts: 3
Joined: Sun Apr 08, 2018 3:04 pm

Recommendation for an alternative to OpenVG for RP4

Fri Aug 02, 2019 3:53 am

Hi All,

Anyone have a recommendation for an alternative to OpenVG? I heard it is no longer supported on RP4.

I'm looking for a library which takes over the frame buffer for 2G graphics on the RP4?

Kind regards,

--andrew

blackshard83
Posts: 91
Joined: Fri Jan 10, 2014 8:31 am

Re: Recommendation for an alternative to OpenVG for RP4

Wed Aug 07, 2019 1:11 pm

It is really not supported? It should be supported as long as the broadcom proprietary EGL/OpenGLES/OpenVG libraries are still supported. Look that the proprietary libraries don't work in X, they are supposed to work exclusively on a dispmanx layer.

If you're using the opensource OpenGL driver (thus you have X acceleration), you don't get OpenVG.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23709
Joined: Sat Jul 30, 2011 7:41 pm

Re: Recommendation for an alternative to OpenVG for RP4

Wed Aug 07, 2019 1:36 pm

On the Pi4, the only 3D that works is the new Mesa driver. So even in legacy mode, I don't think you get OpenVG (since that is closely related), but will need to check.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7317
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Recommendation for an alternative to OpenVG for RP4

Wed Aug 07, 2019 2:18 pm

jamesh wrote:
Wed Aug 07, 2019 1:36 pm
On the Pi4, the only 3D that works is the new Mesa driver. So even in legacy mode, I don't think you get OpenVG (since that is closely related), but will need to check.
You don't.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jdonald
Posts: 413
Joined: Fri Nov 03, 2017 4:36 pm

Re: Recommendation for an alternative to OpenVG for RP4

Wed Aug 07, 2019 9:04 pm

Answering the OP's question: SDL2 might do it, specifically the SDL2_gfx API. Install libgbm-dev and configure SDL2 with --enable-video-kmsdrm --disable-video-x11 --disable-video-rpi. Not full-fledged vector graphics but may have all the primitives sufficient for your use-case.

I am guessing SDL2_gfx's curves aren't GPU-accelerated. If you require such then the obvious option is libgbm + GLES.

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

Re: Recommendation for an alternative to OpenVG for RP4

Thu Aug 08, 2019 1:53 am

Use something like this?
https://www.amanithvg.com/

Is there an open source equivalent?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: Recommendation for an alternative to OpenVG for RP4

Thu Aug 08, 2019 2:41 am

Don't have my Pi4 here.
In the mesa-demos-8.4.0 src folder is an egl folder, in there is oes_vg and openvg folders.
Might be worth looking at them.
I will be now that I found them :D
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

jdonald
Posts: 413
Joined: Fri Nov 03, 2017 4:36 pm

Re: Recommendation for an alternative to OpenVG for RP4

Thu Aug 08, 2019 7:29 pm

Gavinmc42 wrote:
Thu Aug 08, 2019 2:41 am
In the mesa-demos-8.4.0 src folder is an egl folder, in there is oes_vg and openvg folders.
According to GitHub those examples haven't been updated in 8+ years, so would likely fail to account for OpenVG getting stripped from Mesa in 2015.
Gavinmc42 wrote:
Thu Aug 08, 2019 1:53 am
https://www.amanithvg.com/ Is there an open source equivalent?
incognitum pointed out these two incomplete implementations in an earlier topic:
LGPL licensed on top of standard OpenGL: https://github.com/ileben/ShivaVG
BSD licensed on top of OpenGL ES: https://github.com/micahpearlman/MonkVG

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

Re: Recommendation for an alternative to OpenVG for RP4

Fri Aug 09, 2019 3:06 am

Yep I had run into Shiva and Monk but with Ultibo and OpenVG I had no need for them.
But I have no idea how Ultibo and AJStarks do that OpenVG magic either.

Now how do I do OpenVG on a Pi4?

Without a VC6 manual I cannot check to see if the VG primitives still exist?
Control codes ID 41, 42.
I'm pretty sure GL and NV exist, not sure if VG mode does.
I can barely understand a few pages of the VC4 manual anyway ;)

If they are still there then OpenVG is still usable?
Lots still to learn
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

aire39
Posts: 29
Joined: Sat Sep 23, 2017 10:43 am

Re: Recommendation for an alternative to OpenVG for RP4

Sat Aug 10, 2019 4:47 pm

nanovg. This seems to be a nice library that is similar to openvg but uses opengles 2 or 3 for its rendering backend and actually got it to work.

I'm still messing with it as I'm not sure what actually limitations it might have. The project isn't being maintained anymore as well but last bit of activity was about 11 months ago before which is fine for me.

I could see this as potential replacements alongside the ones mentioned above:
cairo-gl - where it can use opengl as it's render backend (supposedly works but can't find a decent example).

I also looked at blend2d but that seems to be a pure cpu solution and and focuses on desktop cpus to be able use avx and sse3. It could potentially support arm neon instruction eventually but it's still and beta and doesn't seem to be a focus at the moment.

I plan to try my luck with nanovg.

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

Re: Recommendation for an alternative to OpenVG for RP4

Sun Aug 11, 2019 12:23 am

Nice find.
Looks like OpenGL and GLES so it should run on all Pi's.
Can that be used without X11?

Even old stuff can still be relevant for OpenVG as it's old too ;)

After seeing what can be done with shader code on Pi4 perhaps OpenVG done by shaders?
Crazy or possible?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

aire39
Posts: 29
Joined: Sat Sep 23, 2017 10:43 am

Re: Recommendation for an alternative to OpenVG for RP4

Mon Aug 12, 2019 4:42 am

Gavinmc42 wrote:

Looks like OpenGL and GLES so it should run on all Pi's.
Can that be used without X11?

It seems like nanovg may be able to work with all pi though I would probably use a pi 2 and up. It also works fine without X11. I'm using it now to create an overlay without using X11.
Gavinmc42 wrote:

After seeing what can be done with shader code on Pi4 perhaps OpenVG done by shaders?

Nanovg uses a shader that was coded into the source code as a string that's used to render all the shapes. You can find that shader under the src/nanovg_gl.h file line 503.

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

Re: Recommendation for an alternative to OpenVG for RP4

Mon Aug 12, 2019 5:17 am

Nanovg uses a shader that was coded into the source code as a string that's used to render all the shapes.
That's cool, but another language to learn ;)

OpenCL is supposed to work now and someone said there are compute shaders.
Probably many ways to skin this cat.

Just ordered my second Pi4 so I can code on one, test on the other.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

rainier
Posts: 3
Joined: Sun Apr 08, 2018 3:04 pm

Re: Recommendation for an alternative to OpenVG for RP4

Fri Aug 16, 2019 3:24 pm

Hi All,

Thanks for the all the information.

Great if nanovg actually works. Has anyone tested this out on the RP4 multiple displays? Also can someone confirm they have actually got this really working on a RP4 & Buster? And even better record the runes to get it to work?

This information would reduce lots of duplication of effort.

Kind regards,

--andrew

aire39
Posts: 29
Joined: Sat Sep 23, 2017 10:43 am

Re: Recommendation for an alternative to OpenVG for RP4

Tue Aug 20, 2019 7:55 pm

rainer wrote:

Great if nanovg actually works. Has anyone tested this out on the RP4 multiple displays? Also can someone confirm they have actually got this really working on a RP4 & Buster? And even better record the runes to get it to work?

Yes, nanovg works. I'm using it in my own project to draw overlays. I found that premake4.lua didn't work for me. I did initially compile it manually with gcc and ar and eventually decided to created a cmakelists.txt file to generate the lib file instead.

I didn't create a cmakelists.txt file for the examples and instead compiled them manually using gcc after creating the nanovg lib file. It was just to make sure it worked.

This was all done on a pi 4 using buster.

Code: Select all

#CMakeLists.txt : located in nanovg root directory
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

project("nanovg")

# add include paths
include_directories(${PROJECT_SOURCE_DIR})

# set nanovg sources
set (NANOVG_SOURCE
     src/nanovg.c)

add_library (nanovg STATIC
             ${NANOVG_SOURCE})

target_include_directories(nanovg PUBLIC
                           ${CMAKE_CURRENT_SOURCE_DIR}/src)

Code: Select all

#build_examples.sh : located in nanovg root directory
mkdir -p build/examples && cd build/examples

for entry in `ls ../../example/*.c`; do
    entry_name=`echo "$entry" | awk -F"/" '{print substr($0, length($0)+1-length($NF))}' | rev | awk -F"." '{print substr($0,length($0)+1-length($NF))}' | rev`
    #echo "$entry_name"
    gcc "$entry" ../../example/demo.c ../../example/perf.c -I../../example -I../../src -L../../ -L.. -lnanovg -lm -lEGL -lGL -lglfw -o "$entry_name"
done

Return to “OpenVG”