Archived

This topic is now archived and is closed to further replies.

PoorMan

How to optimize?

Recommended Posts

I have build my terrain map using octree using the models from 3DS Max. How can I optimize the speed in drawing? I got my own file format, all the polygon meshes that are connected and using the same material is stored in an array. But because of the octree structure, I need to send the polygons according to the travesal of the octree. Should I make a list and sort all the polygons first before drawing or just send the polygons directly from the travesal? Or should I even sort all the poylgons with the same material first no matter they are connected or not?

Share this post


Link to post
Share on other sites
Try to minimize the number of state changes (glEnable, glDisable, glBindTexture, glAlphaFunc, glBlendFunc, et cetera). If that means you have to sort the data, and you can do it fast enough, try it. After all, if it isn''t faster in the end you can undo it .

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
When you traverse, create lists of Indices to the polygons with the same textures. Then, send each of the lists (along with the vertex array list) to a function that draws Vertex Array''s. do a search on google for information on drawing vertex arrays. Anyways, this would do 2 things for you:
A.) You need only change textures when you have to.
B.) To send data for a Vertex Array is very minimal (you just send the pointers!)

The problem with this method is that it takes a bit more memory, and isn''t very flexible (ei, what if you wanted to multi-texture the polygons, and they have different multi-textures).

Billy

ps. I think just sending the polygons directly from the traversal, and only changing states when you have to, would be the best way if you need it flexible.

Share this post


Link to post
Share on other sites