1

I followed the firebreath opengl Firebreath Opengl tutorial, it works but it start flickering when I resizeing or scrolling the page, so I searched the web for a solution but I did not find any thing except for a small hint

FireBreath Tips: Drawing on Windows

it says:

Whenever a RefreshEvent is received, you must redraw. If you are using a secondary thread to draw, make sure you have some way of passing the message to that thread or you will get flickering.

so that what I tried to do, find a way to pass redraw message to the drawing thread, I used Boost equivalent of ManualResetEvent to force the main thread to redraw but nothing happened.

the code I used:

bool threadedOpenGLTestPlugin::draw( FB::RefreshEvent *evt, FB::PluginWindow* win )
{
   Event.Set(); // Event is Boost equivalent of ManualResetEvent
   //Refresh Events... nothing todo since the opengl is running in it's own thread
   return true;
}
void threadedOpenGLTestPlugin::drawThreaded()
{
   while(true)
   {
      Event.Wait(30);// the event waits for 30 milisec or for event fired by the threadedOpenGLTestPlugin::draw function
      Event.Reset();
      //.......... drawing loop 
   }
}
Community
  • 1
  • 1
user1748906
  • 526
  • 4
  • 13

1 Answers1

1

Seems like I remember someone having this issue and fixing it by handling the WM_ERASEBKGND message. You could try that.

taxilian
  • 14,229
  • 4
  • 34
  • 73
  • it works thanks a lot, but why dose the getSuppressEraseBackground() return false by default ? – user1748906 Jan 19 '13 at 15:13
  • Huh. Didn't know that was there; I didn't add that =] I think it's false simply because that is the default behavior. – taxilian Jan 19 '13 at 17:03