我遵循了火焰opengl 火呼吸Opengl教程,它可以工作,但当我调整大小或滚动页面时,它会开始闪烁,所以我在web上搜索一个解决方案,但是除了一个小提示之外,我没有找到任何东西。
FireBreath技巧:在Windows上绘图
上面写着:
无论何时收到RefreshEvent,都必须重新绘制。如果使用辅助线程绘制,请确保有某种方式将消息传递给该线程,否则会闪烁。
因此,我想要做的是,找到一种将重绘消息传递给绘图线程的方法,我使用Boost等效于ManualResetEvent强制主线程重绘,但没有发生任何事情。
我使用的代码:
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
}
}发布于 2013-01-18 22:44:09
似乎我记得有人有这个问题,并通过处理[医]埃氏病消息来修复它。你可以试试。
https://stackoverflow.com/questions/14403217
复制相似问题