clut animation with 2 images

Hi,

I'm trying to get two orthogonal bars to drift across the screen at
different rates for several cycles each. I'm trying to do this using
clut animation. I've set up two off screen windows (a vertical ramp
and a horizontal ramp) and two sets of cluts, one set for each
window. To get one bar, I copy one off-screen window to the display
and set its clut, then to get the other bar I switch windows and
cluts. The problem is, I don't know how to set a clut and switch in
an off-screen window in one step, so I end up with a "shadow". The
previous frame gets the clut intended for the new frame for a short
time, or the new frame gets the previous clut for a time.

Any suggestions on how to avoid getting a shadow or a different way
of doing this?

Thanks,

Naoum Issa
University of Chicago
Without seeing your program, it is impossible to tell what is going
wrong. However, if SCREEN('SetClut') waits for a screen refresh before
returning, it would exhibit the behavior your describe. Type
"SCREEN('SetClut?')" to read about SetClut and blanking. If you set the
clut before copying the new screen, then the old image will be displayed
with the new clut for a frame. If you set the clut after copying the new
screen, then the new image will be displayed with the old clut for a
frame.

If it is not possible to disable SetClut waiting for blanking, then what
you are trying to do will not work. Some new video drivers apparently do
not wait for blanking, but the typical behavior that SCREEN attempts to
enforce is that SetClut does wait for blanking.

Usually you would want to use CLUT animation to avoid having to draw new
images to the screen. Since you are drawing new images to the screen
anyway, why not avoid using CLUT animation altogether? You can open one
offscreen window for each frame of your animation, and draw the
appropriate graphics for each frame. See MovieDemo.

keith

On Thu, 9 Jan 2003, norm_256 <nissa@...> wrote:

> Hi,
>
> I'm trying to get two orthogonal bars to drift across the screen at
> different rates for several cycles each. I'm trying to do this using
> clut animation. I've set up two off screen windows (a vertical ramp
> and a horizontal ramp) and two sets of cluts, one set for each
> window. To get one bar, I copy one off-screen window to the display
> and set its clut, then to get the other bar I switch windows and
> cluts. The problem is, I don't know how to set a clut and switch in
> an off-screen window in one step, so I end up with a "shadow". The
> previous frame gets the clut intended for the new frame for a short
> time, or the new frame gets the previous clut for a time.
>
> Any suggestions on how to avoid getting a shadow or a different way
> of doing this?
>
> Thanks,
>
> Naoum Issa
> University of Chicago
>
>
> http://psychtoolbox.org
> POST a message to: psychtoolbox@yahoogroups.com
> UNSUBSCRIBE by sending a blank message to:
> psychtoolbox-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>