How to create a gradient of colours between two different objects (quads)


I have been looking all over trying to figure out how to create a gradient between two different 2D quads that I have created in 3D space.
One of the quads is red and the other is yellow, and I want them to gradient so that they create a seamless object.

I know that I could create the quads as 1 big quad specifying different colours for each vertex, but I am required to plot these two quads separately.
The quads are mapped to external inputs that vary. The colour of the quad changes depending on the input value.

I have tried smooth shading, but that didn’t mix the colours.

Any guidance would be much appreciated.



You’ll want the vertices where the quads connect to have an intermediate color between the two extremes. So if one quad is yellow and the other is red, you want the vertices in the middle to be orange.
If you have (r1, g1, b1) for the two outermost vertices of one quad, and (r2, g2, b2) for the outermost vertices of the other quad, then the color of the inner vertices ought to be ((r1 + r2)/2, (g1 + g2)/2, (b1 + b2)/2)).

I’m new to OpenGL, though, so that might be wrong, but it’s correct to the best of my knowledge.