[visionegg] Re: simple RSVP scripts

From reading Andrew's email, this probably won't help but here it is anyway:

One other thing to try is create only one stimulus object, and then update the texture object within that stimulus object on every frame, instead of updating the viewport with a new stimulus on every frame:

screen = get_default_screen()

# build up the textures in a list
texturelist = []
for i in range(0,num_images):
        texture = Texture(texture_name[i])
        texturelist.append(texture)

# create a single texture stim, initialize to first texture

ts = TextureStimulus(texture = texturelist[0])

# get a handle to the texture object within ts
to = ts.texture.get_texture_object()

# initialize viewport to the single texture stimulus
viewport = Viewport(screen=screen,stimuli=ts)

# show images
for triali in range(0,num_loops):
        for imagei in range(0,num_images):
                to.put_sub_image = texturelist[imagei] # update to
                screen.clear()
                viewport.draw()
                swap_buffers()
                frame_timer.tick()

The source comment for put_sub_image is:

        """Replace all or part of a texture object.

        This is faster that put_new_image(), and can be used to
        rapidly update textures.
        ...
        For an explanation of most parameters, see the
        put_new_image() method."""


This is more or less what I do to play a movie from a single big raw binary file (I load in ahead of time from file into a numarray array, and then index into that array on every frame). Admittedly, these are pretty low res frames (greyscale, 32x32 pixels), but they run without any lag at startup at 200Hz refresh on an older Athlon 700MHz 512MB machine with a Radeon 9800 128MB in Windows 2000.


Cheers,

Martin Spacek
PhD student, Swindale lab
Graduate Program in Neuroscience
Dept. of Ophthalmology and Visual Sciences
University of British Columbia, Vancouver, BC, Canada
+1-604-875-4555 ext. 66282
mspacek@xxxxxxxxxxxxxxx | http://swindale.ecc.ubc.ca

On 2005-01-25 4:09 PM, Gabriel Nevarez wrote:
quite the contrary... in loading the images, the first 3 or 4 images flip at an
abysmally slow pace (i.e, about a second or two between flips), whereas the
later ones flip at the appropriate rate... in the case of my laptop, 60hz...
this is consistent with what I assume is file-loading time or some other
otherhead.  btw, these are large, 1024 x 768 x 24bit images ( x 10 images, in
this case of this demo script)

Since I'll have a splash-screen with instructions (which will allow sufficient
time for the textures to load completely), i doubt this will matter in a real
study, but it would be nice to have a deterministic timing model so I could make
sure that all textures are guaranteed to be loaded in memory before presentation
and subject responses occur.

don't know if it's platform-specific, but i'm running on a PowerBook G4 with an
ATI Mobility Radeon
9700 (128MB) on OS X 10.3... haven't tested on PC yet.

anyway, i'm going to play around with this more, including changing priority
scheduling and renicing (if necessary)

cheers, -=gabe
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: