PDA

View Full Version : glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE) can not work with PFD_DOUBLEBUFFER?



xunhuan
11-07-2003, 11:12 AM
Hello,

I tried glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE) with PFD_DOUBLEBUFFER on.
It doesn't work. When I change it to single buffer, it works.

Anybody met such problem?

Tzupy
11-10-2003, 09:42 AM
Hi,
I have to check, but it looks like that: when you're requesting double-buffer, you're not getting the alpha bitplanes anymore, so no blending can occur. Have you tried double-buffer with other blending settings?

xunhuan
11-11-2003, 12:18 PM
Originally posted by Tzupy:
Hi,
I have to check, but it looks like that: when you're requesting double-buffer, you're not getting the alpha bitplanes anymore, so no blending can occur. Have you tried double-buffer with other blending settings?

Thank you for your reply.

Actually, I tried the (GL_SRC_ALPHA, GL_ONE) and (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), the blending seems work. However, when I use the (GL_SRC_ALPHA_SATURATE, GL_ONE), there is nothing except the background color.
This is my code segment:

glClearColor(1.0, 0.0, 0.0, 0.0);
glColor4f(0.0f, 1.0f, 0.0f, 0.5f);

glDisable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT);

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
// glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);

glBegin(GL_POLYGON);
glVertex3f(-4.0f, 0.0f, -4.0f);
glVertex3f(4.0f, 0.0f, -4.0f);
glVertex3f(4.0f, 0.0f, 4.0f);
glVertex3f(-4.0f, 0.0f, 4.0f);
glEnd();

glFlush();

SwapBuffers(hDC);


Best regards.

xunhuan
11-11-2003, 02:35 PM
Originally posted by Tzupy:
Hi,
I have to check, but it looks like that: when you're requesting double-buffer, you're not getting the alpha bitplanes anymore, so no blending can occur. Have you tried double-buffer with other blending settings?

You are right. I googled this problem, it seems like this blend function needs a destination alpha bitplane in the frame buffer. And at least it's not supported in the PIXELFORMATDESCRIPTOR.

I tried to use this blend function to draw antialiased polygon. Right now the best way I figured out is that first draw the polygons without antialiasing, then redraw all the edges with antialiased lines.

Cheers.