Posting surface to a window...

I’ve tried to clear surface and post to a window with below implementation using Khononos OpenVG Sample Reference Implementation.

VGfloat clearColor[4] = { 1.0f, 1.0f, 1.0f, 0.7f };
vgSetfv( VG_CLEAR_COLOR, 4, blackcolor );


I think it shows gray color (R = 0.7f, G = 0.7f, B = 0.7f). But the window was filled the white color. It looks like alpha value (0.7f) is ignored.

Please let me wheather alpha value is ignored posting to a window.


First check which config you are using - how many bits for each color channel (are you using RGBA 8888)?
Next check if the eglCreateWindowSurface() succeded [eglGetError() == EGL_SUCCESS].

If all is ok at this point, keep in mind that the default VG blend state is SRC_OVER_DST if memory serves. As such you will be blending the translucent white with the default black background producing a gray color. Try clearing with a different color (like red) to make sure this is not what is happening.

Also I don’t see your call to vgClear(). You need to call vgClear after setting your clear color - just setting the clear color and calling swapbuffers will have no effect.

Good luck.

vgClear does not apply blending, it always overwrites the color in the framebuffer (but clipping and scissoring are still used).

Yes, alpha is not a displayable property (well, at least not with current display technology), thus only the RGB part will be shown on screen.

The code shown is missing vgClear, and “blackcolor” should be “clearColor” instead.