Results 1 to 4 of 4

Thread: displaying a 3d primative (glut)

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2005
    Posts
    15

    displaying a 3d primative (glut)

    im extremly new to opengl, and i understand how to display 2d primatives, but when it comes to 3d, i get confused. how do you specify where they are in the window? for example

    glutSolidTeapot(1.0)

    will show a cutoff teapot at the bottom left corner, but how do i make it appear somewhere else?? thanks

  2. #2
    Senior Member Regular Contributor
    Join Date
    Aug 2003
    Posts
    369

    Re: displaying a 3d primative (glut)

    It depends on the transformation matrix. Try finding the red book online (it's an older version, but the basic stuff that you need is there). It's in this site somewhere.
    In essence you should use glTransform*, glRotate*, glScale* to move ("transform") your object in the "world coordinates". Hope I've shed some light, welcome to the wonderful world of OpenGL

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2005
    Posts
    15

    Re: displaying a 3d primative (glut)

    ok, im sort of getting the hang of it. for example, i have global variables int_x int_y and zoom and to display the object, i do this

    glLoadIdentity();
    glTranslatef(int_x, int_y, 1.0);
    glutWireTeapot(zoom);

    but that just gives me the image in the xy plane, how do i view it from a different angle? for example, xz or yz planes? thanks

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Berlin, Germany
    Posts
    188

    Re: displaying a 3d primative (glut)

    You can rotate using one of the glRotate* calls. Or if you like to think in terms of a camera, use gluLookAt to specify the camera position, lookat point and up-vector.
    355/113 -- Not the famous irrational number PI, but an incredible simulation!

Similar Threads

  1. OpenGL/GLUT not re-displaying uncovered windows
    By PeterG in forum OpenGL: Windows
    Replies: 0
    Last Post: 10-02-2010, 11:57 AM
  2. DIsplaying text in GLUT
    By Bhush in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-17-2008, 12:11 AM
  3. Displaying text without glut
    By Drakkhen in forum OpenGL: GLSL
    Replies: 4
    Last Post: 01-25-2005, 01:31 AM
  4. Replies: 1
    Last Post: 03-10-2003, 05:41 PM
  5. Displaying image with GLUT
    By IceSoft in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-31-2003, 02:17 AM

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