Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Async Movie Load
qtime::MovieGlRef loadMovie( const ci::gl::ContextRef &context, const ci::fs::path &path ) {
ci::ThreadSetup thread_setup;
try {
context->makeCurrent();
auto movie = qtime::MovieGl::create(path);
return movie;
}
catch( std::exception &exc ) {
CI_LOG_E( "Error loading texture: " << exc.what() );
return nullptr;
}
}
auto context = gl::Context::create(gl::context());
auto future = std::async(std::launch::async, loadMovie, context, movie_path);
future.wait();
movie = future.get();
movie->play(); // crash usually occurs at this point
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.