Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 9 of 9

Thread: stereo viewing

  1. #1
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    stereo viewing

    I have enabled the stereo viewing in my PIXELFORMATDESCRIPTOR structue. I have used from the instructions suggested by *Advanced graphics programming with OpenGL*:
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity(); /* the default matrix */
    glPushMatrix()
    glDrawBuffer(GL_BACK_LEFT)
    gluLookAt(-IOD/2.0, 0.0, EYE_BACK,
    0.0, 0.0, 0.0,
    0.0, 1.0, 0.0);
    <viewing transforms>
    <modeling transforms>
    draw()
    glPopMatrix();
    glPushMatrix()
    glDrawBuffer(GL_BACK_RIGHT)
    gluLookAt(IOD/2.0, 0.0, EYE_BACK,
    0.0, 0.0, 0.0,
    0.0, 1.0, 0.0);
    <viewing transforms>
    <modeling transforms>
    draw()
    glPopMatrix()

    I believe that nothing is wrong in my code. But the result is too bad.Actually i see two independet objects and it's not like a thing that our eyes see.When i decrease the value of IOD-As an example to 0.5-Then i see the problem that is occured in decaling a picture on another picture.The resulting scene in this case is like a scene that a cross eyed person sees!
    -Ehsan-
    <span style="color: #006600">-Ehsan-</span>

  2. #2
    Intern Newbie
    Join Date
    Feb 2005
    Location
    burton-on-trent [england]
    Posts
    35

    Re: stereo viewing

    what's the value of EYE_BACK?



    sounds like you're not actually far enough away from the geometry to focus properly

  3. #3
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    Re: stereo viewing

    I'm a bit confused. When i disable these lines:

    glDrawBuffer( GL_BACK_LEFT );
    glDrawBuffer( GL_BACK_RIGHT );

    The resulting scene doesn't change!
    (I have declared the PFD_STEREO flag in my PIXELFORMATDESCRIPTOR structure )

    In my program:
    IOD = 0.5
    EYE_BACK = 10

    And i have used from the following view volume:
    gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);

    -Ehsan-
    <span style="color: #006600">-Ehsan-</span>

  4. #4
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    4,388

    Re: stereo viewing

    Your inter pupil translation needs to happen in eye space. That means it will vary in orientation with heading. Just positioning the eye with a translate on x in the lookat call will not support the view being rotated.

    In addition to this you need to set up an asymmetric projection that corresponds to the viewer's relationship to the display.

    So before you do your lookat apply the inter pupil distance as a translate to the modelview on the X axis, the glLookat should be exactly the same for both eyes.

    Next consider the difference this translate makes to an eye in front of the display, and make the ajustments to the glFrustum left and right parameters when you set the projection.

    Do this and will work perfectly if you get the numbers right.

    FYI most people totally screw this up, this is the correct way to do stereo on most displays, deviation from this is almost always wrong.

  5. #5
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    Re: stereo viewing

    Thanks.I'll try to do your instructions
    -Ehsan-
    <span style="color: #006600">-Ehsan-</span>

  6. #6
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    Re: stereo viewing

    I understand that SetPixelFormat() cannot set the PFD_STEREO. When i use from the following code, i see the error message:

    if( PixelFormat = GetPixelFormat( hDC ) )
    {
    DescribePixelFormat( hDC, PixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd );
    if( (pfd.dwFlags & PFD_STEREO) == 0 )
    {
    KillGLWindow();
    MessageBox(NULL,"Stereo viewing failed","ERROR",MB_OK|MB_ICONEXCLAMATION);
    return FALSE;
    }

    But why?My graphics card is GeForce4 MX 4000. It should support it.Should i change some settings of my graphics card?
    -Ehsan-
    <span style="color: #006600">-Ehsan-</span>

  7. #7
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: stereo viewing

    I though real stereo support was only enabled in the Quadro professional cards.

  8. #8
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: stereo viewing

    >>But why?My graphics card is GeForce4 MX 4000. It should support it.Should i change some settings of my graphics card?<<

    No, GeForce boards don't support stereo pixelformats.

  9. #9
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    Re: stereo viewing

    Awww.That's too bad. Thanks for your replies.
    -Ehsan-
    <span style="color: #006600">-Ehsan-</span>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •