I'm making another attempt at the wacky thing I was doing with RenderBin
a while back. (I'm trying to have some objects not erase as they are
moved or changed.)
In this particular implementation, I've got the objects in question in a
RenderBin. I'd like an Image associated with each SceneView, in which
to store the the current buffer. Although I could easily have one Image
for this, if I had more than one SceneView, I wouldn't want them writing
on each other's Image.
I don't see any way to store some state with my RenderBin. If I add the
Image to the prototype for the RenderBin, all RenderBins made from it
would have the same Image. If I add a method to set the Image to my
class derived from RenderBin, where would I call it?
If I could get back from the drawImplementation() call to the SceneView,
I could store my image there. But I don't see a way to get there from
the State or RenderLeaf passed to drawImplementation().
Is the fact that I don't see a way to easily set this state in a
RenderBin a sign that I'm trying to abuse it? Is there a way around?
My particular experiment (it isn't a final implementation at all-I'm
still playing around) is to make a RenderBin for the special objects,
and have its drawImplementation look like:
{
if (imageSet) {
draw image to frame buffer;
}
RenderBin::drawImplementation(state, previous);
image.readPixels;
imageSet = true;
}
An assumption is that this gets reset whenever something is changed
outside of this RenderBin. So it is OK (but not efficient) that drawing
the image to the frame buffer stomps on top of everything already drawn
in the main RenderBin.
There is more to it than that, but the effect is to have the things in
this RenderBin continually added to an unchanging picture.
So how do I get image to stay consistent for any RenderBin created for a
particular SceneView, but be different for RenderBins for different
SceneView objects? I could assign different strings and have different
prototypes for RenderBins in different SceneViews, but that doesn't seem
quite right. The name of the RenderBin now relates to what I'm using it
for.
(Yes, I know, this is all very odd. But I'm trying to implement
something that has been odd for a long time. :)
thanks,
andy
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/