PDA

View Full Version : Writing 6000 cubes on screen...



genetic
12-24-2001, 02:37 PM
Hi ppl. I was programming effect for my demo (flying trough field of cubes which was used first in 3d mark 99) and it was veeeryy slow (of course, i redrawed all cubes every frame). Pls, could u help me. Explain me philosophy, how to program this effect optimally. Thanks.

Bob
12-25-2001, 03:03 AM
Don't use immediate mode rendering (glVertex/glColor and those commands). Use display lists and/or vertex arrays. Per object frustum culling might boost your performance a bit.

genetic
12-25-2001, 03:13 AM
Originally posted by Bob:
Don't use immediate mode rendering (glVertex/glColor and those commands). Use display lists and/or vertex arrays. Per object frustum culling might boost your performance a bit.

Thx. I`m using displists. i`ll check that frustrum culling :-)

MofuX
12-25-2001, 04:01 AM
hi, if you are using displaylist render all cubes into one list and not every cube in a single list...

but if you want to use frustum culling you must render your scene into vertex arrays...

you have to try which way is the fast

good luck mate

genetic
12-25-2001, 08:12 AM
Originally posted by MofuX:
hi, if you are using displaylist render all cubes into one list and not every cube in a single list...

but if you want to use frustum culling you must render your scene into vertex arrays...

you have to try which way is the fast

good luck mate

No. i have in displist 1 cube and i`m rendering entire field every frame and with glTranslatef i`m moving trough field.

Pls. could anyone gimme link, where can i find, what is frustrum culling (coz i didn`t found anything relevant).

Thanks

Bob
12-25-2001, 09:04 AM
MofuX, you can do frustum culling with display lists. Test each cube against the frustum, and call glCallList if it's visible. You don't have to use veryex arrays just to do frustum culling.

How many cubes you store in one display list depends on how much precision you want in your frustum culling. If you have one cube per list, only semi- or fully visible cubes will pass the test. If you have 27 cubes (3x3x3) per list, you will test this group of boxes, and draw all of them if parts of the group is visible, resulting in cubes outside the frumstum to be drawn. In short, the more cubes you have in the list, the more "invisible" cubes you draw, but the less function calls is needed.

I suggest you put a group of about (4x4x4) cubes in one display list, test the whole group against the frustum, and draw the entire group if needed.

Search Google for frustum culling. I did, and the very first link contains more or less everything you ever need to know about frustum culling.

12-28-2001, 02:20 PM
Be sure and render front to back http://www.opengl.org/discussion_boards/ubb/smile.gif