in reply to problem in exiting an OpenGL program
i press any key whether Escape or any other the program is hanging
It's not hanging, it's sleeping. Because you're asking it to sleep for 100 seconds after every key:
# Avoid thrashing this procedure # Note Perl does not support usleep # For finer resolution sleep than seconds, try: # 'select undef, undef, undef, 0.1;' # to sleep for (at least) 0.1 seconds sleep(100);
If you change that to 1, the "hanging" will go away. Better still would be to use Time::HiRes and usleep 100; which is probably what the author intended. Eg. Add
use OpenGL qw(:all); # Use the OpenGL module use strict; # Use strict typechecking use Time::HiRes qw[ usleep ];
at the top and change to:
# to sleep for (at least) 0.1 seconds usleep(100);
|
|---|