Single window, dual viewport: How?

I’m brand spankin’ new to OpenGL so I apologize for cluttering up the forum, but:

I want to create a single window, 512x256 with two viewports each 256x256. I want to render a solid object in the right viewport, and a wireframe object in the left viewport, both displayed at the same time. I can do one viewport that fills the entire window, but how do what I want?

Thanks in advance.

Use glViewport.

Yes, I knew to use glViewport. I performed a search and was able to find the answer I needed.

New question though: I have two viewports going each with their respective objects, however, the aspect ratio is whacked right from the get go, the square are tall and narrow. How do I manage to the aspect correct working within two viewports?

Secondly, on resizing of the window, I don’t want anything to change except the window. Like a window in your home, if you shut the blinds halfway, you only see out half the window now. That’s what I want to do.

Thanks in advance.


Okay, now I can do all that.

Now I do want everything to resize along with the window resize.

So the question is how do you maintain proper aspect ratios with two viewports?
One viewport is no problem but two?

Thanks in advanced.