gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > how to calculate the viewpoint for double sreen 3D? [solved]

#145727 - Noda - Wed Nov 21, 2007 1:18 am

Hi!

I would like to have the same effect as the introduction of a course in mario kart ds : having a 3D scene using both screen, like if it was a single big one.

I already have the double screen setup for 3D, but I don't have any idea on how to get the bottom screen viewpoint based on the top one to make the continuity between the screens...

Concretely: here is my top screen viewpoint:

Code:

        gluLookAt(0, -2.5, -5.2,
                  0, -4, 15,
                  0.0, 1.0, 0.0);


how to calculate values for the bottom screen from theses?

Thanks.


Last edited by Noda on Wed Nov 21, 2007 4:19 am; edited 1 time in total

#145729 - tepples - Wed Nov 21, 2007 1:38 am

You'll need to pitch the camera down by the equivalent of 280 pixels. (Each screen is 192 pixels tall; the gap between them is nominally 88 pixels.) How large of a field of view are you specifying in glFrustum?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#145731 - Noda - Wed Nov 21, 2007 1:56 am

I only set my view (perspective matrix) with this:

gluPerspective(35, 256.0 / 192.0, 0.1, 500);

then I change the viewpoint in the model_view matrix, as modifying the camera causes problems with specular lightning, but it should not be problematic, right?

#145732 - tepples - Wed Nov 21, 2007 3:47 am

Try pitching the camera down in modelview by 280/192 times the y field of view. In your case, it's 35*280/192 = 51 degrees.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#145735 - Noda - Wed Nov 21, 2007 4:19 am

Thanks, but I finally got the effect working quite right with the following:

Code:

    // tilt camera to make a single screen illusion
    if (!ulGetMainLcd()) {
        glRotateXi(-2 << 4);
    } else {
        glRotateXi(2.5 * 32.0);
    }

    // set camera
    gluLookAt(0, -3.5, -10,
              0, -6, 15,
              0.0, 1.0, 0.0);


;)