开发者

How to embed SDL video in an existing OpenGL project

开发者 https://www.devze.com 2023-03-04 19:55 出处:网络
I\'m working on an OpenGL game, and would like to play video on 3D surfaces within the game. SDL seems to be an excellent choice for video playback, but is it possible to create the surface inside of

I'm working on an OpenGL game, and would like to play video on 3D surfaces within the game. SDL seems to be an excellent choice for video playback, but is it possible to create the surface inside of an existing OpenGL context? How would I go about doing this?开发者_如何转开发


SDL has, to my knowledge, no functions for video playback; don't be fooled by API names like SDL_Video. Those are actually used for window management.

What you need to do is using some video decoder library to decode video into image buffers, then pass these image buffers into an OpenGL texture. The open source video player mplayer (which internally uses the ffmpeg libavformat and libavcodec libraries for video/audio decoding) also has an OpenGL video output module. I suggest you fetch the mplayer source code and take a look into the OpenGL video output module, to get an idea how to do this.

EDIT:

Since you're using SdlDotNet, I suggest using a SdlDotNet.Graphics.SurfaceGl as target surface for the SdlDotNet.Graphics.Movie.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号