View Full Version : HELP! Stereo rendering using OpenGL
05-04-2004, 05:23 AM
Hello, everybody. My current job is to a build projection-based stereo rendering system. Now I encountered a cumbersome problem. I want to create a single window (2048*768) and display two 1024*768 side-by-side images into that window. The two image are obtained by viewing from a slightly different angle at a certain object (just like from left eye and right eye).
I've no idea how to cope with this. Any commment will be very much appreciated. Thank you!!
OpenGL handles this with the use of different buffers. A good place to start is glDrawBuffer() which selects one of different buffers to draw on.
A few of them might interest you, GL_LEFT and GL_RIGHT. I think they are used for stereo viewing. Have never tried it myself, but maybe you only need to change your call to glFrustum before you draw to each buffer and that should be it. Of course I've no idea where these buffers drive their output.
Anyway that's all I could do, hope it helped you a bit.
Another late idea: did you try googling on it? or try a google search in glDrawBuffer, it might get you something. I think also SGI's site or this site might have some code examples for stereo rendering
05-04-2004, 06:22 AM
I could be wrong, but I think the GL_RIGHT drawbuffers are only available on expensive graphics cards like Nvidia's Quadro and Ati's Fire series of graphics boards.
If you do not have such a board, you can solve your problem as follows:
1. change the viewport to the left half of the screen
2. draw your scene
3. change the vieport to the right halve of the screen
4. push the modelview matrix onto the stack
5. PRE-multiply the modelviewmatrix with a horizontal translation
6. draw your scene
7. pop the modelview matrix
05-04-2004, 12:57 PM
Just as said nico, but beware, glViewport does not always limit drawing (ie some ATI recent cards). Use glScissor along, to be sure.
05-07-2004, 03:35 AM
As I do not have a quad-buffer graphics card, I think I will try the way suggested by NiCo. Thank you very much, eveyone!
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.