Help with using SDL_WaitEvent() w / OpenGL

hi,

im working on a map editor for my game w / C++, OpenGL and SDL. ive been taking
input by calling SDL_PollEvents(). this works fine, but since this is a map
editor and theres no background processes, id like to save that 99% of the CPU
power and wait for events rather then poll. but when i switch “Poll” with
"Wait", it locks the program up. does anyone know if this works with OpenGL, and
if so, what am i doing wrong? is there something i have to do special if im
waiting for events ? thanks for any help!!

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is very simple : when calling “wait”, the main thread goes in "WAITING"
state (which is like sleeping waiting for an OS event). It waits for the SDL
Event Manager Thread to wake it up.

The solution is simply to use a separate thread for the processing of the
event (changing the logical state of the GUI) and using thread
synchronization tokens (mutex, semaphores, …) to warn the GUI drawing
thread of the changes, making it sleeping too when nothing has to be done.

This is a multithreaded implementation of the Control-View model.

Le samedi 10 Juillet 2004 02:32, Drew Ferraro a ?crit :

hi,

im working on a map editor for my game w / C++, OpenGL and SDL. ive been
taking input by calling SDL_PollEvents(). this works fine, but since this
is a map editor and theres no background processes, id like to save that
99% of the CPU power and wait for events rather then poll. but when i
switch “Poll” with “Wait”, it locks the program up. does anyone know if
this works with OpenGL, and if so, what am i doing wrong? is there
something i have to do special if im waiting for events ? thanks for any
help!!


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


Michel Nolard
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA8Rc5yAKwOMHoSb0RAlqmAJ4sCNSbmJ5aOjQPGloIANPfuxWuJQCghvVH
rt7tQT/1TT2hkdh/psWWbKc=
=D4PG
-----END PGP SIGNATURE-----