PDA

View Full Version : rendering without re-loading



DWM
03-02-2003, 06:38 AM
This is a very general question about 3D rendering on systems with hardware renderers. As I work on my application one question keeps coming to mind. Let's say that I have a scene to be rendered that is very complex and I want to rotate around the scene. Other than the rotation, there would be no other change to the scene elements -- just the change of viewpoint. However, as I understand open GL implementation (and the way I have been doing it), for every change of view, the entire scene is reloaded (every vertex, texture, etc.). It would seem to me that one of the advantages of hardware acceleration is that a scene could be loaded into the hardware's memory and a simple shift of view command issued. In other words, one saves of the time of re-loading a complex scene and let the hardware operate on a fixed set of data repetitively (if for example you wanted a user to simply dynamically alter their viewpoint). So my question is whether there is, in fact, a programming mechanism for doing this, or does one always have to re-load the entire scene with every new render?

mikael_aronsson
03-02-2003, 07:28 AM
Hi !

Yes, that's the way OpenGL is designed, but you can of couse store geometry in displaylists or other HW memory features to speed it up, but there is not much you can do about textures.

Mikael

DWM
03-03-2003, 04:32 AM
Thanks. I had a feeling that was the answer since I have not found an alternative. I have been using display lists to speed things up. But, having tried some fairly complex scene setups, it puzzles me (in my ignorance of this aspect of programming) how some of the games achieve such performance with even more complex scenes. There must be some serious tricks used to gain bandwidth. As always, lots to learn.

mikael_aronsson
03-03-2003, 11:13 PM
Hi !

Many times they take advantage of hardware specific extensions, also vertex arrays and other things help out, display lists are many times useless, one problem is that they can eat huge amounts of memory.

Most games also keep the geometry pretty low res and do tricks with textures to make it look better then it is.

Mikael

Turbo_Pascal
03-04-2003, 10:39 AM
Originally posted by mikael_aronsson:
Hi !

Many times they take advantage of hardware specific extensions, also vertex arrays and other things help out, display lists are many times useless, one problem is that they can eat huge amounts of memory.

Most games also keep the geometry pretty low res and do tricks with textures to make it look better then it is.

Mikael

Na!, you need to use displaylist, it is faster and do exactly what you are needing.

you just call your built scene rutine once inside a displaylist:

glnewlist(1,gl_compile);
drawscene();
glendlist();

now you only need to change the view/transform matrix to different position and then call the display list

glpushmatrix();
glmatrixmode(...);
gltranslatef(...);
glcalldisplaylist(1);
glpopmatrix();

All maths, loops etc was done just once when the display list was compiled, later you can use glcalldisplaylist all the times that you want, the display list remember your scene with not need to do the maths/loops etc, it is very fast.

Only if your scene change even a bit then you will need to recompile the display list.


good luck.

tp.