View Full Version : two cameras per view

05-08-2001, 01:16 PM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

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,

05-08-2001, 01:21 PM
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.


05-09-2001, 02:50 AM
You could consider using glScissor also...


05-09-2001, 07:24 AM
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).]

05-09-2001, 09:29 AM
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".

05-09-2001, 09:30 AM
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.