今天下午经过几个小时的黑客攻击后,我很高兴能够运行我的第一个 C++ 应用程序。该应用程序将视频中的 X 维度换成时间维度。
任何有关如何优化源的建议都将受到欢迎,但我对如何以一种不适合的方式在 update()
中进行图像处理很感兴趣使应用 react 迟钝。
(在 libcinder 论坛中交叉发布:http://forum.libcinder.org/#Topic/23286000000669039)
最佳答案
答案似乎是线程。它在 Cinder 中是这样工作的:
void MyApp::setup()
{
thread(&MyApp::processFrame, this);
}
void MyApp::processFrame()
{
// TODO define mFrameTemp here
// Copy to the texture which we'll actually render
mFrame = mFrameTemp;
}
void MyApp::draw()
{
if (mFrame)
gl::draw(mFrame, mFrame.getBounds());
}
关于c++ - 线程 : doing processing in background of C++ Cinder app to keep the UI responsive,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5160189/