Hi there,
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 inside OnXxx()
event thread?
Thank you!
Hi there,
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 inside 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.