I have a rather simple problem that I am positive has a simple solution. I am rendering a quad twice as two layers, each with a color. The first is green, the second is red. I am using the alpha channel of the color component for the quad's vertices to blend the two colors together across the quads.
Attached bellow are two images. Image A is how it looks when rendered with OpenGL, image B is how it should look. The black color in image A is the background bleeding through. If OpenGL interpolated the color values linearly there would be no bleeding, it would be a nice transition from red to green and no black would show. But that's obviously not the case.
I've tried using a GLSL program and setting the color variable to noperspective but it makes no difference. Is there a way to force OpenGL to do plain linear interpolation of my vertex colors, so that the red and green blend evenly across the quad like in image B?
Additional information:
Red layer alpha values:
1.0 -------- 0.0
| |
| |
| |
0.0 -------- 1.0
Green layer alpha values:
0.0 -------- 1.0
| |
| |
| |
1.0 -------- 0.0
.
Thanks!