开发者

Save OpenGL output with Alpha?

开发者 https://www.devze.com 2023-01-02 23:11 出处:网络
Right now I\'m drawing a cube with OpenGL, I\'m using Windows and WGL context. I have blending enabled so my cube looks semi transparent. Basically the background == the clear color (Black). I\'d like

Right now I'm drawing a cube with OpenGL, I'm using Windows and WGL context. I have blending enabled so my cube looks semi transparent. Basically the background == the clear color (Black). I'd like to be able to save the image in raw RGBA format which I can then make into a png. I basically want the cube to blend in with a NULL background (0,0,0,0). How could I save the OpenGL output开发者_运维问答 and have the background color be (0,0,0,0) (transparent) Without using a color mask (like 255,0,255).

Thanks


Just draw the cube, setting the clear color to (0, 0, 0, 0), and save the output using glReadPixels.

0

精彩评论

暂无评论...
验证码 换一张
取 消