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 View from different angles

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    8

    How to View from different angles

    How can a 3d oject be viewd from different angles. for ex if we want the orthographic projection of an oject how can it be drawn?

  2. #2
    Intern Contributor
    Join Date
    Feb 2003
    Location
    Mitishy
    Posts
    59

    Re: How to View from different angles

    hi!
    you can set pojection using gluOrtho2d, gluPerspective, gluFrustum. (it's an easiest way)

    ex:
    // (resize function) this will set current projection
    void resize(int width, int height) {
    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    float aspect = (float)width/(float)height;
    gluPerspective(45.0f, aspect, 0.1f, 100.0f);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    }

    // (drawing function) at start of it
    void Draw()
    {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    // gluLookAt will set camera to look from...
    gluLookAt(camera.position.x, camera.position.y, camera.position.z,
    camera.view.x, camera.view.y, camera.view.z,
    camera.up.x, camera.up.y, camera.up.z );

    // do your drawings here as always

    glFlush();
    if(doublebuffered)
    SwapBuffers(output_hdc);
    }

    [This message has been edited by gvm (edited 07-21-2003).]

Posting Permissions

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