Hey everyone
I am programming a small drawing app on the iphone and ran into a little problem. I am using ofxFBOTexture and are drawing on two different FBO’s when i print them on the screen with and alpha it look correct (left on the picture). When i try to merge the two into one FBO the alpha looks strange (right picture). The picture is an example where the horisontal line is the one i want to merge with and alpha channel. On the left i am drawing the two fbo’s on top of each other on the other i am drawing one fbo into the other.
Code snippets:
Drawing multiple FBOs on top of each other creates the alpha blending i want:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
myTex.draw(0, 0);
for(int client = 0; client < 5;client++)
{
ofSetColor(
datas[client]->myColor.r,
datas[client]->myColor.g,
datas[client]->myColor.b,
datas[client]->myColor.a
);
datas[client]->myTex.draw(0,0);
}
Merging the two fbos gives med the wrong alpha:
myTex.begin();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
ofSetColor(
datas[tmpMessage->clientId]->myColor.r,
datas[tmpMessage->clientId]->myColor.g,
datas[tmpMessage->clientId]->myColor.b,
datas[tmpMessage->clientId]->myColor.a
);
datas[tmpMessage->clientId]->myTex.draw(0, 0);
myTex.end();
datas[tmpMessage->clientId]->myTex.clear(0, 0, 0, 0);
datas[tmpMessage->clientId]->touchDown = true;
Does anybody have an idea of what i am doing wrong?