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
    Member 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).]

Similar Threads

  1. Creating multiple planes in 3D view (projection view)
    By Bhoot123 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 02-20-2018, 02:40 AM
  2. model view matrix and view direction
    By sajis997 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-27-2014, 03:24 AM
  3. newbie view location / view direction in textfield
    By newsb in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-12-2011, 02:15 PM
  4. Convert user view to Camera view.
    By HanWu in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 05-10-2011, 01:56 AM
  5. Extract view frutum planes from view matrix
    By ei05tbe in forum OpenGL: General
    Replies: 4
    Last Post: 09-18-2010, 06:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean