Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualsamoth

Posted 08 January 2013 - 06:59 AM

I can't tell whether wglMakeCurrent really leaks or whether there is a different reason for what you see, but if you need to call wglMakeCurrent more than 2-3 times in a program, you're very likely doing something wrong.

Usually you will have one render thread (for most people that is the main thread, too). Often you have worker threads to fill buffers (given a pointer to a mapping), too.
Sometimes you have shared contexts and two threads (one for rendering, one for uploading data), but this is rarely done both for added overhead and complexity.

You really never want to have a hundred or a thousand threads with a hundred/thousand contexts. You also really do not want to call wglMakeCurrent in the middle of your program, because it kills the pipeline.

What you want to do is create one (or at most two or three) threads that will deal with OpenGL, and one (or at most two or three) contexts. Then you want to make exactly one context current in one thread. And then you never want to change that again.

#1samoth

Posted 08 January 2013 - 06:58 AM

I can't tell whether wglMakeCurrent really leaks or whether there is a different reason for what you see, but if you need to call wglMakeCurrent more than 2-3 times in a program, you're very likely doing something wrong.

 

Usually you will have one render thread (for most people that is the main thread, too). Often you have worker threads to fill buffers (given a pointer to a mapping), too.

Sometimes you have shared contexts and two threads (one for rendering, one for uploading data), but this is rarely done both for added overhead and complexity.

 

You really never want to have a hundred or a thousand threads with a hundred/thousand contexts. You also really do not want to call wglMakeCurrent in the middle of your program, because it kills the pipeline.


PARTNERS