开发者

glGenLists(1) return 0 outside OnPaint() with wxThread

Currently, I am trying to separate the display list from the OnPaint(), but glGenLists(1) return 0.

Is there any prerequisite on using display list?

Is function glGenLists(1) only survive insid开发者_运维知识库e OnXxx() event thread?

Thank you!


The only requirement is having a valid OpenGL context made current. You probably don't have one. If you use multiple threads, you need to use multiple GL contexts which share objects.


From what I understand, OpenGL can be used across multiple threads (with some caveats), but you should avoid doing so when possible. glGenLists is probably failing because, as mentioned, you are calling it in a different thread than the one you used to create your OpenGL context. If you can, I would suggest moving something other than OpenGL calls to the second thread.


OpenGL and threads do not mix. If you really needs threads, call OpenGL functions only in one threads.

As already said, the glGenLists returns 0 on errors. Check the error with glGetError function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜