I'm trying to get the blend of two images to work without luck.
I have a render target on which I have an object, then I want to render again the same object in same position but with different light condition. My goal is to add the result of this two render so I tried to do something like:
glEnable(GL_BLEND);
glBlendFunc (GL_ONE , GL_ONE);
....
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
render on render target A
change light condition
do not clear now
render on render target A again with new light condition
glDisable(GL_BLEND);
display render target A
I am surely missing something because not only just the first image shows, but the object is transparent.
I am extremely sorry if the question is stupid but I'm very new to such things. Thank you.
edit Following the answer of @Sam Johnston I've edited my code but, although I solved the transparency, the results are not added (to make sure of this I render one with a completely red light and one with a green light) together, but I get just the first render as result:
glEnable(GL_BLEND);
glBlendFunc (GL_ONE , GL_ZERO);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
render on render target A
change light condition
glBlendFunc (GL_ONE , GL_ONE);
do not clear now
render on render target A again with new light condition
glDisable(GL_BLEND);
display render target A
Have I misunderstood the answer?
Juan