tags:

views:

55

answers:

1

Hi!

Is it possible to set 'clipping bounds' in JOGL? Like in Java/Swing i would like to set clipping bounds and all drawing/rendering outside those bounds would be ignored.

+1  A: 

OpenGL (for which JOGL is just a wrapper) has the concept of a clip plane. You can set a number of clip planes in your scenes (at least six, usually more), and anything outside them won't get drawn. These planes are specified in 3D, and the clip calculation is done in 3D.

Look for GL.glClipPlane(...)

If you are looking for clipping in 2D in the screen space, look for GL.glViewport(...).

DJClayworth
Thanks for the answer. This is really fine solution. I did it with help of stencil buffer. Is it possible that this solution is slower?
Jure Polutnik
I would expect stencil buffer to be slower than glViewport. I'm not sure about clip planes - it might depend on how many you need.
DJClayworth