Skip to main content
gamedev.net
🔒 Locked

transparent background rendering

Started by wlb2001 Apr 24, 2009 at 2:44 AM 1 replies 500+ views
Original Post
wlb2001
wlb2001
Hi there! 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. glClearColor(0,0,0,0); unsigned char _Tbuf[40000]; unsigned char _Tbuf2[40000]; memset(_Tbuf2,0,40000*sizeof(unsigned char)); glDrawBuffer(GL_BACK); glDrawPixels(100,100,GL_RGBA,GL_UNSIGNED_BYTE,_Tbuf2); glReadBuffer(GL_BACK); glReadPixels(0,0,100,100,GL_RGBA,GL_UNSIGNED_BYTE,_Tbuf); the _Tbuf alpha channle always be 255, no matter what alpha value I set. Is that means the framebuff alpha channle is always 255? Thanks.
Brother Bob
Brother Bob
If you're not asking for an alpha channel for the frame buffer when defining the pixel format, you may not get one. If you don't have one, any read of the alpha channel will return 1.0 (or 255 for 8-bit integers). Check your alpha bits with glGetInteger and GL_ALPHA_BITS.
wlb2001
wlb2001
Really thanks for the help! I do forget to set the alpha bits when i set the pixelformat. Now I got the right result. But the problem is, I still didn't get an transparent background, even the alpha value in framebuffer is 0. So what can I do now?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.