Results 1 to 3 of 3

Thread: pls help

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2003
    Posts
    1

    pls help

    Hello..pls advice me on this.
    I just learnt how to draw 2D objects and I would like to try out 3D objects. I already set the glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    glEnable(GL_DEPTH_TEST);
    and I also changed the glvertex to include x,y,z coordinates. The problem is it only draws out the object if all the vertex has same z values.. I cant draw a cube or anything. In other words I cant get a 3D object out. What exactly is the problem..?
    thankx

  2. #2
    Guest

    Re: pls help

    Have you rotated the camera to see your object from another point of view? Try using
    gluLookAt(10, 0, 0, 0, 0, 0, 0, 1, 0);
    to position your camera 10 units on the x-axis, 0 on y and z, looking at the center, and having an up vector.

  3. #3
    Member Contributor
    Join Date
    Feb 2003
    Location
    Mitishy
    Posts
    59

    Re: pls help

    first, set your projection like this:
    resizefunc()
    {
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(45.0f, (float)width/height, 0.1f, 100.0f);
    glMatrixMode(GL_MODELVIEW);
    }
    void draw()
    {
    glLoadIdentity();
    gluLookAt(0,0,10,0,0,0, 0,1,0);
    //...drawing code
    glSwapBuffers()
    }

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