PDA

View Full Version : two viewports sharing same modelspace



05-25-2004, 05:00 PM
is it possible to have two viewports defined that share the same model space, im putting toghter a very very basic two wall cave setup where the screens are at 90deg to each other. Iw was planing to have 1 wide window with two viewports defined to each screen size on the dual view card, but of course for the model to look like its in the middle there has to be an overlap as the model transitions from 1 viewport to the other, so how can two viewports share an overlaped model space ??

mikael_aronsson
05-25-2004, 11:12 PM
Hi !

You can have any modelview matrix you want in each viewport, they are independant of each other.

Just setup the viewport and then the projection and modelview matrix, render what ever you want to it, setup the other viewport, projection matrix, modelview matrix and render all your objects again.

Mikael

05-26-2004, 12:37 AM
thanks for that, any idea on how yo get a seamless transition of an object, say for example going left to right as it leaves viewport 1, it enters viewport 2 by the exact same amount

dvm
05-26-2004, 01:29 AM
Maybe you could try a different glFrustum in each viewport. I remember an older post in this forum (search for glFrustum) that talked about: "hey, you can mimic a left eye only view of the world". So maybe you can set your glFrustum like:

//left viewport
glFrustum(-200, 0, -200, 200, 10, 100);
//right viewport
glFrustum(0, 200, -200, 200, 10, 100);I'm not sure if it can help, but give it a try (and try searching the forum for glFrustum, I think the poster's name was Bob.

ZbuffeR
05-26-2004, 10:35 AM
The code shown by Moucard seem correct for the case where the two screens are on the same plane.

If the screens really are at 90 to each other, the correct method would be to track the viewer's head position and use it as each fustrum origin.
Of course, the simpler would be toapproximate that by assuming the viewer is at the middle of the 'cube'. Draw the setup on paper, it can help you place each fustrum correctly.

something like this bad ascii art :


Right screen
L*-----------*
e| . .
f| . f2 .
t| . .
| f1 X
s| . Viewer
c| .
r| .
*

dorbie
05-26-2004, 09:35 PM
Just remember that the view vector should be at right angles to each screen. The view position should be the same for both screens and the frustum should be determined by the physical relationship of the viewer to the display surface.

ZbuffeR
05-27-2004, 02:18 AM
Another forum bug ???
How come dorbie's post is after mine but have an earlier date ???

/me is puzzled :eek:

05-27-2004, 03:51 AM
thanks muchly, this is all good advice