PDA

View Full Version : Fast rendering to texture.



Nutty
09-12-2000, 11:40 AM
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?

Cheers,
Nutty.

Chiguire
09-12-2000, 01:00 PM
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

Nutty
09-12-2000, 11:32 PM
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?

Nutty
09-13-2000, 01:38 AM
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!
Nutty

Chiguire
09-13-2000, 10:30 AM
You can use for every iteration of the loop a different glViewport, say:
glViewport(0,0,127,127);
then
glViewport(128,128,255,255);
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...

Nutty
09-14-2000, 04:12 AM
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?

Nutty