Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: display list optimization issues

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    12

    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

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    989
    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.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    12
    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 Originally Posted by aqnuep View Post
    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.

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,156
    Quote Originally Posted by darkdave View Post
    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.

  5. #5
    Junior Member Regular Contributor Kopelrativ's Avatar
    Join Date
    Apr 2011
    Posts
    214
    And then, you shouldn't use deprecated legacy functions if you worry about optimization.

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    989
    Quote Originally Posted by Kopelrativ View Post
    And then, you shouldn't use deprecated legacy functions if you worry about optimization.
    Touché...
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •