two cameras per view

THE PROBLEM: I want a Picture in Picture (PIP) view, where in the rotation of the insert(PIP) is bound by the rotation of the main graphics, so that I can see the main graphics orientation in the insert(PIP) while I may zoom-in on the main graphic body.

LINE OF THOUGHT(1): So is it possible to have two independent cameras in a view and two different graphics displayed in the same view? If possible please give some suggestions. Then this solution is simple

LINE OF THOUGHT(2): Use glScissor() command and draw two different graphics, but the problem here is… how do I draw the insert(PIP) with respect to the global coordinate system but remain at one corner of the screen at all times. Any suggestions on this one…

Please comment on both or either of the solutions…

Thanx in anticipation,

Yes, this is possible. You can use glViewport to select a smaller region of the screen, so try this:

  1. Multiply the matrices by your rotations.
  2. Push the matrix
  3. Do your zoom/translations
  4. Draw in the full screen
  5. Pop the matrix
  6. Change the viewport size/whatever
  7. Draw again

and poof! there it is.


You could consider using glScissor also…


But… is it possible to have two cameras per view, has anyone done it and please tell me how to do it if it is possible and what are the complexities involved in implementing this?


[This message has been edited by surya (edited 05-09-2001).]

A camera is just an analogy - there are no “cameras” in OpenGL. Create your objects, multiply them by your viewing transformation (this is your “camera”) and draw the scene. Change the transformation and the region you are drawing in and draw again, creating the “picture-in-picture”.

Technically, you don’t have two cameras. You just have one, but you’re using it twice. Once for the insert and once for the main camera.