I was happy to get my first C++ app working after a few hours of hacking this afternoon. The app trades the X-dimension for the time-dimension in a video.
Any suggestions for how to optimize the source would be welcome, but I'm interested in how to do the image processing that I'm doing in update()
in a way that doesn't make the app so unresponsive.
(Crossposted in libcinder forum: http://forum.libcinder.org/#Topic/23286000000669039 )
The answer seems be threading. It works like this with 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());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With