PDA

View Full Version : how can we divide window into subregions just like milkshape3d does



Sourpotato
07-14-2003, 03:16 AM
Does anybody has idea how to implement Milkshape3d -style split window with each sub-section in which x,y,z axis pointing to the screen.I am left wondering how can i do it myselves after i use Milkshape 3d which is my first ever-used 3d modeling tool.

I know from Red Book that glScissor might work.but i don't know how to perform the different projection to the whold screen?

It would be great if any one could privide some code or pointing to a link,Thanx a lot.




[This message has been edited by RunningRabbit (edited 07-14-2003).]

Obli
07-14-2003, 08:46 AM
Do glViewport, set Scissor accordingly (this is optional).
Set your modelview matrix.
Draw.

Repeat foreach region of window.

Caveat: Clear* ops still takes up the whole screen so if you have no hints about what's happening... it will be a real problem!
If you hard-code everything, which is probably what's happening, you may simply know that you are writing to subregion X and act as conseguence (skip clears, do it once for all window regions etc).

Nvidia has a fog comparation demo which uses multiple wiewports in a single window. Try search for it, I think it would be useful.
The anisotropic filtering demo also got multiple viewports.

Sourpotato
07-16-2003, 08:28 PM
Great Input,Thanx a lot.

roffe
07-16-2003, 11:24 PM
Originally posted by Obli:

Caveat: Clear* ops still takes up the whole screen so if you have no hints about what's happening

Clear is affected by the scissor test. If you only need to clear a small region of the window, use scissor.

From the api doc:


The pixel ownership test, the scissor test, dithering, and the buffer writemasks affect the operation of glClear.

john
07-17-2003, 02:08 AM
Do glViewport, set Scissor accordingly (this is optional).

scissor is always necessary. Further to the comment about scissor and clearing, you NEED scissor to clip fragments that project to outside the viewport region. There is no guarantee that fragments will be clipped even if they do not map to the region defined by viewport unless you enforce the clipping with scissor. So, scissor is always required even if you think you don't need it for masking out clearing.

cheers,
John

DalTXColtsFan
07-17-2003, 09:11 AM
MFC does this fairly easily as well, but if you use 4 different openGL contexts you'll need to read up on wglShareList, wglCreateContext et al.

The CChildFrame object has a method called I think CreateSplitter where you can create a 4-pane splitter window, then you can put 4 different view objects in each window. I have a code sample for a modeling tool I'm working on that does that, you can look at the CChildFrame class if you want.
http://daltxcoltsfan.tripod.com/OpenGL/OpenGL.htm