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
[email protected]
http://www.matteosistisette.com
#N canvas 702 93 635 593 12;
#X obj 304 560 gemwin;
#X msg 377 514 destroy;
#X obj 192 96 gemhead;
#X obj 192 131 t a a a;
#X obj 460 217 separator;
#X obj 461 336 square 3;
#X obj 189 256 rotateXYZ 0 0 0;
#X floatatom 347 67 5 0 0 0 - - -;
#X obj 190 184 separator;
#X obj 461 303 pix_texture;
#X obj 43 260 separator;
#X obj 198 400 color 1 0 0;
#X obj 198 425 sphere 1;
#X obj 198 368 translateXYZ 0 0 1;
#X msg 272 487 dimen 400 400 \, create \, 1;
#X obj 41 567 pix_snap 400 400;
#X obj 32 34 bng 30 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 84 382 t b b;
#X msg 81 427 1;
#X obj 42 459 spigot;
#X obj 41 496 t a b;
#X msg 109 462 0;
#X text 306 696 ========;
#X obj 39 530 t a b;
#X obj 41 611 pix_texture;
#X obj 38 312 pix_separator;
#X obj 460 246 pix_separator;
#X obj 460 276 color 1 1 1;
#X obj 186 220 pix_separator;
#X obj 180 38 t b;
#X text 199 74 <== connect this;
#X connect 1 0 0 0;
#X connect 2 0 3 0;
#X connect 3 0 10 0;
#X connect 3 1 8 0;
#X connect 3 2 4 0;
#X connect 4 0 26 0;
#X connect 6 0 13 0;
#X connect 7 0 6 2;
#X connect 8 0 28 0;
#X connect 9 0 5 0;
#X connect 10 0 25 0;
#X connect 11 0 12 0;
#X connect 13 0 11 0;
#X connect 14 0 0 0;
#X connect 15 0 24 0;
#X connect 16 0 17 0;
#X connect 17 0 29 0;
#X connect 17 1 18 0;
#X connect 18 0 19 1;
#X connect 19 0 20 0;
#X connect 20 0 23 0;
#X connect 20 1 21 0;
#X connect 21 0 19 1;
#X connect 23 0 15 0;
#X connect 23 1 15 0;
#X connect 24 1 9 1;
#X connect 25 0 19 0;
#X connect 26 0 27 0;
#X connect 27 0 9 0;
#X connect 28 0 6 0;
_______________________________________________
GEM-dev mailing list
[email protected]
http://lists.puredata.info/listinfo/gem-dev