最近调用PyOpenGL做显示,想在程序启动时候调用Display List进行显示,但是glGenLists返回None,若在程序启动后调用则没有任何问题。
搜索谷歌后,给出的解释:
This can happen if you call glGenLists *before* you create any windows (or perhaps more accurately, before an OpenGL context
has been created.)
简而言之,必须先创建OpenGL的窗口才能使用Display List
解决办法就是,先让OpenGL进行redraw或者刷新一下,再调用glGenLists