usage of ElementArrayStim disables color of ShapeStim

88 views
Skip to first unread message

Yuri Spitsyn

unread,
Mar 8, 2011, 1:30:12 AM3/8/11
to psychopy-users
Just run this test (for comparison I also added PatchStim which
behaves nicely):

from psychopy import visual, core

mywin = visual.Window([800,600], units="pix", color=-1)
patch = visual.PatchStim(win=mywin, tex='sin', mask='gauss',
units='pix', size=800)
earray = visual.ElementArrayStim(win=mywin, texRes=128, nElements=10,
sizes=60, fieldSize=500)
v=100
square = visual.ShapeStim(win=mywin, vertices=[[-v,-v],[-v,v],[v,v],
[v,-v]], lineWidth=5, lineColor='red', fillColor='yellow')

patch.draw()
mywin.flip()
core.wait(1)

square.draw()
mywin.flip()
core.wait(1)

earray.draw()
mywin.flip()
core.wait(1)

square.draw()
mywin.flip()
core.wait(1)


Yuri Spitsyn

unread,
Mar 8, 2011, 1:42:06 AM3/8/11
to psychopy-users
This is a continuation of the previous post.

The first time square.draw() shows red-outlined yellow-filled square.
After second square.draw() I see an all-grey square.
Anyone else is having the same result?

(I run PsychoPy on Mac OSX 10.6.8, ATI Radeon X1600 graphics card)

Jeremy Gray

unread,
Mar 8, 2011, 8:40:55 AM3/8/11
to psychop...@googlegroups.com
yes, I see the same thing, mac 10.6.6 with NVIDIA GeForce 9400M

same thing with a 1-element elementArray:
earray = visual.ElementArrayStim(win=mywin, texRes=2, nElements=1,
sizes=1, fieldSize=1)

and same with pygame or when defining the square before defining the earray...

> --
> You received this message because you are subscribed to the Google Groups "psychopy-users" group.
> To post to this group, send email to psychop...@googlegroups.com.
> To unsubscribe from this group, send email to psychopy-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/psychopy-users?hl=en.
>
>

Jonathan Peirce

unread,
Mar 8, 2011, 9:35:00 AM3/8/11
to psychop...@googlegroups.com
Element array is leaving its texture shading program turned on at the
end of drawing (in case that means anything to you ;-) ).

To fix, insert the line
GL.glUseProgram(0)
somewhere towards the end of the ElementArray.draw() e.g. just before
GL.glPopClientAttrib() on line 3372
Or download the version I just committed at:

https://github.com/psychopy/psychopy/blob/6abc0f3c90fa77ec8f93c363ad8e25141d65d0a5/psychopy/visual.py

Thanks yuri, for the nice minimal example to help find the bug.

Jon

--
Dr. Jonathan Peirce
Nottingham Visual Neuroscience

http://www.peirce.org.uk/


This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

Reply all
Reply to author
Forward
0 new messages