richardcgiroux
Posts: 35
Joined: Sun May 15, 2016 1:54 pm

Transparent background

Wed Aug 16, 2017 4:50 am

I am trying to use OpenVG to create a window with a transparent background. I've tried using BackgroundRGB but it isn't transparent.

Any help would be great.


richardcgiroux
Posts: 35
Joined: Sun May 15, 2016 1:54 pm

Re: Transparent background

Wed Aug 16, 2017 2:16 pm

Thank you that did help.

As per the link, I changed line 84 in oglinit.c to:
static VC_DISPMANX_ALPHA_T alpha = {
DISPMANX_FLAGS_ALPHA_FROM_SOURCE,
255, 0
};
I recompiled the library and in my program I set the background using:
backgroundRGB(0,0,0,0)
And I now have a fully transparent background!

Thanks again.

1dot0
Posts: 430
Joined: Mon Nov 28, 2016 12:31 pm

Re: Transparent background

Fri Aug 25, 2017 8:00 am

hello,
if you use Paeryn's fork then you'll have additionally the function
void WindowOpacity(unsigned int alpha)

https://github.com/paeryn/openvg/

That works fine with my openVG on Jessie, but as I just read in the C++ sub-forum, openVG can not be installed properly on Scratch (edit:) Stretch yet.
Last edited by 1dot0 on Sat Aug 26, 2017 8:47 am, edited 1 time in total.

tvjon
Posts: 632
Joined: Mon Jan 07, 2013 9:11 am

Re: Transparent background

Fri Aug 25, 2017 12:38 pm

Scratch?

Do you mean Stretch?

Do you also mean install or just build?

A likely reason for not building is in the Makefile:

INCLUDEFLAGS=-I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads
LIBFLAGS=-L/opt/vc/lib -lGLESv2 -lEGL -ljpeg
FONTLIB=/usr/share/fonts/truetype/dejavu

Remove ttf- from the dejavu filename

Simon Hyde's Piclock program builds & runs fine on Stretch.

piclock.jpg
piclock.jpg (57.06 KiB) Viewed 5389 times

User avatar
Paeryn
Posts: 2225
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Transparent background

Fri Aug 25, 2017 4:49 pm

1dot0 wrote:
Fri Aug 25, 2017 8:00 am
hello,
if you use Paeryn's fork then you'll have additionally the function
void WindowOpacity(unsigned int alpha)

https://github.com/paeryn/openvg/

That works fine with my openVG on Jessie, but as I just read in the C++ sub-forum, openVG can not be installed properly on Scratch yet.
WindowOpacity() doesn't give you a proper fully transparent background with solid graphics, it changes the opacity of the entire OpenVG window so you can see what is behind it. At some point I'll put in an option to choose whether it uses the original per-pixel alpha or my modified single alpha value for entire window. I'm not sure if it's possible to alter it between the two methods once the window is open.

My most recent branch (rendertarget) allows creation of sub-windows and drawing to images but it's not documented yet as it's work-in-progress and has a few oddities.

I'll look into the Stretch issue when I can, I don't know how dependant it is on having the older versions of libpng and libjpeg that we have in Jessie.
She who travels light — forgot something.

1dot0
Posts: 430
Joined: Mon Nov 28, 2016 12:31 pm

Re: Transparent background

Sat Aug 26, 2017 8:48 am

Scratch?
Do you mean Stretch?
haha, yes, sure, Stretch :D

1dot0
Posts: 430
Joined: Mon Nov 28, 2016 12:31 pm

Re: Transparent background

Fri Sep 08, 2017 6:13 pm

is there already a revision of openvg for Stretch within the range of vision? ;)

User avatar
Paeryn
Posts: 2225
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Transparent background

Fri Sep 08, 2017 6:38 pm

I'll see if I can repurpose an SD card to put Stretch on over the weekend and check what needs changing. All my spare SD cards are old ones that are too small (and the big ones are full size, not micro) but I might be able to swap one of them with the 32G card in my tablet.
She who travels light — forgot something.

1dot0
Posts: 430
Joined: Mon Nov 28, 2016 12:31 pm

Re: Transparent background

Wed Nov 15, 2017 7:54 pm

hi,
are there already some news, updates, or fixes about openvg installation to Stretch?

User avatar
Paeryn
Posts: 2225
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Transparent background

Wed Nov 15, 2017 8:18 pm

Sorry, not updated my fork of libshapes yet (only updated to Stretch last week), you just need to change the library names that it links against.

In the Makefile change

Code: Select all

-lGLESv2 -lEGL
to

Code: Select all

-lbrcmGLESv2 -lbrcmEGL
Stretch has libjpeg9 available which is fine (Jessie only had libjpeg8 in the main repo), I think libjpeg8 is still available if you want but libshapes works with either.
She who travels light — forgot something.

1dot0
Posts: 430
Joined: Mon Nov 28, 2016 12:31 pm

Re: Transparent background

Fri Nov 17, 2017 10:49 am

thank you very much!

Return to “OpenVG”