PDA

View Full Version : Filling circle



11-21-2003, 04:08 AM
Hi,

I am new to OpenGL. I have written a simple program of drawing 2 circles on a view (I am using MFC). Following is the code :

glPolygonMode(GL_FRONT,GL_FILL);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ZERO);
glColor4f(1.0f, 0.0f, 0.0f, 0.0f);
glPushMatrix();
{
glTranslatef(-0.25f, 0.4f, 0.0f);
myCircle(W,'A');
}
glPopMatrix();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0f, 1.0f, 0.0f, 0.5f);
glPushMatrix();
{
glTranslatef(0.25f, 0.4f, 0.0f);
myCircle(W,'B');
}
glPopMatrix();

This should draw a red circle, then an overlapping green circle. Color of overlapping region will be different as blending is enabled.

This works fine my system. But when I tried it on other system, the circles are filled with varying colors. Second circle even have some red color (in non-overlapping area).

What may be the cause for this inconsistency accross the system.

Thanks in advance