- November 18, 2008 at 10:50 pm #29633
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 ?
WalterNovember 19, 2008 at 11:11 am #32497
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?