Advertisement

4 viewports

Started by October 24, 2000 01:31 PM
5 comments, last by rkoostber 24 years ago
Hello, I''m working on a 3d editor which someone asked me to make to design levels for his 3d engine. Now I have a question. I have now come to the point where I want 4 viewports (3 ortho, 1 persp.) instead of only one. My questions are: 1) How do I get 4 OpenGl viewports? 2) Is it possible to have more Opengl viewports on one windows window? P.S. I know how to make an opengl window, just not how to make four. Thanks in advance
ok, first, if ur working with visual c++6.0, create a split screen app, assign 4 different view classes to them.
than assign each of those subwindow''s hdc and hrc.
look in the msdn library for the exact code.
Advertisement
There is a number of solutions to your problem.

1. You can use the same window for all four viewports. As you know, OpenGL is a state machine, so you would have to set the viewport to the first rectangle, render the scene, then set the viewport to the second rectangle, render the scene, etc.
2. You can create 4 subwindows in your big frame window, then every time you need to draw, you would associate OpenGL context with the context of the right window.

In both cases you would have to render the scene four times, but that''s all right because you won''t need to render the same scene from the same point of view to two different viewports anyway.

I am pretty sure method 1 is a lot more efficient then 2, but you''ll have problems with the interface if you want to be able to resize. With different windows, the system will take care of that automatically, but you will lose performance.

I''m sure there are more methods, but these two are the only ones I can think of right now.
Wow,

thanks for those quick replys, but I have a question, if i specify four different viewports like you said in y''re first suggestion, i can''t make 3 orthographic viewports and 1 perspective. The performance isn''t really a problem since there won''t be made quake3 maps with it.

In reply to the first sollution, I DO use Visual C++ 6.0, but isn''t a split screen app. an MFC based one, because I never learned MFC I would rather like to use the basic win32 API.

Thanks!
Wow,

thanks for those quick replys, but I have a question, if i specify four different viewports like you said in y''re first suggestion, i can''t make 3 orthographic viewports and 1 perspective. The performance isn''t really a problem since there won''t be made quake3 maps with it.

In reply to the first sollution, I DO use Visual C++ 6.0, but isn''t a split screen app. an MFC based one, because I never learned MFC I would rather like to use the basic win32 API.

Thanks!
Checkout www.cornflakezon.com I have tutorials on all of the above.

http://www.CornflakeZone.com
//-- Modelling and animation in every dimension --//
Advertisement
Checkout www.cornflakezone.com I have tutorials on all of the above.

http://www.CornflakeZone.com
//-- Modelling and animation in every dimension --//

This topic is closed to new replies.

Advertisement