PDA

View Full Version : Viewport and Camera



Tona
02-18-2002, 01:33 PM
I have a question about viewports and cameras.
I have a CWindow class and a CCamera class: the first one to manage viewports and the second for cameras, of course..
Now, in a poroject I can have more windows (rarely) and more cameras (often): I can't find a good solution to releate these two classes together; pratically when I do things like to change the resolution, to resize a window and so on, it's better I set these properties in CWindow (something like Window.Resize(x, y)), and when I change things like perspective, fov, clipping planes, etc.. I set the CCamera class.
So CCamera must always know the size of the viewport, and If i want to maintain these two classes separated, every time I resize a window I should set both classes separately:
Window.Resize(x, y);
Camera.SetViewport(x, y);
... and this is orrible http://www.opengl.org/discussion_boards/ubb/frown.gif
So I should create some releations between these two classes so when I update the viewport automatically every camera knows the new dimensions.
I don't think that's a good idea to let the camera update the window, because these are two different entities, but at the same time, let the window update the camera has no sense, because the window is an object of the system and the camera deals with the graphic engine... I hope the problem is clear and I'd like to know how this problem is generally solved.
Thanks.