Fast rendering to texture.

I’m doing some real time cube mapping, and currently the production of the cube map is very slow. I’m doing a loop 6 times, that clears the buffers, renders everything, does a glFinish, and uses glCopyTexImage2D to copy the framebuffer into the texture. Because the buffers aren’t swapped, the user sees none of this. Any ideas how to speed it up?


The current pipeline to fetch a framebuffer is too SLOW, and when i say SLOW, i mean really slow (on an AGP 4x, you could get 10 fps doing cubemapping), because transmitting a complete 640x480 (low resolution image) through the AGP or PCI bus is a real bandwidth hog, and in the current state of drivers of general consumer 3d accelerators, the fetching of a complete image isn’t very optimized. Maybe in a near future we all have NV-30 (!!) integrated to our motherboards, using system memory, and then, the bus transfers would be blazingly fast.

NOTE: If you try the cube mapping technique (or just try to fetch the framebuffer) on an SGI Cobalt, you will see the difference between a GeForce and a real Workstation 3D accelerator

So I assume to make it faster I have to do much smaller renders for the textures. Wonder how fast it is to setup the viewport each frame, to say do a 128x128 render instead.

Thanks anyway.
Anyone else got any speedup tricks?

Right, I’m using glViewport(0, 0, 128, 128);
prior to generating the 6 images for the cube map, and I’m getting around 40 to 50 frames per second, on 2 dynamic cube map generations per frame. I Also took out clearing the frame buffer, as there shouldn’t be any pixels left unrendered to.

Looks top!

You can use for every iteration of the loop a different glViewport, say:
and so on, but, be careful…
Fetching the a part of the framebuffer in some cards don’t just take only the part you specify, but rather, take the whole screen and then crop it… too bad for me, i have a 3d accelerator that does this technique…

Yup that would be good, eliminating all those glFinish’s and clear z buffers.

What card do you have? Which takes the entire screen and crops it?