GL Viewport and side by side 3D/stereo

volkerk's picture

I'm working on a passive stereo viewer (with two projectors and polarized filters/glasses) in QC. An easy way of doing this is with a matrox dual head2go, it makes a mac think there is one screen with for instance 2048x768 pixel resolution. With the QC stage set to 8:3 aspect ratio it is simple to generate side by side stereo imagery, in theory with the GL Viewport patch. Here I came across a problem with aspect ratio. If the width is not set to the width of the rendering dimension (but to half of it to generate left/right image) the 3D objects are squeezed horizontally. Is this a OpenGL viewport "feature" or is it the implementation as a QC plug in.

I attached an example

v.

PreviewAttachmentSize
gl_viewport.qtz3.76 KB

cwright's picture
Re: GL Viewport and side by side 3D/stereo

That's how Viewport works (we just use glViewport internally -- no magic). This happens because QC's projection matrix still expects the fixed aspect ratio size, so if your viewport doesn't have the same aspect ratio, things get stretched/squished. It's possible to replace the projection matrix with our own, but that takes some additional matrix math that I'm not in a hurry to try ;)

You could try using the Scissor patch -- that'll disable drawing to various portions of the screen, without modifying the aspect ratio.