View Full Version : displaying a 3d primative (glut)

09-03-2005, 12:05 PM
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


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

09-03-2005, 01:01 PM
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 ;)

09-03-2005, 01:55 PM
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

glTranslatef(int_x, int_y, 1.0);

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

09-03-2005, 04:21 PM
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.