glEnable/glDisable(GL_LIGHTING )

Hi ..


Currently , in my code I am sorting my draw calls based on GL_BLEND, textures and vertex buffers ( in that order.) - this seems to be working pretty well.<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" />


Now I have to somehow incorporate GL_LIGHTING into my sort order... I am wondering if, from a performance point of view , are  glEnable(GL_LIGHTING)/glDisable(GL_LIGHTING) calls considered context switch "heavy" and should I even  bother trying to group batches based on the GL_LIGHTING state  -  in other words, is calling glEnable(GL_LIGHTING) ... glDisable(GL_LIGHTING)  repeatedly,  going to incur significant performance hit ?







The cost depends on the platform and whether vertex processing is performed in hardware (i.e. VGP alongside MBX, or SGX). What is the average number of Enable/Disable(GL_LIGHTING) and other light state changes per frame without sorting?

I got it working just fine.


Having sorted my batches by blend/textures/geometry I have pretty much ordered them by their GL_LIGHTING property as well ( I have basically two basic sets of geometry - light mapped and using a single GL_LIGHT)