drawing 2 or more objects in one viewport


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)


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

draw object 1
draw object 2

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

  1. 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.

  2. Read the red book section on picking. An online version is available at

Go to chapter 13.

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

Antonio www.fatech.com/tech