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

Already on GitHub? Sign in to your account

glut:close fails to close window #28

Merged
merged 1 commit into from Jun 12, 2011

Conversation

Projects
None yet
3 participants

luismbo commented Jun 12, 2011

I'm running through some examples on http://nklein.com/tags/opengl/ and fail to get (glut:close win) to close the window. It does stop the glut processes from executing, but the window hangs around. It looks like calling glut:close is the proper thing per the interface.lisp file, however, hitting #/q or manually entering a glut:close command fails. Is there something I am missing?

I see that I can use glut:destroy-current-window....but I would expect glut:close to work.

Running on Ubuntu 10.10, SBCL 1.0.40.0.debian
https://github.com/3b/cl-opengl.git
master

Contributor

luismbo commented Jun 11, 2011

IIRC, glut:close is the event handler.

Owner

3b commented Jun 12, 2011

Right, my understanding is that glut:close is the callback to tell application code that the window has closed, and glut:destroy-current-window is the correct way for the application to close a window.

It look like glut:close calls destroy-window on darwin, though, which is probably why it worked in the original code but not on ubuntu. Not sure if there is some specific reason for calling it on darwin and not elsewhere. If not, don't know whether it would be better to remove the extra darwin code. or make it destroy the window on all platforms...

Contributor

luismbo commented Jun 12, 2011

I didn't recall why the call to destroy-window was there either, so I investigated a bit and documented it in the attached commit. Turns out pressing a window's close button under Apple's GLUT will invoke the close event and remove the window from the main loop, but it doesn't destroy it.

3b added a commit that referenced this pull request Jun 12, 2011

@3b 3b merged commit 88010b5 into 3b:master Jun 12, 2011

Owner

3b commented Jun 12, 2011

hmm, didn't mean to close this, and it won't let me reopen it :/

That leaves the question of whether we should try to make the behavior of directly calling glut:close consistent between platforms or not, either by calling it on all platforms, or by only calling it on darwin when called from the low-level callback

Owner

3b commented Jun 12, 2011

Continued on #29, since i guess "don't do that" is a reasonable answer to the original issue in the current API, even if the API does need more work.

thanks for the info

luismbo added a commit to luismbo/cl-opengl that referenced this pull request Jun 12, 2011

Move CLOSE event bookkeeping out of the high-level callback GF.
This addresses github issues #28 and #29 which describe a situation
where calling GLUT:CLOSE directly closes windows on darwin only. With
this change, the darwin-specific behaviour is only ever invoked from
the low-level callback. Since we no longer have GLUT:CLOSE methods
for the base window classes, calling GLUT:CLOSE directly will not
actually close windows on darwin (nor any other platform) and will
result in a NO-APPLICABLE-METHOD error if no methods were defined for
specific window classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment