View Full Version : How to maintain multiple viewports?

06-01-2015, 09:25 AM

I need to display a triangular mesh along with the scales (axes representing coordinates of the mesh) on all four sides. Thus, I would like to restrict the display of a triangular mesh inside that rectangle. One way what I found was, to display four axes as a two-dimensional objects with viewport of window size. i.e.

glViewport(0, 0, w, h);

Next the mesh is displayed by changing the viewport,

glViewport(left_margin, bottom_margin, right_margin, top_margin);

I have done this with a single projection (glOrtho). But with this approach, the aspect ratio is not maintained for the second viewport. So my question is, how to maintain the aspect ratio of multiple view-ports along with a single projection?