我正在使用 wx 在 wxGLCanvas 上绘制一个信息窗口。我希望能够淡出该窗口,以便它与 OpenGL 渲染的图像进行 Alpha 混合。有办法做到这一点吗?
我试图不绘制重叠小部件的背景,但我只得到一个白色矩形。我也尝试使用 wxGraphicsContext,但没有成功。
我的下一个想法是在 MemoryDC 中绘制窗口并在 OpenGL 中合成图像,但这会阻止用户与窗口中的任何内容进行交互(至少通过传统方式)。任何提示将不胜感激。我正在使用 Windows 7 和 wxPython。
I'm drawing an informational window using wx over a wxGLCanvas. I want to have the ability to fade that window so it is alpha blended with the image rendered by OpenGL. Is there a way to do this?
I have tried to not draw the background for the overlapping widget, but I only get a white rectangle. I tried to use a wxGraphicsContext as well, with no success.
My next thought is to draw the window in a MemoryDC and composite the images in OpenGL, but that would prevent interaction from the user with anything in the window (at least through conventional means). Any tips would be appreciated. I'm using Windows 7 and wxPython.
发布评论
评论(1)
wx.Frames 有一个 SetTransparent 方法,可以接受 0-255 之间的值,其中 0 表示完全透明,255 表示完全不透明。我不确定这是否是您想要的,但如果是,这里有一个关于该主题的教程: http://www.blog.pythonlibrary.org/2008/04/14/doing-a-fade-in-with-wxpython/
wx.Frames have a SetTransparent method that can accept a value from 0-255, with 0 being completely transparent and 255 being completely opaque. I'm not sure if that's what you're going for or not, but if it is, here's a tutorial on the subject: http://www.blog.pythonlibrary.org/2008/04/14/doing-a-fade-in-with-wxpython/