[visionegg] Re: simple RSVP scripts

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?


(Note, you've posted a longer email regarding this after I had composed most of this email. But this email is still relevant.)

I guess that what you mean (although you may not know it) is loading the texture data into graphics memory. (Your code should get the data into system memory by the time it's done executing, as Martin says.)

Basically, there's an issue of "resident textures" -- graphics cards have to load the texture data from system memory in order to be used.

I've just added the following methods to the CVS version of TextureObject class in src/Textures.py:

   def is_resident(self):
       return gl.glAreTexturesResident( self.gl_id )

   def set_priority(self, priority):
       gl.glPrioritizeTextures( [self.gl_id], [priority] )

This will let you see if the texture object is "resident" (loaded) into the graphics memory and allow you to set its priority. Unfortunately, I've just played around with these functions by modifying the image_sequence_fast demo, and couldn't figure out a way to get the texture object resident without actually drawing it. (I found your suggestion of waiting interesting, but after various attempts using time.sleep(), including up to 10 seconds, I concluded simply waiting does not help.)

What does help, at least on my system (Debian sarge x86, nvidia graphics drivers, ...) is to draw the stimuli once (offscreen, before beginning your actual experiment). For your program, this could be acheived via:

[stimulus.draw() for stimulus in preloaded_stimulus_list]

(and then do a screen.clear() if need be).

Although not terribly enlightening on these sorts of details, this article may give a "bigger picture" background: http://www.gamasutra.com/features/19990723/opengl_texture_objects_07.htm (turn off java script if you don't want to deal with logging in).



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

Other related posts: