[vtk-developers] vtkClipPlanesPainter

John Biddiscombe biddisco at cscs.ch
Wed Feb 7 03:59:37 EST 2007


Thanks Ken
> The problem with the design was that it required switching a lot of the
> state for each of the two delegates.  Each rendering pass required
> different geometry and different shaders.  I got it working, but the
> final code was unsatisfactory in that I had to make so many "hacks" to
> get it working that it lost its reusability.
>   
Since you are the creator of the Painters, this makes me a little 
apprehensive!
> On a second pass, I tried encapsulating each pass in an actor.  Each
> actor contained the geometry, shaders, and other rendering properties
> needed for a single pass.  One actor had a special painter added to it
> that rendered to an FBO, and the texture for that FBO was set as the
> texture for another actor.  The actors were placed together in a
> vtkPropAssembly in such a way that they would be rendered in the correct
> order.  All the pieces were nice and general purpose, but the setup was
> so complicated that I cringe at the thought of trying to explain it all.
>   
Interesting. what I'm doing now is maintaining a list of Property 
objects inside my customized mapper. Each property loads its shader and 
then I just call Render and PostRender on them when I want to load and 
unload the shader. The framebuffer is held inside the mapper and I 
render into is, then use it directly. However, what you described about 
taking the output of the framebuffer and using it as a texture on 
another actor is what I'll want eventually. It sounds like my approach 
is closer to your second method and since it was becoming messy and I to 
was starting to cringe I imagined that the painters would be my salvation.

> In short, painters might help you implement a multi-pass algorithm, but
> they probably won't get you all the way.  Surely there must be a better
> mechanism for setting up multi-pass algorithms, but I have not thought
> of one.
>   
I guess this is where we ask people for suggestions. since I don't fully 
understand how the painters delegate their work to these delegates I'll 
do some more reading and hacking - but if anyone reading this can 
provide a better explanation that the doc I read yesterday (that Utkarsh 
posted the link to)  then please do.
(Incidentally, I promised to make a small presentation about how the 
painters work to the others here (once I understand them myself), so I 
would welcome additional input)
cheers

JB









More information about the vtk-developers mailing list