Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid getting repeated tick timers when restarting main loop #69

Merged
merged 1 commit into from Jan 6, 2017

Conversation

epeld
Copy link
Contributor

@epeld epeld commented Dec 30, 2016

Hello!

I've run into an issue where tick-events fire on my glut windows once for every time I've entered glutMainLoop.

The reason seems to be that there is no way to cancel glut timers so they persist when leaving the main loop. Old timers stick around inside glut until the main loop is entered again. Since the main window always gets the same id (== 1), both old and new tick timers will have the same window id so they will all fire the window's tick-callback.

I was running SBCL on a Mac when I saw this.

I solved the issue by giving each tick-timer a unique id and providing an indirection through a lookup table from tick-timer-id to window-id. That way, I can clear out a window's tick timers by just removing its entries from the lookup table.

Another approach that I guess would work equally as well is to give each window a unique id.

Hope this makes sense.

@3b 3b merged commit 34636d9 into 3b:master Jan 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants