The glGenList() is not working under multithreading but it works fine without multithreading. Can anyone help me? Thanks.
You need to make the GL context to your thread before making GL calls. Use wglMakeCurrent on Windows.
Hi, if say I initialize the device Context and rendering context in the main thread, later I create a new thread to create fonts which will call glGenList() and after finish the process the thread will end and the fonts that created in the new thread will be used in the main thread. May I know how to make the “GL context to the thread” Is it recreate a new device Context and rendering context in the new thread by the following function ?
IntPtr dc = User.GetDC(windowHandle); // Attempt to get the device context IntPtr rc = Wgl.wglCreateContext(dc); // Attempt to get the rendering context
When I go back to the main thread, do I need to recreate a new device Context and rendering context for the main thread?
An OpenGL context is bound to a thread. You cannot call GL commands for a context from a different thread. With other words, keep all GL commands in the same thread. You can also create a new context in a new thread and use wglShareLists to share their list space. This should be described in the wiki.
Thanks for the reply ! I will try it later.