How to make openGL ES2 background transparent

819 Views Asked by At

I use PowerVR sgx sdk and the hardware platform is a Ti DM8168 chip with linux running on it.I make a openGL ES2 demo and found that the background of openGL demo is always black.I also compile QT lib with openGL sdk and make a Qt demo with QGLWidget, but the background of QGLWidget is also black.

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);deoes not work.

first open fb0,and paint something.

then open GL painting.This will cover the whole screen.

In Qt demo, the QGLWidget always has a background cover the Widget behind it.Qt interface can not affect the openGL showing.

The powerVR demo didnot talk about this.It seems a tough thing on The embedded system.

I want that like this picture, the background is a Qwidget menu, and the square is openGL object in QGLWidget and back ground of QGLWidget is transparent.

Father, the QT always directly rend the openGL screen, so the rending content cover the framebuffer where other under layer widgets show.

enter image description here

1

There are 1 best solutions below

1
On

It is not tough and is possible. An OpenGL(ESx) application, always draws either to a (fullscreen) framebuffer (when using NULL window system and a standalone openGLESx application), or to a Qt window, when using QWS as in your case.

To be able to make this window transparent, you can do below:

(1) Draw whatever you need to be transparent, onto one of the planes in DSS of DM8x

(2) Draw the background (non transparent) frame to the lower plane in DSS

Now you can use global Alpha setting for each plane to manage how the top layer is visible. Refer to below thread for an example of this approach.

http://e2e.ti.com/support/embedded/linux/f/354/t/70597.aspx