Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Loading Gif and Playing it on Dx8


hisherwin
 Share

Recommended Posts

I've checked into this before and I don't think it is possible. I have no idea how gifs are encoded so this may seem like gibberish but there may be a library out there that gives the individual frames as a png or or bmp or in some other format which can then be rendered.
Link to comment
Share on other sites

> I've checked into this before and I don't think it is possible. I have no idea how gifs are encoded so this may seem like gibberish but there may be a library out there that gives the individual frames as a png or or bmp or in some other format which can then be rendered.

I saw some projects that render gif image frame by frame but it's hard to figure out how to sort the codes or clean it
Link to comment
Share on other sites

> I saw some projects that render gif image frame by frame but it's hard to figure out how to sort the codes or clean it

Actually in VB6, you use a wrapper of DirectX8 called D3DX in order to load texture, in fact in professional game development it isn't used or rarely (right now in DirectX11 it does not even exist), game studio usually create their own wrapper to load model, texture, manage vertex and so on.

With this wrapper you are only able to load format microsoft decided to work with, so it could be very limited.

The best solution would be in fact to create your own wrapper and to manage all the format you need to use in your game, but it will be complicated mostly because you would have to get your hands on C++  and I personally think getting in such thing in VB6 is useless…

So there many of acting against this problem.

In first case you found a DLL which read the data related to the gif format and store it in VB6 Type (Animation, Image on Frame) and you use these to create several texture from memory using D3DX :

1 frame => 1 Texture

(but I think you won't find something which will create .bmp or one .gif per frame from an animated gif allowing you to create a texture from these).

Maybe I would be searching something like a gif frame extractor which save you all the frame of the gif into a .bmp written in VB6.

And your job would be to don't save these file to a .bmp on your hard drive but to store them in your memory. 

Look a this :

[http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=66620&lngWId=1](http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=66620&lngWId=1)

(Maybe a look to GDI+ could be cool too because you may already use it in your project).

One other case would be to try to look how the GIF format is encoded (you can found this on wikipedia for instance).

And write a class to read all the data stored in a .GIF it's a bit more complicated because you would have to do it by yourself and it could be even more difficult if you haven't do this before.

But it could be a great things to understand the way how picture are encoded for you personal experience.

If I have time I will add some extra things to guide you a bit more if you're still blocked.
Link to comment
Share on other sites

Are you sure it wasn't a spliced sprite in a gif format which the animation was played in a method like a sprite sheet?

Because if you were drawing an animated gif in DirectX I feel like it would try to leave old frames drawn while drawing new ones on top. The way you would render an animation in DirectX would be, splice image, Draw Frame, Clear, Draw Next Frame, Clear, Draw Next Frame, and so on.
Link to comment
Share on other sites

> Are you sure it wasn't a spliced sprite in a gif format which the animation was played in a method like a sprite sheet?
>
>  
>
> Because if you were drawing an animated gif in DirectX I feel like it would try to leave old frames drawn while drawing new ones on top. The way you would render an animation in DirectX would be, splice image, Draw Frame, Clear, Draw Next Frame, Clear, Draw Next Frame, and so on.

Well i don't know for sure, I just download a mp4 video and convert it to gif..

If it is possible to play mp4 video on DirectX, then that would be better (but i guess it's not possible)
Link to comment
Share on other sites

> Well i don't know for sure, I just download a mp4 video and convert it to gif..
>
> If it is possible to play mp4 video on DirectX, then that would be better (but i guess it's not possible)

No it's not, and in a sense, gifs can't be rendered in DirectX. Animtions work by playing images which are cut into frames, like sprite sheets. Also, Media files can't be drawn either, but there are libraries that can play Media Files. However, I doubt VB6 has anything for it. MP4 wasn't really around when VB6 had its time, and if it was, it wasn't very big. I think the media type of that time was MPEG videos and flash videos. You might be able to convert MP4 to flash easily. Eclipse Stable had a Flash Player in it, you can rip that part from it.
Link to comment
Share on other sites

> You want to load a GIF?, With my solution you can make a GIF with a timer.

I didn't get what you mean..

Well anyway, i'll just stick with the method i have on playing gif image on VB6 project, it's just that method pause or get stuck for a few moment when loading the gif image which i don't like that's why i'm asking here ehe
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...