PDA

View Full Version : drawing 2 or more objects in one viewport



KC
09-29-2000, 04:28 PM
Hi!

I want to draw 2 or more objects ( lets say a cube and a pyramid)in one viewport. I would be performing transformations (translate, rotate, scaling) on either or both of the objects.

1) HOw do I implement this such that I can transform/animate only one of the objects and the other one(s) remain in their original position?

2) Do I use Arrays to store the vertices of the objects? glArrayElements()??? can anyone give examples... I'm new to opengl.

3) how do I pick one of the objects? and highlight them ?

4) AFter I pick a certain object and highlight it .. how do I perform transformation on it? (just on the chosen object)

Antonio
09-29-2000, 04:34 PM
Hi,

1. You apply a transformation just to one object, for instance in pseudo code it could be something like this:

pushMatrix
translate
draw object 1
popMatrix
draw object 2

in this way you'll get object 1 translated, whereas object 2 remains stationary.

2. You can use whatever you want, however since you're new to openGL I would suggest starting with the GLUT primitives as they are easier to use than if you have to specify all the vertices.

3. Read the red book section on picking. An online version is available at
http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/@Generic__BookView

Go to chapter 13.

4. The anwser to this one is the same as 2.

Antonio www.fatech.com/tech (http://www.fatech.com/tech)