forked from KhronosGroup/COLLADA-CTS
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change OpenGL execution to a forked subprocess, and run it before wxw…
…indows is imported. Newer versions of wx can use OpenGL under the hood, resulting in "glutInit being called a second time" and often segfaulting the process.
- Loading branch information
Showing
4 changed files
with
38 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import sys | ||
import multiprocessing | ||
|
||
GL_VENDOR = None | ||
GL_RENDERER = None | ||
|
||
def get_opengl_info(q): | ||
import OpenGL.GL | ||
import OpenGL.GLUT | ||
|
||
def __DummyDisplayFunc(): | ||
pass | ||
|
||
OpenGL.GLUT.glutInit(sys.argv) | ||
# need to create a window before glGetString will return something | ||
OpenGL.GLUT.glutInitWindowSize(640,480) | ||
winId = OpenGL.GLUT.glutCreateWindow("dummy") | ||
OpenGL.GLUT.glutDisplayFunc(__DummyDisplayFunc) | ||
GL_VENDOR = OpenGL.GL.glGetString(OpenGL.GL.GL_VENDOR) | ||
GL_RENDERER = OpenGL.GL.glGetString(OpenGL.GL.GL_RENDERER) | ||
OpenGL.GLUT.glutDestroyWindow(winId) | ||
|
||
q.put((GL_VENDOR, GL_RENDERER)) | ||
|
||
if GL_VENDOR is None: | ||
q = multiprocessing.Queue() | ||
p = multiprocessing.Process(target=get_opengl_info, args=(q,)) | ||
p.start() | ||
GL_VENDOR, GL_RENDERER = q.get() | ||
p.join() |