3b/cl-opengl

freeglut gets confused by odd DISPLAY set by emacs on windows (and possibly elsewhere?)

Opened this issue · 0 comments

3b commented

Emacs likes to set the DISPLAY environment for subprocesses to match the display of the frame running the process. This might be reasonable on X, but on windows it sets it to "w32" which just confuses freeglut causing warnings like

fgPlatformInitialize: CreateDC failed, Screen size info may be incorrect
This is quite likely caused by a bad '-display' parameter

Things may somewhat work after that, or not. Haven't figured out exactly what happens in that case.

Might be worth trying to detect that and override it, either by finding/writing a portable getenv/setenv (uiop maybe?) or just forcing a -display argument to glutInit on windows in hopes it overrides DISPLAY.

As a workaround, adding

(when (equalp (sb-ext:posix-getenv "DISPLAY") "w32")
  (require 'sb-posix)
  (funcall (find-symbol "SETENV" :sb-posix) "DISPLAY" "" 1))

to .sbclrc (and similar for other lisps) seems to help.

probable cause of #44?