Playing a video on a texture problem

Hi all…I’ve been working on an AVI player that plays AVI’s on a polygon as a texture. All works well until my video reaches frame#74. hen the apllication crashes.

The AVI I’m playing is in 24 bit colors ans has 202 frames and measures 256x256 pixels. My video card is a first generation RIVA TNT card with 16MB of RAM and I’ve got 256MB RAM of system memory.

What I’m thinking the problem is,is that I run out of video memory for my textures.74 frames of texturs = 74x3x256x256 = 14548992 bytes of memory.Which basically takes up all my video card’s memory.If I try to load up 75+ frames then my application crashes. Correct me if I’m wrong,but if I don’t have enough Video RAM,doesn’t OpenGL use my system RAM instead? If so,then I am completely lost as to what the problem is.

Does anyonw have any other suggestions as to how I can play ll my 202 frames on the polygon (without loading 75 frames at a time)
Thanx in advance for your help!

With your initial problem on vid ram and what not, ‘sorry I cant attempt to help.’ For your AVI->texture prob…

Ok draw your polygon with your frame 1 texture bound

use glTexSubImage2D() to replace part of or all of your frame1 texture with your incomming frame2 texture (you have this spooled from disk or in ram somwhere Continue this with all your frames.

This is supposebly less expensive than creating a new texture.
Alternativelly you could create and delete your textures on the fly.

The RedBook ISBN 9 780201 604580 covers this area very well. I advice you to read it as it covers this call in depth. You can also read the book online I dont know the address, but it was mentioned on this board recently.

Hope to help

Thanx dans! I’ll look into that right now!

I tried to create and delete my textures on hte fly but it was WAY too slow (I was loading from the Hd so I’m not so sure why )

But if anyone has any idea about my initial problem,please email me or post.Dans’s idea might work but I’m one of those people who can’t let go of such problems till I’ve figured them out.

Hey Dans,I tried your idea but my application runs REALLY slowly since it keeps loading the data from the HD. Anyone have any other suggestions? How do other games implement such video scenes in their games and stuff using OpenGL?

Ok try loading all the images into memory at init time instead of spooling them from disk frame by frame then point glTexSubImage at these pre-loaded images. Basically your making your own texture objects. This should increase your speed dramatically. I did some tests with glTexSubImage2D by bliting a 256x256 RGBA image and could pull approx 40 frames p/sec without noticable slow down. (p3-500/GeForce DDR)
You are still looking at around 40mB of data at 256x256x24bit so your going to have some swapping be it from system->video memory or disk->system memory->video mem.

Hope this helps

[This message has been edited by dans (edited 06-14-2000).]

I think one could also make up a few big textures which would contain the avi, like a film for a camera and then just shift the texture coordinated every frame (using the texture matrix)