Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualiedoc

Posted 21 January 2013 - 07:22 PM

Your threads are both trying to access the screen, it looks like your render loop is faster so its calling present nonstop blocking the other thread from accessing it. My suggestion is to keep them in the same thread. I don't think you would benefit from using separate threads for this. Otherwise, you should look up mutexes or something, so the render function doesn't block the other thread from accessing the window. You could try creating a global boolean, setting it to true while the windows thread processes messages, then setting it to false after, and in your render thread, only present the screen when that global is false. But it would probably be more efficient and accurate if you just presented your screen in the same thread

By the way, this could leave bugs that are hard to catch and fix. The windows thread might try changing the window the same time as the render thread calls present, which could cause a noticeable glitch or even crash

#3iedoc

Posted 21 January 2013 - 07:21 PM

Your threads are both trying to access the screen, it looks like your render loop is faster so its calling present nonstop blocking the other thread from accessing it. My suggestion is to keep them in the same thread. I don't think you would benefit from using separate threads for this. Otherwise, you should look up mutexes or something, so the render function doesn't block the other thread from accessing the window. You could try creating a global boolean, setting it to true while the windows thread processes messages, then setting it to false after, and in your render thread, only present the screen when that global is false. But it would probably be more efficient and accurate if you just presented your screen in the same thread

By the way, this could leave bugs that's are hard to catch and fix. The windows thread might try changing the window the same time as the render thread calls present, which could cause a noticeable glitch or even crash

#2iedoc

Posted 21 January 2013 - 07:18 PM

Your threads are both trying to access the screen, it looks like your render loop is faster so its calling present nonstop blocking the other thread from accessing it. My suggestion is to keep them in the same thread. I don't think you would benefit from using separate threads for this. Otherwise, you should look up mutexes or something, so the render function doesn't block the other thread from accessing the window. You could try creating a global boolean, setting it to true while the windows thread processes messages, then setting it to false after, and in your render thread, only present the screen when that global is false. But it would probably be more efficient and accurate if you just presented your screen in the same thread

#1iedoc

Posted 21 January 2013 - 07:14 PM

Your threads are both trying to access the screen, it looks like your render loop is faster so its calling present nonstop blocking the other thread from accessing it. My suggestion is to keep them in the same thread. I don't think you would benefit from using separate threads for this. Otherwise, you should look up mutexes or something, so the render function doesn't block the other thread from accessing the window

PARTNERS