I have attached a program demonstrating that a Texture image and
TransformGroup don't update synchronously. A cylinder rotates about its y
axis and an image of a small blue rectangle on a yellow background is
created each frame, put into an ImageComponent2D and then into the Texture
of the cylinder. The image is drawn so that the blue rectange will be facing
the viewer no matter what the orientation of the cylinder. Imagine, if you
will, a soup can that is revolving about its vertical axis but whose label
is staying still.

Unfortunately, the transform updates one frame later than the texture so
that the image is applied to the cylinder when it is at its previous
rotation. If, for example, the cylinder is rotates 30 degrees every frame
then the label is always 30 degrees off. You can play with the slider to
vary the amount of rotation per frame and view the resulting discrepency
between texture and transform. The button on the bottom will allow you to
toggle back and forth between default mode (as described above) and a
corrected mode where the program delays the texture update by one frame (to
match the lagging Transform change). In corrected mode things look the way
they should in default mode.

Thanks,

Raffi

TextureSync.java

Reply via email to