I am trying to implement a desktop 3d model viwer, which means I don’t want to show the anything about window, just a 3d model itself.(windows plateform).
I have tried SetLayeredWindowAttributes(), but that function not only make the window transparency but also make everyting draw in the framebuff transparency.
And that method really decreases the FPS.
By the way, there is anther problem confused me.
unsigned char _Tbuf;
unsigned char _Tbuf2;
the _Tbuf alpha channle always be 255, no matter what alpha value I set. Is that means the framebuff alpha channle is always 255?
1, you should set the alpha bits to get alpha value.
PIXELFORMATDESCRIPTOR pfd; pfd.cAlphaBits = 8;
2, Create a layered window, set the blend function.
BLENDFUNCTION m_blendFunc; m_blendFunc.BlendOp = AC_SRC_OVER; m_blendFunc.BlendFlags = 0; m_blendFunc.AlphaFormat = AC_SRC_ALPHA ; m_blendFunc.SourceConstantAlpha = 0xFF;
3, Render on main windows, then read pixels and update to the layered windows.
UpdateLayeredWindow(m_hWnd, m_hDC, in_pptDst, in_psize, m_hDCMem, in_pptSrc, 0, &m_blendFunc, ULW_ALPHA);
Really thanks to help!
I do forget to set alpha bits. And now I get the correct result.
But what do you mean creat a layer window? I am really newbie for windows programming. I created a window(does it mean main wondow?)then draw 3d primitives on it and create a child window(layer window?)then read pixels from the main window and draw pixels on the layer window?