OpenGL transparent window(OpenGL半透明窗口)

1)在OpenGL渲染的窗口中使用半透明效果和普通窗口没有什么区别

 SetWindowLong(  m_hWnd, GWL_EXSTYLE,WS_EX_LAYERED );           
 SetLayeredWindowAttributes( 0, 240, LWA_ALPHA);//alpha = 240,范围0~255;也可以使用关键色,详见MSDN

2)OpenGL半透明窗口指的是覆盖窗口(WS_OVERLAPPED或者WS_POPUP ,其实只要不是WS_CHILD就可以,因为WS_OVERLAPPED为0 ),

而不是Blend,不要一看到半透明就想到Blend,Blend是图元和帧缓存的混合,没有任何理由混为一谈。

3)WS_EX_TRANSPARENT

     Hit Testing

     Hit testing of a layered window is based on the shape and transparency of the window. This means that the areas of the window that are color-keyed or whose alpha value is zero will

     let  the  mouse messages through.

     If the layered window has the extended window style, the shape of the layered window will be ignored and the mouse events will be passed to the other windows underneath

     the layered window.

     使用WS_EX_TRANSPARENT 风格的窗口,对于关键色,或者ALPHA为0的像素将忽略鼠标命中测试; 如果同时也使用了WS_EX_LAYERED ,将会导致忽略所有鼠标事件。

     MSDN: Win32 and COM Development/Technical Articles/User Interface/User Interface Design and Usability/Layered Windows

 

 

 

posted on 2008-11-17 00:37  cgwolver  阅读(4120)  评论(0编辑  收藏  举报

导航