Changing position of aperture in DriftDemo2.m

Hello,

I'm trying to program a grating oscillating within a circular aperture and I've found the DriftDemo2 in PsychDemos particularly useful. However, I noticed that the dstRect is put in the centre of the screen using CenterRect. I tried changing the position of the aperture by redefining dstRect (i.e. giving new coordinates) but then the screen just turned blank. Would anyone give me some advice what I should have done if I want the drifting grating to appear not the centre, but elsewhere on the screen?

Thank you very much.

Best,
Pik Ki
It should work. Most likely, you messed up the numbers in the rect. They are [left top right bottom]. Topleft cornner is [0 0].

Xiangrui

--- In psychtoolbox@yahoogroups.com, "Pik Ki" <pkbeckyho@...> wrote:
>
> Hello,
>
> I'm trying to program a grating oscillating within a circular aperture and I've found the DriftDemo2 in PsychDemos particularly useful. However, I noticed that the dstRect is put in the centre of the screen using CenterRect. I tried changing the position of the aperture by redefining dstRect (i.e. giving new coordinates) but then the screen just turned blank. Would anyone give me some advice what I should have done if I want the drifting grating to appear not the centre, but elsewhere on the screen?
>
> Thank you very much.
>
> Best,
> Pik Ki
>
Indeed.
E.g., dstRect = CenterRectOnPoint(dstRect, 200, 300);
insted of CenterRect() line would center the grating to pixel position (x,y) = (200, 300).

"help PsychRects"

-mario

--- In psychtoolbox@yahoogroups.com, "xrli2002" <xrli2002@...> wrote:
>
> It should work. Most likely, you messed up the numbers in the rect. They are [left top right bottom]. Topleft cornner is [0 0].
>
> Xiangrui
>
> --- In psychtoolbox@yahoogroups.com, "Pik Ki" <pkbeckyho@> wrote:
> >
> > Hello,
> >
> > I'm trying to program a grating oscillating within a circular aperture and I've found the DriftDemo2 in PsychDemos particularly useful. However, I noticed that the dstRect is put in the centre of the screen using CenterRect. I tried changing the position of the aperture by redefining dstRect (i.e. giving new coordinates) but then the screen just turned blank. Would anyone give me some advice what I should have done if I want the drifting grating to appear not the centre, but elsewhere on the screen?
> >
> > Thank you very much.
> >
> > Best,
> > Pik Ki
> >
>
Hi Xiangrui,

Thanks for your reply. That's what I thought as well but I'm pretty sure the coordinates I entered are valid...

Best,
Pik Ki

--- In psychtoolbox@yahoogroups.com, "xrli2002" <xrli2002@...> wrote:
>
> It should work. Most likely, you messed up the numbers in the rect. They are [left top right bottom]. Topleft cornner is [0 0].
>
> Xiangrui
>
> --- In psychtoolbox@yahoogroups.com, "Pik Ki" <pkbeckyho@> wrote:
> >
> > Hello,
> >
> > I'm trying to program a grating oscillating within a circular aperture and I've found the DriftDemo2 in PsychDemos particularly useful. However, I noticed that the dstRect is put in the centre of the screen using CenterRect. I tried changing the position of the aperture by redefining dstRect (i.e. giving new coordinates) but then the screen just turned blank. Would anyone give me some advice what I should have done if I want the drifting grating to appear not the centre, but elsewhere on the screen?
> >
> > Thank you very much.
> >
> > Best,
> > Pik Ki
> >
>
Nope, Xiangrui is right, it will work if you don't make a mistake. I assume your psychtoolbox is not outdated by years or something else is seriously broken on your computer.

-mario

--- In psychtoolbox@yahoogroups.com, "Pik Ki" <pkbeckyho@...> wrote:
>
> Hi Xiangrui,
>
> Thanks for your reply. That's what I thought as well but I'm pretty sure the coordinates I entered are valid...
>
> Best,
> Pik Ki
>
> --- In psychtoolbox@yahoogroups.com, "xrli2002" <xrli2002@> wrote:
> >
> > It should work. Most likely, you messed up the numbers in the rect. They are [left top right bottom]. Topleft cornner is [0 0].
> >
> > Xiangrui
> >
> > --- In psychtoolbox@yahoogroups.com, "Pik Ki" <pkbeckyho@> wrote:
> > >
> > > Hello,
> > >
> > > I'm trying to program a grating oscillating within a circular aperture and I've found the DriftDemo2 in PsychDemos particularly useful. However, I noticed that the dstRect is put in the centre of the screen using CenterRect. I tried changing the position of the aperture by redefining dstRect (i.e. giving new coordinates) but then the screen just turned blank. Would anyone give me some advice what I should have done if I want the drifting grating to appear not the centre, but elsewhere on the screen?
> > >
> > > Thank you very much.
> > >
> > > Best,
> > > Pik Ki
> > >
> >
>
Thanks Mario, that worked! :D

--- In psychtoolbox@yahoogroups.com, "Pik Ki" <pkbeckyho@...> wrote:
>
> Hi Xiangrui,
>
> Thanks for your reply. That's what I thought as well but I'm pretty sure the coordinates I entered are valid...
>
> Best,
> Pik Ki
>
> --- In psychtoolbox@yahoogroups.com, "xrli2002" <xrli2002@> wrote:
> >
> > It should work. Most likely, you messed up the numbers in the rect. They are [left top right bottom]. Topleft cornner is [0 0].
> >
> > Xiangrui
> >
> > --- In psychtoolbox@yahoogroups.com, "Pik Ki" <pkbeckyho@> wrote:
> > >
> > > Hello,
> > >
> > > I'm trying to program a grating oscillating within a circular aperture and I've found the DriftDemo2 in PsychDemos particularly useful. However, I noticed that the dstRect is put in the centre of the screen using CenterRect. I tried changing the position of the aperture by redefining dstRect (i.e. giving new coordinates) but then the screen just turned blank. Would anyone give me some advice what I should have done if I want the drifting grating to appear not the centre, but elsewhere on the screen?
> > >
> > > Thank you very much.
> > >
> > > Best,
> > > Pik Ki
> > >
> >
>