PDA

View Full Version : display list optimization issues



darkdave
08-15-2012, 01:31 PM
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

aqnuep
08-15-2012, 01:34 PM
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.

darkdave
08-15-2012, 01:39 PM
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



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.

Dark Photon
08-15-2012, 06:48 PM
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?

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.

Kopelrativ
08-16-2012, 04:37 AM
And then, you shouldn't use deprecated legacy functions if you worry about optimization.

aqnuep
08-16-2012, 07:21 AM
And then, you shouldn't use deprecated legacy functions if you worry about optimization.
Touché... :)