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: 3d OBJECT

  1. #1
    Intern Contributor
    Join Date
    Mar 2002
    Location
    CA,USA
    Posts
    57

    3d OBJECT

    HI,
    I want to display a 3D object.
    I have the x,y,z [in an array]co-ords.
    I am displaying those objects using

    void display()
    {
    glBegin (GL_TRIANGLES);
    glVertex3f(xw[si],0, yw[sj]);
    glVertex3f(xw[si+1],0, yw[sj]);
    glVertex3f(xw[si+1],zw[si+1][sj], yw[sj]);
    ....

    }
    void init()
    {
    glClearColor(0.0,0.0,0.0,0.0);
    glColor3f(1.0,1.0,1.0);
    glViewport(0,0,250,250);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0, 250.0, 0.0 , 250.0, 0.0, -250.0);

    }


    etc..
    The program is running.But the object doesn't look 3D

    Now I want to display it in such a way that it should look 3D
    What should i do.
    Also variations of z values is very less i.e
    100,99.6,99.5,99,99.5,100...etc...
    What can i do to display it in much better way

    Thanks

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,096

    Re: 3d OBJECT

    Add lighting to the scene.
    Change from glortho mode to gluPerspective.

    Originally posted by aus79er:
    HI,
    I want to display a 3D object.
    I have the x,y,z [in an array]co-ords.
    I am displaying those objects using

    void display()
    {
    glBegin (GL_TRIANGLES);
    glVertex3f(xw[si],0, yw[sj]);
    glVertex3f(xw[si+1],0, yw[sj]);
    glVertex3f(xw[si+1],zw[si+1][sj], yw[sj]);
    ....

    }
    void init()
    {
    glClearColor(0.0,0.0,0.0,0.0);
    glColor3f(1.0,1.0,1.0);
    glViewport(0,0,250,250);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0, 250.0, 0.0 , 250.0, 0.0, -250.0);

    }


    etc..
    The program is running.But the object doesn't look 3D

    Now I want to display it in such a way that it should look 3D
    What should i do.
    Also variations of z values is very less i.e
    100,99.6,99.5,99,99.5,100...etc...
    What can i do to display it in much better way

    Thanks

  3. #3
    Intern Contributor
    Join Date
    Feb 2002
    Posts
    82

    Re: 3d OBJECT

    in Ortho, z is ignored anyways. Its for 2d

Posting Permissions

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