jakov's picture

Multiple viewports - Sharing textures?

I am making a sort of 3D editor where I need 4 viewports.
What is the easyest way to make it? Is there a way to have different viewports in one glControl?
Can they all share textures in some way?

Thanks


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

One approach is to use a single glControl and render your scene four times, each time with a different viewport (check GL.Viewport).

Alternatively, you can create four different glControls (textures will be shared automatically) and go from there.

The first approach will likely yield better performance and will probably be easier to work with, as you won't have to juggle with current contexts and/or threading.

jakov's picture

I went with GL.Viewport , it was simpler then I thought it would be.
One more thing I am not sure how to pull it off now... How can I have different background color since .Clear clears everything? Right now I am first drawing quads without texture in ortho mode but it makes it complicated and the final color is not exactly the one I set with GL.Material

objarni's picture

Disable any lighting-stuff and use ordinary GL.Color() and Ortho-mode to draw different bg-colors in the different quadrants of you application. Use GL.Clear() to clear the depth-buffer though.

So I guess you are almost there - just skip the lighting stuff while clearing the screen.