Advertisement

Stereo Rendering With Two Viewports

Started by November 25, 2004 05:38 PM
3 comments, last by Steve132 20 years ago
How is this possible? ive had a look about on the net, does opengl have left and right buffers or something? do i use those? does anyone no of any executable examples? cheers
It should have, but i don't know how to use them.
But it's equally easy to first render to one viewport, then to the other one.
Advertisement
I added support for that in a later patch to my nehe creative entry, but it's closed source.

It's pretty simple to do really.
Either a)
create two windows, one on each monitor
or b)
create an extra wide window that spans both monitors (say, 1280x480 if each mon is 640x480).

With two viewports, or two seperate windows, just render the scene to each, but with a slight bias to the camera position either left or right.
Getting the bias distance right is probably one of the hardest things, as it's not really something you could measure, depends on the screen it's being projected to or the head set your using, etc.
I forgot to mention,
using the left/right buffers requires special hardware, for example a quadro or firegl card.
Quote: forgot to mention,
using the left/right buffers requires special hardware, for example a quadro or firegl card.


Actually, it is very easy. If you want to put 3D stereo in your games, make sure you download and install the latest nvidia Stereo drivers for your gfx card. I am positive that ATI has an equivilant as well. On my geforce 4MX, these drivers not only make it automatic to "stereofy" standard opengl 3D calls, so that you won't have to put any extra code to see in 3D (anaglyph or shutter LCD), but they also allow you to access openGL's standard stereo buffers through a call to glDrawBuffer(GL_BACK_LEFT) or glDrawBuffer(GL_BACK_RIGHT).

Be careful, because accessing the buffers like that only applies for bitmap rasterization options like glDrawPixels(), (if you want to say write a stereo 3D picture or movie viewer). If you don't have a need to directly write stereo data to the framebuffer, but instead just want to see one of your OpenGL projects in 3D, just stick with the code that you have right now, and activate the stereo driver. its a snap.

For best results, check out NVIDIA stereo programming
and also glimage.c

good luck!

This topic is closed to new replies.

Advertisement