Here is a picture of what I have so far.
Don't worry about the gaps between the black quads. My issue is with stuff like what happens where the red, green and blue areas touch. You can see that one quad is behind the green triangle, and another is partly behind the blue triangle but in front of the green triangle.
This all happens because I take 3 triangles (red, green and blue) and tessellate and deform them in the tessellation shaders, then draw the quads in the geometry shader. The quad is always drawn after the triangle it is attached to, but they always go together, so the next triangle generated by tessellation will be above the previous quad.
My question is, is there a way to avoid this besides using two different shader programs? It seems like transform feedback might work, like rendering the triangles to one buffer and the quads to another and combine them later. Would that work? Would it be faster than switching shaders? (Or sometimes faster) Any other ideas?
EDIT: Sorry I am making my question harder. Eventually when I get the quads fixed the edges will be alpha blended to do antialiasing. So ideally an answer would work in that scenario.
EDIT 2: In the final version the three colored triangles will be considered together. Eventually they might all be part of the same gradient or share a texture, in the near term they will always be the same color. (The colors are there now just to help me figure out what is going on.) So some tricks could be done by giving the color information to the quads in the geometry shader to help in the alpha blending mentioned above. This might allow the depth buffer to be used. Sorry for not giving all the information earlier, I am not used to asking such open-ended questions.