[PD] snapshot misteries, bang to gemhead
Matteo Sisti Sette
matteosistisette at gmail.com
Mon Dec 7 13:12:03 CET 2009
Hi,
I'm working on a patch (not the attached one which is an example that
isolates the problem), where from time to time I need to take a snapshot
of the whole scene and "draw" it as a texture on a rectangle which is on
the background.
(when the patch is finished I think I will be allowed to share it, for
what it's worth)
I have it all working fine, but than I came into a problem: sometimes, I
have to send a message to take the snapshot, and immediately after, send
some other message that changes something on the scene, which has to
happen AFTER the snapshot.
Since I am taking snapshots in the "classic" way, that is, opening a
spigot on the gemlist that comes to the [pix_snap], the snapshot is
actually deferred until the next render; this is a problem because I
need to "defer" any other message that has to take effet just after the
sbapshot; this can be done but i'd like to avoid all the complications.
I thought that a solution would be to force a render just after any
snapshot, by sending a bang to the gemhead that is rendering everithing.
However, the result is not what I expected and I really can't understand
why.
That's why I am asking for your help.
So, the attached patch is a simplification, in which I draw an initially
white square and a sphere. If you hit the big bang (sorry for the pun),
a snapshot of the scene is taken via [pix_snap] and it becomes the
texture of the square. You can use the number box to move the sphere around.
Now, if I make the connection where it says "connect this", what I am
doing is just provoking a bang to the gemhead just after opening the
spigot to the pix_snap. What I would expect is that it should work
exactly the same as before (with the difference that an extra frame is
rendered between two "normal" frames, and that's the moment the snapshot
is taken; but this difference should not be "visible").
However, the observed behaviour is not this. The snapshot that is taken
and "printed" on the texture is not the scene, but some aberration of
it. If you leave the sphere wher it is, it will usually render and snap
an all-black scene; but if you move the sphere to the back, behind the
square, the snapshot will take the sphere very near to the "eye"......
I really don't understand. Doesn't the bang to the gemhead provoke a
full render of everything just the same as it is rendered when a new
frame occurs? Then why is the scene rendered differently when I do the
bang????
I guess this could be further isolated to something regarding the bang
to gemhead, i.e. without involving pix_snap; of course with a "fast"
enough to see what happens during a single extra frame....
Thanks in advance
By the way, thanks to all who gave me example patches some days ago
which have helped me building this patch.
m.
--
Matteo Sisti Sette
matteosistisette at gmail.com
http://www.matteosistisette.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tes_forcerender_snapshot.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20091207/d7eef0e0/attachment.asc>
More information about the Pd-list
mailing list