LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: leopaule103 on August 25, 2021, 16:32:45

Title: Gif or video
Post by: leopaule103 on August 25, 2021, 16:32:45
Hello, I would like to know how to play a video or a gif with lwjgl ?
Title: Re: Gif or video
Post by: kappa on August 27, 2021, 20:11:21
Having look at the java bindings for either GStreamer (https://github.com/gstreamer-java) or VLC (https://wiki.videolan.org/Java_bindings/) might be a good starting place but you'll have to figure out how to hook them up to LWJGL (potential example (https://github.com/caprica/vlcj-lwjgl-demo)).
Title: Re: Gif or video
Post by: Lightbuffer on September 28, 2021, 14:31:21
Quote from: leopaule103 on August 25, 2021, 16:32:45
Hello, I would like to know how to play a video or a gif with lwjgl ?
I'm not sure about how to play video, but gifs can be played using by loading all frames from a GIF for example by either using this decoder (https://github.com/DhyanB/Open-Imaging/blob/master/src/main/java/at/dhyan/open_imaging/GifDecoder.java) or I think I saw there is a way to read GIFs using stb bindings. After all frames are loaded to separate textures (or frames are stored in memory and you update the data of the GL texture), you just bind them depending on animation time. It's probably not the best solution at all, but at least it works.