2 fullscreeen viewports on 2 monitors

Hey all!

long time since my last post :eek:

I have the following problem:


Windows, nvidia GF4+ with 2 monitors attached.

I need a method of creating 2 viewports. both in fullscreen. first VP on monitor1, second VP on monitor 2. no GLUT or librarys. just plain windows.h :slight_smile:

so I want to render the scene from, lets say, someone who sits in a car and drives on a road on monitor1 and render the scene from an external viewer who looks at this car. the scene-management isn’t the problem. my problem is:
Creating the 2 Viewports, fullscreen, each on a separate monitor. Can I use GL_FRONT_LEFT and GL_FRONT_RIGHT buffers for that :confused: ?

thanks for help!


The common method in professionnal visual systems to set up multiple viewports is to use mutiple PCs … each being connected on a LAN and recieving a network message asking to render a frame from a certain position.

If you’re stuck with a single PC, I can’t help as I don’t know your answer …


I think, I could be wrong, that you need to create a window & Context on each of the monitors & then set each to fullscreen. So basically you create two windows, with the second one positioned at coordinates that will put it on the second monitor (Eg. 1024, 0 if you are running at 1024x768) - or you specifically tell the system that the new window will be created on the second monitor (I haven’t looked into this).

A simple test is to create a single window, and set it to fullscreen, as you normally would and see what happens (does it span the two monitors etc). Then create the window on the second monitor and do the same. Finally, combine the two and create both windows (assuming it works as expected).

You need to initialize a 2048x768 window (2x 1024 x 768). The left part will be (0,0)-(1023,767) and second part is (1024,0)-(2047x767).

execom and rgpc are both right; either way will work.

I’d suggest using the single, very wide, desktop-spanning window, because it means you don’t have to worry about context switching and sharing.

When you render, you first glViewport() and glScissor() to render to the leftmost half of the window; render the driver view; then glViewport() and glScissor() to render the rightmost half; render the outside view; then SwapBuffers().