PDA

View Full Version : Movies in OpenGL



dawn
03-22-2001, 12:54 AM
I've worked on a program that do the thing, but is very slow (i get every frame and make it texture; even when the textures are small the speed won't go up). I'm using the API functions for reading an AVI.
Is possible to work with DirectMedia in the same way (frame->texture) ?

Tom Nuydens
03-22-2001, 01:14 AM
Originally posted by dawn:
I've worked on a program that do the thing, but is very slow (i get every frame and make it texture; even when the textures are small the speed won't go up). I'm using the API functions for reading an AVI.
Is possible to work with DirectMedia in the same way (frame->texture) ?

There shouldn't be any performance problems even with the VFW functions. Can you tell us a bit more about how you create the textures (which format, which resolution, and how they get sent to the card)?

- Tom

zed
03-22-2001, 03:13 AM
youre use glTexSubImage2d(...) to update an existing texture i hope with the new image.
creating a new texture each frame is gonna kill performance

dawn
03-22-2001, 03:28 AM
Not the textures are the big problem; they are created very fast. Reading the frames is the problem: each of them is read from the disk => 60 fps->2fps. Another thing is that I use DivX movies for testing (i don't think that is a major problem).

Tom Nuydens
03-22-2001, 03:35 AM
Originally posted by dawn:
Not the textures are the big problem; they are created very fast. Reading the frames is the problem: each of them is read from the disk => 60 fps->2fps. Another thing is that I use DivX movies for testing (i don't think that is a major problem).

Well, I've only tried it with uncompressed movies, so that might have something to do with it. If your movie isn't too big for this to be practical, you might want to give it a shot.

- Tom

dawn
03-22-2001, 03:53 AM
Anything about DirectMedia (works with all the media formats) ?

Tom Nuydens
03-22-2001, 04:14 AM
Someone submitted a DirectShow-based demo to my site some time ago, but he decompressed the video into system RAM at startup, and then played it from there. If your video is too big to be stored uncompressed, then it's definitely going to be too big to be used like this. Anyways, here's the demo: http://www.gamedeveloper.org/delphi3d/download/VideoTex.zip

I also wrote one that uses Video For Windows to stream uncompressed video from the HD: http://www.gamedeveloper.org/delphi3d/projects/u3d/files/demos/vid2tex.zip

- Tom

dawn
03-22-2001, 04:20 AM
Thanks, Tom

Lars
03-22-2001, 06:11 AM
DivX can be a problem, cause it is eating your processor for breakfeast :-)

So you need at least 400 Mhz to smoothly play an full resolution (640x480 and up) DivX.
If you then wan't to make some 3d rendering aside, you should have much more processing power.

Lars

dawn
03-22-2001, 07:04 AM
The computer is Celeron II 600, 192MB RAM => it's no problem. But i wonder why similar programs using DirectDraw or Direct3D + DirectMedia work very well. I'm not very documented about the interfaces between DirectMedia and graphic renderers (from DirectX). I think the best way to generate textures from a movie clip is using a sort of buffering (read a bunch of frames and transform they all in a list of textures). My opinion is that reading each frame from disk decrease speed. So, the problem is how to read many frames.

jwatte
03-22-2001, 10:53 AM
I believe that your use of the DivX codec is the main performance problem. Have you timed the decompression call (using QueryPerformanceCounter) so you know how much time it's taking?

I don't think batching the read into many frames would help that much, unless the video-for-windows implementation is very very stupid about buffering. Depending on the codec, there could be some cache locality gains, too.

Try using a codec which decompresses faster,
such as Intel Indeo.