c++ - 线程 : doing processing in background of C++ Cinder app to keep the UI responsive

标签 c++ image background

今天下午经过几个小时的黑客攻击后,我很高兴能够运行我的第一个 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/

相关文章:

c++ - C++ 函数中的内存泄漏,visual studio 2012,链表

c++ - Box2D 对象调用 ApplyForce 函数时如何判断点

c++ - 仿函数参数和结果的任意类型转换

html - 如何对齐 <h1> HTML 旁边的图片

Javascript - 替换appendChild元素

html - 使用 CSS 延长按钮的长度

swiftui - 如何对齐 View 底部尾随,覆盖在 SwiftUI 中剪辑在屏幕边缘的另一个 View 上?

c++ - 在 gdb 调试器中识别符号的源文件名

python - 使用 Pillow 和 Python 3 从 RGB 列表创建图像

javascript - 样式自定义日期选择器