[visionegg] Re: simple RSVP scripts
- From: Martin Spacek <mspacek@xxxxxxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Tue, 25 Jan 2005 15:05:06 -0800
On 2005-01-25 2:14 PM, Gabriel Nevarez wrote:
Hi martin,
seems to work, thanks!
the code is as such (in case anybody else is interested)
btw... any idea on how to ensure all files are loaded into memory
(first), besides doing some arbitrary wait loop?
Not sure what you mean. As far as I know, everything runs in a single
thread, so your loop to load the images won't finish until all the
images are loaded as texture objects. Only then will it go on to create
the viewport, and only then will it execute your custom presentation
loop. You shouldn't be experiencing any delay due to loading of images
in the presentation loop.
> ########################################################
> #
> #!usr/bin/pythonw
> # based on Andrew Straw's demo code
> # http://www.freelists.org/archives/visionegg/11-2002/msg00001.html
>
> from VisionEgg import *
> start_default_logging(); watch_exceptions()
>
> from VisionEgg.Core import *
> from VisionEgg.FlowControl import Presentation, FunctionController
> from VisionEgg.Textures import *
> from pygame.time import *
> import OpenGL.GL as gl
>
> import os
>
> photoX = ("01.bmp",
> "02.bmp",
> "03.bmp",
> "04.bmp",
> "05.bmp",
> "06.bmp",
> "07.bmp",
> "08.bmp",
> "09.bmp",
> "10.bmp")
>
> pwd = os.getcwd()
>
> #duration_per_image = 0.1 # seconds
> num_images = len(photoX)
>
> screen = get_default_screen()
>
> # Create list of stimuli
> preloaded_stimulus_list = [] # empty at first
>
> for i in range(num_images):
> # Read the texture file
> texture_name = os.path.join(pwd, 'data', photoX[i])
> texture = TextureFromFile(texture_name)
>
> # Load the texture to OpenGL, prepare for display
> stimulus = TextureStimulus(texture = texture,
> size = texture.size,
> # texture_min_filter=gl.GL_LINEAR
> )
> # Add to list of stimuli
> preloaded_stimulus_list.append( stimulus )
>
> ###############################################
> #
> # <procedural_version>
>
> viewport = Viewport(screen=screen)
>
> frame_timer = FrameTimer()
>
> num_loops = 100
>
> # show images
> for trialcounter in range(num_loops):
> for image_counter in range(num_images):
> viewport.parameters.stimuli =
> [preloaded_stimulus_list[image_counter]]
> screen.clear()
> viewport.draw()
> swap_buffers()
> frame_timer.tick()
>
> #
> # </procedural_version>
> #
> ###############################################
>
> frame_timer.print_histogram()
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
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- References:
- [visionegg] simple RSVP scripts
- From: Gabriel Nevarez
- [visionegg] Re: simple RSVP scripts
- From: Gabriel Nevarez
- [visionegg] Re: simple RSVP scripts
- From: Martin Spacek
- [visionegg] Re: simple RSVP scripts
- From: Gabriel Nevarez
Other related posts:
- » [visionegg] simple RSVP scripts
- » [visionegg] Re: simple RSVP scripts
- » [visionegg] Re: simple RSVP scripts
- » [visionegg] Re: simple RSVP scripts
- » [visionegg] Re: simple RSVP scripts
- » [visionegg] Re: simple RSVP scripts
- » [visionegg] Re: simple RSVP scripts
- » [visionegg] Re: simple RSVP scripts
- » [visionegg] Re: simple RSVP scripts
- » [visionegg] Re: simple RSVP scripts
- » [visionegg] Re: simple RSVP scripts
Hi martin,
seems to work, thanks!
the code is as such (in case anybody else is interested)
btw... any idea on how to ensure all files are loaded into memory (first), besides doing some arbitrary wait loop?
- [visionegg] simple RSVP scripts
- From: Gabriel Nevarez
- [visionegg] Re: simple RSVP scripts
- From: Gabriel Nevarez
- [visionegg] Re: simple RSVP scripts
- From: Martin Spacek
- [visionegg] Re: simple RSVP scripts
- From: Gabriel Nevarez