0
Follow
0
View

How to create QOffscreenSurface with alpha?

daybreak30 注册会员
2023-01-25 14:55

Your image viewer displays your image on a white background so you see white or gray. With glClearColor(0, 0, 0, 1) you will see a transparent triangle on a black background:

    glDisable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glBlendEquation(GL_FUNC_ADD);
    glClearColor(0, 0, 0, 1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

but resulting triangle will be partially transparent, so white image viewer background will be partially visible under the triangle.

About the Author

Question Info

Publish Time
2023-01-25 14:55
Update Time
2023-01-25 14:55