If I make a blue rectangle with a certain transparency, and a red rectangle on top of it with the same transparency
I get a purple rectangle where the two rectangles are on top of each other.
(See image below)
Now I need the blue and red rectangle without the purple part.
They should have the same transparency. So my tought was to write this to a buffer without transparency, so the blue rectangle isn’t visible.
And write the buffer with the transparency at once to the screen.
Each rectangle is from a Rectangle-class. The Rectangle-Class holds the function Draw.
This function has the following code
glEnable(GL_SAMPLE_ALPHA_TO_MASK_EXT); glPushMatrix(); glBegin(GL_QUADS); glColor4ub(penColor1.red(), penColor1.green(), penColor1.blue(), alpha); glVertex2f(start.rx(), start.ry());
I looked on the internet but couldn’t find any solution.
I have fully supported OpenGL 2.0