[vtk-developers] 2D Clipping Planes

Lisa S. Avila lisa.avila at kitware.com
Fri Feb 16 09:21:53 EST 2001


Hello John,

I would definitely recommend moving the code for setting the clipping 
planes into one location - the vtkAbstractMapper class.

As for the implementation, you should use OpenGL only where it works. I 
suspect you can come up with an OpenGL implementation that works for images 
(and text, which I suspect has a similar problem) by for example rendering 
into a mask buffer 6 times (once for each clipping plane) with the opposite 
of the clipping plane in order to mask out the pixels you don't want to be 
set. Of course, this is more effort than simply setting the clipping 
planes, but probably less effort that doing the clipping by hand.

Lisa


At 03:13 AM 2/16/2001, John Biddiscombe wrote:
>Lisa,
>
> >No objections, but is it possible for you to do this by moving the 
> clipping places from vtkAbstractMapper3D to vtkAbstractMapper? This way, 
> the way to specify them will be the same, and since 2D mappers can be 
> used in 3D scenes this can be useful (and fast if OpenGL can be used to 
> do the clipping.)
>
>Actually, This is almost what I've done. Except that I've copied the 
>relevant code (from the 3D mappers) into the 2D mappers, but I'll see if 
>moving it all directly to Abstract mapper is better....
>
>Incidentally....OpenGL behaves a little strangely when clipping images. If 
>the left/bottom pixel is just outside the clipping region, it clips the 
>whole image away, when in fact I'd like it to just clip the few pixels 
>which are outside the region. I've got around this in my code by adding a 
>whole series of tests which then set the render-rectangle and allow 
>sub-regions to be rendered, but its messy and not ideal for general use. 
>Has anyone come across this and found a "pure opengl" solution.
>
>JB
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtk-developers





More information about the vtk-developers mailing list