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

Thread: How to convert vrml viewpoint to glulookat?

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    new york
    Posts
    1

    How to convert vrml viewpoint to glulookat?

    Does anyone know how to convert vrml viewpoint which has to following attributes:

    fieldOfView fov_angle
    orientation x, y, z, angle
    position x, y, z

    to a gluLookAt, which composes of position,
    aim, and up vectors.

    Any help or web page link will be much appreciated. Many thanks.

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

    Re: How to convert vrml viewpoint to glulookat?

    >fieldOfView fov_angle
    >orientation x, y, z, angle
    >position x, y, z

    Here is what I did in my VRML loader:

    void ViewpointDisplay(VIEWPOINT *viewpoint)
    {
    if (viewpoint != NULL)
    {
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(viewpoint->fieldOfView * RAD2DEG, dAspect, zNear, zFar);
    glRotatef(-viewpoint->orientation[3] * RAD2DEG, viewpoint->orientation[0], viewpoint->orientation[1], viewpoint->orientation[2]);
    glTranslate(-viewpoint->position[0],-viewpoint->position[1], -viewpoint->position[2]);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    }
    }

Posting Permissions

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