q; rendering queue

hello.

i am thinking of implementing a rendering queue. i wonder:

  1. for opaque objects which is the best way for sorting? first by lighting attributes and then by texture or vice versa? in other words should i have more glLightf…() calls or glBindTexture() calls?
    i use vertex arrays for rendering the objects.
  2. for blended objects: i should sort them from far to near. so i can’t avoid reducing glBindTexture and glLight calls. is this correct or am i mistaken?
  3. is there a link related to this topic?

thanx in advance for your time.

glBindTexture doesn´t cost you much, as long as the textures are in VRAM. And the more textures you use the more bindings you have to do anyway.
With light i don´t know, how expensive it is, but i think it shouldn´t be that much.

I think you should sort all you objects by depth. The opaque data front to back, to reduce overdraw and the transparent data back to front. This works pretty fine with me. If you use a leafy BSP-Tree as i do, you can still optimize the amount of texture bindings (because the order of drawing polys in a leaf does not matter).

Jan.

thanx jan. your piece of advise was helpful.

i would also like to pose another question, which i consider silly, but i didn’t find any answer to it:
should i sort my objects’ triangles or my objects themselves? i don’t use a bsp-tree (or any other space partitioning algorithm).
(personally, i think i should sort the objects for vertex arrays to work, but if i have very “large” transparent objects i should sort their triangles).

thanx again