I am trying to invert the colors of items in a specific area of my screen that currently has a picture drawn on it using glDrawPixels using GL_BLEND using the following code:
glEnable(GL_BLEND); glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO); //draw rectangle glDisable(GL_BLEND);
Later on in the same scene, I want to draw a transparent rectangle using the following code:
glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); //draw the rectangle glDisable(GL_BLEND);
What I am finding is that the code works, but not together. Once I have created the semi-transparent rectangle, the inverted color rectangle ends up behind the scene and no longer inverts anything but the clear color.
I am drawing in the following order: glDrawPixels -> Invert Rectanlge -> semi-transparent rectangle
Can anyone help me figure out what I am doing wrong?