Creating a professional demo

I’m writing an opengl program and would like to send it out w/o having to include all the bitmap images. I thought of the idea of an .avi file. That way, the program would be captured at the speed my computer runs. I don’t think I would have to worry too much about the speed of the user’s computer. Does anyone know how to capture an opengl program and create an .avi file in the process?

There’s probably a better way, but off the top of my head:

[ul][li] Capture lots and lots of frames to BMPs, TGAs, or whatever[*] Assemble said frames into AVI[/ul][/li]
Or (and this will probably be easier, but crappier quality, or require buying equipment):

[ul][] Get a video card with SVIDEO out, and one of them video capture boards.[] Connect svideo out to svideo in[*] Run demo, capture AVI[/ul]

The problem that your going to really run into is the speed of grabing the pixels from OpenGL and saving to a file is really slow. I was only to ever get it going realtime in resolutions 320240 and less. If you do decide to go this route there are multiple shareware programs that can compile a list of bmp’s to an avi file.(on tucows look for gif animators). The slowdown comes from both openGL and your hard drive, an interesting test would be trying to write some sort of really fast jpeg compressor, if you could compress it to a small file faster than the cost of saving the huge file you may be able to get higher resolutions running realtime. But even then I doubt it, as a 640480 image takes up 1meg uncompressed which is alot of traffic to be throwing around the bus(assuming there is no optomization for fast pixel read’s in windows + opengl). Keep in mind I haven’t tried this in a long time.

For our videos (see Fuel trailers online) we had to use a machine with an input card capable of saving realtime compressed avi’s to the hd. It ended up working really good and we got descent quality.

But as rts had noted these are ideas off the top of my head, and there are probably way better methods out there.

Doing this on-the-fly is either going to suck performance-wise or require you to invest in hardware (as the previous posters have pointed out).

What I did instead is create a special “demo recording mode” in my engine. In this mode, the engine runs at a fixed 20 fps (enough for a video) and for every frame, it saves a list of matrices to a file. These matrices represent the orientation and position of the camera and of all the objects in the world.

Then I have a separate tool which takes that demo file and rerenders it offline, using glReadPixels() to grab the frame and save it to an AVI stream.

This works beautifully for applications where the number of objects is constant and relatively small. If you’re writing a non-trivial game or simulation, you might want to try something else, like storing all keypresses and recreating the game from those.

  • Tom