9
\$\begingroup\$

Is there a library that will let me load a movie file and play it in an OpenGL application? Or maybe just a code sample that someone has lying around? I'm also using GLUT, if that makes a difference. I guess file format doesn't matter, although currently my movie is in AVI format.

\$\endgroup\$
  • \$\begingroup\$ I'd love to see some lib that uses ffmpeg and supports like literally everything. \$\endgroup\$ – akaltar Sep 11 '15 at 17:31
4
\$\begingroup\$

Well, there's this very ancient tutorial that plays an AVI video using fixed function GL and the Windows API.

I don't recommend using this setup, since it is very outdated, but the concept is basically valid. Get each frame of the video and use it to update an OpenGL texture. That simple.

If you run into performance issues, then you can start thinking about optimizing with things like Pixel Buffer Objects.

\$\endgroup\$
  • \$\begingroup\$ Honestly, "Windows" only isn't good enough. If one doesn't support all platforms then they are hurting everyone else by giving Microsoft the power that they don't deserve. \$\endgroup\$ – Lolums Sep 11 '15 at 19:24
  • \$\begingroup\$ @Lolums, assuming you're 100% committed to the platform, then I think it's fine to use a system-specific API. But yeah, writing portable code should be the default. Even if you use a platform API, at least write a thin wrapper over it to avoid leaking the implementation details and facilitate future porting needs. \$\endgroup\$ – glampert Sep 11 '15 at 19:58
1
\$\begingroup\$

If you're happy to use the ogg theora format, then you could use the TheoraPlay lib. There's a fully functioning plugin for the Duality engine here that you could use for reference - https://github.com/Andrea/DualityOgvPlayerPlugin. It works with opengl.

\$\endgroup\$
1
\$\begingroup\$

First off, you might want to check these questions / answers out. I don't know how much of either is iOS specific, but they might help:

Beyond that, limitz/AV3D is a somewhat recent C++ project uses libavcodec to stream a movie into an OpenGL texture

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.