display list optimization issues

I want to know if i have a loop that does this

DISPLAY LIST BEGIN
loop
glColor(r,g,b,a)
glVertex(x,y,z)
end loop
DIPLAY LIST END

will there be optimization issues to the diplay list if most of the colors are the same?

I am thinking of rewriting the code sot hat glcolor is only called if the color values change. Or should I not bother ? Im wondering if OpenGL will know when it encounters a string of identical color commands for subsequent vertexes.

David

No, there won’t be, because hardware does usually require a separate color per vertex so the driver most likely will replicate your color value for subsequent vertices even if you don’t call glColor again with the same colors.

Cool thanks man. I was suspecting this was so, but only because maybe it had something to do with the pipeline and it works as a matrix but i guess ur answer is good enuf for me.

David

[QUOTE=darkdave;1241460]I want to know if i have a loop that does this

DISPLAY LIST BEGIN
loop
glColor(r,g,b,a)
glVertex(x,y,z)
end loop
DIPLAY LIST END

will there be optimization issues to the diplay list if most of the colors are the same?[/QUOTE]

Also, you probably will, but make sure you put your glBegin/glEnd outside of the loop. Some drivers don’t optimize across these batches, so you want to make them big.

And then, you shouldn’t use deprecated legacy functions if you worry about optimization.

Touché… :slight_smile: