(LWJGL) Subdivision of the Display

Greetings!

I’m currently working on the basics of my lwjgl-project and got the following question:
How can I subdivide my Display into different parts? I need something like different clipping-panes for different parts. I think there is something in the fixed-function pipeline but I want to use non-deprecated OpenGL only!

To give you an example:
Say, I want to divide my display into two equally big parts (part 1 & 2) (vertically). I then want to render objects of type A to part 1 and objects of type B to part 2. Both should be clipped when crossing the vertical “boarderline”.

One possible solution I already tested is simple discarding the fragments out of my imaginary clipping pane via frag-shader. But this seems like a rather ugly solution because I’d have to implement that in every frag-shader and so every object. I’m looking for a better option to to this.

Thank you in advance!

What you’re looking for is glViewport. You can find a tutorial for using it at http://nehe.gamedev.net/tutorial/multiple_viewports/20002/ - it’s the usual disaster of chopped up formatting and windows boilerplate that is a NeHe tutorial, but if you scroll to the bottom there’s source code in other languages. The python version should be pretty readable.

Viewports are the way to go as already suggested.

One thing to bear in mind is that glViewport is essentially defining a new ‘window’ (for want of a better term), so you will want to setup a different projection for each one (they will have different dimensions for a start), perhaps different background colours, different scenes (your A in one, B in t’other), etc.