[visionegg] Re: screen.clear() requires 40ms....
- From: Andrew Straw <andrew.straw@xxxxxxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Wed, 27 Aug 2003 21:01:46 +0930
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dear Christoph,
My best guess is that OpenGL itself must be taking so long, but this
seems very strange. What drivers and hardware are you using? The
clear() method is a fairly minimal wrapping of glClear():
def clear(self):
"""Called by Presentation instance. Clear the screen."""
c = self.parameters.bgcolor # Shorthand
if len(c) == 4:
gl.glClearColor(*c)
else:
gl.glClearColor(c[0],c[1],c[2],0.0) # set alpha to 0.0
unless specified
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
I don't really have any hints at this point, except to make sure you're
not doing something silly... Perhaps try with a minimal program that
just calls screen.clear() and then add various bits until you find
something that makes it start taking so long. (Or maybe it already
takes so long with a minimal program?)
Cheers!
Andrew
On Wednesday, Aug 27, 2003, at 20:31 Australia/Adelaide, Christoph
Lehmann wrote:
Hi Andrew
the VE-fMRI project goes on..now I can read in by means of a simple
GUI (thanks to wxPython) the subject ID and the stimulus-file (where
the to be shown stimuli are listed).
One problem: the following code snippet is the essential part yielding
a problem:
this code shows me (my_debug_msg), that the screen.clear() routine
takes most of the times between 20 and 60ms.
..why this?
while (not pygame.event.peek((QUIT,KEYDOWN))):
while (not TRIGGER_RECEIVED):
poll the Lpt...
my_debug_msg.append('before clear.screen [ms]: ' + str(1000 *
(VisionEgg.time_func()-start_time)) )
screen.clear()
my_debug_msg.append('after clear screen [ms]: ' + str(1000 *
(VisionEgg.time_func()-start_time)) )
viewport.parameters.stimuli =
[preloaded_stimulus_list[stim_index]] #update the viewport
viewport.draw()
swap_buffers()
--
I cannot explain it.
Thanks for a hint
christoph
--
p.s.
the preloaded_stimulus_list[stim_index] comes from:
--
# Create a list of TextureStimulus instances, one with each of your
texture images.
preloaded_stimulus_list = [] #empty at
first
for stim_index in range(num_images): #for all
stimuli except the null-event create a texture object
if not photoX[stim_index] == nullevent:
# Read the texture file
texture = Texture(photoX[stim_index])
# Add to list of TEXTURES
x = screen.size[0]/2 - texture.size[0]/2
y = screen.size[1]/2 - texture.size[1]/2
# Load the texture to OpenGL, prepare for display
stimulus = TextureStimulus(texture = texture,size =
texture.size, lowerleft=(x,y))
else: #for the
nullevent, just append the nullevent-indicator
stimulus = nullevent
# Add to list of stimuli
preloaded_stimulus_list.append( stimulus )
viewport = Viewport( screen=screen)
--
--
Christoph Lehmann <lehmann@xxxxxxxxxxxx>
University Hospital of Clinical Psychiatry
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
-----BEGIN PGP SIGNATURE-----
iD8DBQE/TJao1xWcCSPVbpgRAkI0AKDw0kqB2adu+bZ6mkkq2VgA43PzhQCdFIrL
XzBEjB1G7i4yl7cDX7tFFbY=
=DrGv
-----END PGP SIGNATURE-----
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- Follow-Ups:
- [visionegg] Re: screen.clear() requires 40ms....
- From: Christoph Lehmann
- References:
- [visionegg] screen.clear() requires 40ms....
- From: Christoph Lehmann
Other related posts:
- » [visionegg] screen.clear() requires 40ms....
- » [visionegg] Re: screen.clear() requires 40ms....
- » [visionegg] Re: screen.clear() requires 40ms....
the VE-fMRI project goes on..now I can read in by means of a simple GUI (thanks to wxPython) the subject ID and the stimulus-file (where the to be shown stimuli are listed).
One problem: the following code snippet is the essential part yielding a problem:
this code shows me (my_debug_msg), that the screen.clear() routine takes most of the times between 20 and 60ms.
..why this?
while (not pygame.event.peek((QUIT,KEYDOWN))):
while (not TRIGGER_RECEIVED):
poll the Lpt...my_debug_msg.append('before clear.screen [ms]: ' + str(1000 * (VisionEgg.time_func()-start_time)) )
screen.clear()
my_debug_msg.append('after clear screen [ms]: ' + str(1000 * (VisionEgg.time_func()-start_time)) )
viewport.parameters.stimuli = [preloaded_stimulus_list[stim_index]] #update the viewport
viewport.draw()
swap_buffers()
--
I cannot explain it.
Thanks for a hint
christoph -- p.s.
the preloaded_stimulus_list[stim_index] comes from:
--
# Create a list of TextureStimulus instances, one with each of your texture images.
preloaded_stimulus_list = [] #empty at first
for stim_index in range(num_images): #for all stimuli except the null-event create a texture object
if not photoX[stim_index] == nullevent:
# Read the texture file
texture = Texture(photoX[stim_index])
# Add to list of TEXTURES
x = screen.size[0]/2 - texture.size[0]/2
y = screen.size[1]/2 - texture.size[1]/2# Load the texture to OpenGL, prepare for display
stimulus = TextureStimulus(texture = texture,size = texture.size, lowerleft=(x,y))
else: #for the nullevent, just append the nullevent-indicator
stimulus = nullevent
# Add to list of stimuli
preloaded_stimulus_list.append( stimulus )
viewport = Viewport( screen=screen) --
-- Christoph Lehmann <lehmann@xxxxxxxxxxxx> University Hospital of Clinical Psychiatry
====================================== The Vision Egg mailing list Archives: http://www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html
- [visionegg] Re: screen.clear() requires 40ms....
- From: Christoph Lehmann
- [visionegg] screen.clear() requires 40ms....
- From: Christoph Lehmann