Page 1 of 1

Unable to find a config with an alpha mask

Posted: Sun Jun 04, 2017 1:13 pm
by natinusala
Hello everyone,

I'm trying to find a config with an alpha mask (to use shapes as a mask when drawing images). This is my current config :

Code: Select all

const EGLint attribute_list[] =
   {
      EGL_RED_SIZE, 8,
      EGL_GREEN_SIZE, 8,
      EGL_BLUE_SIZE, 8,
      EGL_ALPHA_SIZE, 8,
      EGL_DEPTH_SIZE, 16,
      EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
      EGL_NONE
   };
With this configuration, OVG works fine, but obviously this has no support for the alpha mask. I've tried to change the configuration to this :

Code: Select all

const EGLint attribute_list[] =
   {
      EGL_RED_SIZE, 8,
      EGL_GREEN_SIZE, 8,
      EGL_BLUE_SIZE, 8,
      EGL_ALPHA_SIZE, 8,
      EGL_DEPTH_SIZE, 16,
      EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
      EGL_ALPHA_MASK_SIZE, 8, 
      EGL_NONE
   };
But when I do this, eglChooseConfig returns VG_FALSE, with no error (EGL_SUCCESS error code).

Why is that ? How can I have an alpha mask to my surface ? Thanks :)

Re: Unable to find a config with an alpha mask

Posted: Sat Jul 08, 2017 11:18 pm
by Paeryn
I know this is a bit of a late reply (only just seen the post).

Why are you asking for a 16 bit depth buffer in OpenVG? OpenVG is 2D only so a depth buffer makes no sense, take that out and you should be allowed the alpha mask. eglChooseConfig() failed when you asked for both a depth buffer and an alpha mask buffer because there is no config that has both a depth buffer and an alpha mask buffer. If you had queried the number of configs available matching your attributes you would have seen that there were none.

Code: Select all

const EGLint attribute_list[] =
   {
      EGL_RED_SIZE, 8,
      EGL_GREEN_SIZE, 8,
      EGL_BLUE_SIZE, 8,
      EGL_ALPHA_SIZE, 8,
      EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
      EGL_ALPHA_MASK_SIZE, 8,
      EGL_NONE
   };

Re: Unable to find a config with an alpha mask

Posted: Sat Jul 08, 2017 11:21 pm
by natinusala
This is because it's a shared config for both VG and GL : I'm using two contexts to draw on the same surface (I swap with eglMakeCurrent).

Should I use a pbuffer to draw my VG stuff to a GL texture instead ? This way I can keep two surfaces with the configuration for each context (depth for GL and alpha for VG)

Re: Unable to find a config with an alpha mask

Posted: Sun Jul 09, 2017 12:17 am
by Paeryn
natinusala wrote:This is because it's a shared config for both VG and GL : I'm using two contexts to draw on the same surface (I swap with eglMakeCurrent).

Should I use a pbuffer to draw my VG stuff to a GL texture instead ? This way I can keep two surfaces with the configuration for each context (depth for GL and alpha for VG)
Ahh... Yes, you'll have to use pbuffers in that case.

Re: Unable to find a config with an alpha mask

Posted: Sun Jul 09, 2017 11:35 am
by natinusala
Well that's what I thought. Thanks !

Will it impact the performances a lot ?

Re: Unable to find a config with an alpha mask

Posted: Sun Jul 09, 2017 12:48 pm
by Paeryn
natinusala wrote:Well that's what I thought. Thanks !

Will it impact the performances a lot ?
Not overly I wouldn't think. I've only done OpenVG drawing into a VGImage but no tests as to the speed of it (a static one-time draw into the VGImage right at the start and then using the image multiple times).

Re: Unable to find a config with an alpha mask

Posted: Sun Jul 09, 2017 2:16 pm
by natinusala
So far with what I've tested, drawing full resolution VGImages quite slows down the app, I wonder if it's the same for GL textures. I'll have to test it anyway, thanks for the help !