I have implemented video playback in a dynamic 3D scene and it works alright, but being new to Opengl I would like confirmation that this is a good way to implement - or information about a better way.
What I do is simply to sequentially read in every frame of the video and create a texture for each frame. There may be several GB of texture data this way. The system is win7 64 bit with plenty of system memory and a geforce 9800 with just one GB memory and in a pci-e bus. The textures are ARGB up to 1920x1080 in size.
Every time I render a new scene frame, I switch to the next frame texture and render the textured object. The render speed matches the playback speed of the video which is 50 FPS.
Since the textures can not all be on the graphics card, they are swapped in and out from system memory to the graphics card as needed. It seems to work fine without ever lagging behind.
But… it is a very simple method and I do not know the details behind how opengl prioritizes swapping the textures, so currently I can just note that it seems to work for now during testing, but I cannot feel much confidence in the method since I don’t really know the details.
Is my method sound or is there a better alternative?