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 3 of 3

Thread: Problem with Perspective

  1. #1
    Intern Newbie
    Join Date
    Jul 2001
    Location
    Brooklyn
    Posts
    30

    Problem with Perspective

    Hi I have problem with setting up perspective. Although, I use the following func. seems like I am getting glOrtho with dimensions x, y and z from -1.0f to 1.0f Any idea?

    void DRAW :: SetUP_Environment (int w, int h){
    glEnable( GL_DEPTH_TEST );
    glViewport(0, 0, w, h);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(10.0f,(GLfloat)w/(GLfloat)h, 0.1f, 1000.0f);
    glMatrixMode(GL_MODELVIEW);
    gluLookAt( Cam_X, Cam_Y, Cam_Z, 0, 0, 0, 0, 1, 0 );
    }

  2. #2
    Junior Member Regular Contributor
    Join Date
    May 2001
    Location
    Germany, Hannover
    Posts
    224

    Re: Problem with Perspective

    void gluPerspective(
    GLdouble fovy, //try 90deg not 10
    GLdouble aspect,
    GLdouble zNear,
    GLdouble zFar
    );

    Parameters
    fovy
    The field of view angle, in degrees, in the y-direction.
    aspect
    The aspect ratio that determines the field of view in the x-direction. The aspect ratio is the ratio of x (width) to y (height).
    zNear
    The distance from the viewer to the near clipping plane (always positive).
    zFar
    The distance from the viewer to the far clipping plane (always positive).

  3. #3
    Intern Newbie
    Join Date
    Jul 2001
    Location
    Brooklyn
    Posts
    30

    Re: Problem with Perspective

    Thanks now it is working.

Posting Permissions

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