Display surface for specified amount of time

hi,

i am interested in using sdl for collecting human data in experiments on
vision. i need a way
to display an image on a computer screen for a specified amount of time
(in milliseconds with just + or - a few millisecond error) and be
confident that nowhere in that time will a partial frame be shown on the
screen (sync to the vertical refresh of the monitor). i also need a way
to a quickly as possible change the image on the screen after a keypress
on the keyboard. is SDL well suited for this purpose?

i think that double buffering and using a SDL_HWSURFACE is the first
idea and from what i have read the blitsurface command syncs to the
vertical refresh of the monitor. can the SDL timers work to get me the
kind of timing accuracy i am discussing here? what is the temporal
resolution of capturing a keypress and updating the display surface in
memory for most hardware?

does anyone know of a way to gauge what these timings are for a
particular system?

thanks for any advice,
todd

todd gureckis:

hi,
i am interested in using sdl for collecting human data in experiments on
vision. i need a way
to display an image on a computer screen for a specified amount of time
(in milliseconds with just + or - a few millisecond error) and be
confident that nowhere in that time will a partial frame be shown on the
screen (sync to the vertical refresh of the monitor). i also need a way
to a quickly as possible change the image on the screen after a keypress
on the keyboard. is SDL well suited for this purpose?

i think that double buffering and using a SDL_HWSURFACE is the first
idea and from what i have read the blitsurface command syncs to the
vertical refresh of the monitor. can the SDL timers work to get me the
kind of timing accuracy i am discussing here? what is the temporal
resolution of capturing a keypress and updating the display surface in
memory for most hardware?

does anyone know of a way to gauge what these timings are for a
particular system?

thanks for any advice,
todd

SDL has the timer accuracy you need, but dunno if has enogh refresh speed.
If you’re under Linux, you may want to use gettimeofday (has a reliable
resolution of 10000Hz) and framebuffer, which gives you almost direct access
to video memory.
On my rivaTNT32 i get 200 fps with single buffering (that means that during
rewrite a partial image is shown for about 5 milliseconds) and is quite easy
to implement a double buffering or page flipping, increasing performances.
However i think the bottleneck is the monitor.
To detect keypresses just use select().

Hope it helps,
Francesco Orsenigo, Xarvh Project

Most monitors don’t refresh more often than 120 Hz… If you are
exceeding that, you aren’t working with vsync… so the minimum time a
partial image can be show is in fact 1 screen refresh, or 8.333 ms. The
other problem with fbcon you don’t know (I don’t think) when the vsync
is…

David, how’s that vsync code comming???

Best wishes,

-LorenOn Sat, 2002-08-31 at 00:00, Francesco Orsenigo wrote:

On my rivaTNT32 i get 200 fps with single buffering (that means that during
rewrite a partial image is shown for about 5 milliseconds) and is quite easy
to implement a double buffering or page flipping, increasing performances.
However i think the bottleneck is the monitor.
To detect keypresses just use select().

Take a look at:

http://www.vr.clemson.edu/eyetracking/vrlab/education.html

There is alot of eyetracking/human visual system software there. It’s
GTK/OpenGL based. But it shouldn’t be too bad to port to SDL.

nathanOn Fri, 2002-08-30 at 20:13, todd gureckis wrote:

hi,

i am interested in using sdl for collecting human data in experiments on
vision. i need a way
to display an image on a computer screen for a specified amount of time
(in milliseconds with just + or - a few millisecond error) and be
confident that nowhere in that time will a partial frame be shown on the
screen (sync to the vertical refresh of the monitor). i also need a way
to a quickly as possible change the image on the screen after a keypress
on the keyboard. is SDL well suited for this purpose?

i think that double buffering and using a SDL_HWSURFACE is the first
idea and from what i have read the blitsurface command syncs to the
vertical refresh of the monitor. can the SDL timers work to get me the
kind of timing accuracy i am discussing here? what is the temporal
resolution of capturing a keypress and updating the display surface in
memory for most hardware?

does anyone know of a way to gauge what these timings are for a
particular system?

thanks for any advice,
todd


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl