Archived

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

duckbob

order of operations...

Recommended Posts

I was going to implement a sorted rendering engine for my project. All the static objects that need to be rendered the same way every frame are going to have all their properties dumped into a listed data structure. I was wondering what opperations should have sorted prefrences, I know that doesn''t make any sence so I''ll give an example. List of Polygons Indicies - Color - Textured? - Texture ID - UV - Blended? - Alpha Basicly what I''m asking is what states are the most proscessor intensive to change and should be changed the least frequently. For example, if changing enabling 2D Texturing took the longest time to compleate then I would make a sorted list of all the objects with 2D textures...then all without...so for each frame you only have 2 state changes...then the next hardest task was selecting the actual texture, so I sort the subsets of data and then change to each texture once for all the polys that need it. Hard Med Easy Easy Easy Med Easy Easy Easy Med Hard Med Easy Easy Easy Med Easy Easy Easy Med Easy Easy Easy So the least effort needs to go into rendering the most objects, see? Has anyone measured the time it takes to change each of the states? Is there a diffrence? Thanks, duckbob

Share this post


Link to post
Share on other sites
glBindTexture calls are expensive, and are usually pretty frequent, so it's a good idea to minimise those. glColor calls are cheap, as are glTexCoord and glVertex calls. (although performance can be improved through the use of vertex arrays and/or display lists). As for other operations, I suggest you do your own testing.

____________________________________________________________
www.elf-stone.com

[edited by - benjamin bunny on August 13, 2002 11:54:45 PM]

Share this post


Link to post
Share on other sites
yes binding textures is the slowest (usually)
basically what i do (ignoring blending shaders)
before anythings drawn (in the precompilation of the scene)
*build a list of every pass in the scene (multiple passes added together is a shader)
a pass is a combination of multiple things eg textureID, alpha test enabled etc
*each pass has an ID number
*these get sorted before the scene starts (of course its impossible to get a perfect sort, using texture IDs only is good enuf)
*during the scene no sorting of textures is done (only sorting is meshes from front to back)

though if youre begining a project or opengl i wouldnt worry to much about all this.

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites