Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Performance of Display Lists

Hybrid View

  1. #1
    Intern Contributor
    Join Date
    May 2002
    Location
    AUSTRIA
    Posts
    83

    Performance of Display Lists

    I have a static mesh of quads and tris. To speed up my performance i put them into a Display List. It looks like following:
    modelList = glGenLists(1);
    if (modelList != 0) {
    glNewList (modelList, GL_COMPILE);
    glEnableClientState (GL_COLOR_ARRAY);
    glColorPointer(3,GL_FLOAT,0,vertex_color);
    glEnableClientState (GL_VERTEX_ARRAY);
    glVertexPointer (3, GL_FLOAT, 0, vertices);
    glDrawElements (GL_QUADS, numQuads*4, GL_UNSIGNED_INT, elements_quad);
    glDrawElements (GL_TRIANGLES, numTrias*3, GL_UNSIGNED_INT, elements_tria);
    glEndList();
    }
    It increases my perfomrance for models with about 50.000 elements quite good. But if my modelsize is about 300.000 elements there is nearly no difference. Is there a size limit or did i make a mistake?
    Thanks
    Juergen

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: Performance of Display Lists

    300,000 elements per frame is pretty large for most graphics cards. At 60fps, that's 18 million PPS, which is outside the useable range of most graphics cards. And, even on a good GeForce or Radeon, you'd have to use VAR/VAO to get even close to that.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    111

    Re: Performance of Display Lists

    I do not see a sense on your code, cause after a display list is created, it resides with the server, so the server can't rely on the client for any information related to the display list.

    glVertexPoiner and stuff depends on client state. It only make sense to put glDrawElements in a list, cause data is going to be send to the server state, which construct primitives from elements in the enabled arrays.

  4. #4
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: Performance of Display Lists

    It's totally valid to put the code like this, only the display-listable functions compile stuff into the list, the client state stuff like array pointers are executed immediately.
    It just would have been more elegant to put only the glDrawElement calls into the list.

    I would try keep the number of vertices in each glDrawElements call below 2^16.

    If you're able to construct strips from your geometry instead of independent primitives, that would gain a lot.

  5. #5
    Member Regular Contributor
    Join Date
    Apr 2001
    Location
    Greece
    Posts
    496

    Re: Performance of Display Lists

    Would it make any sense to put just the glDrawElements commands in the display list?Would it speed thins up?I mean there's not much to compile into the list.Or is the data in the arrays actually sent to the server at compile-time?If that is the point then there would be no need to use gl*Pointer() before calling the list or keep the arrays in memory.Is any of the above correct?

  6. #6
    Junior Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    111

    Re: Performance of Display Lists

    > Would it make any sense to put just the glDrawElements commands in the display list?
    Yes, if the content of the array doesn't change.

    > If that is the point then there would be no need to use gl*Pointer()
    yes

  7. #7
    Intern Contributor
    Join Date
    May 2002
    Location
    AUSTRIA
    Posts
    83

    Re: Performance of Display Lists

    My vertex data is completly static. I made a test today, where i could increase the frames, only by using glVertex3f! If i add color in the Display list it slows down a lot. The next step is to split up into more display lists. Is there a reasonable method for this?

  8. #8
    Junior Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    111

    Re: Performance of Display Lists

    What kind of data do you render? Terrain? ...?

  9. #9
    Intern Contributor
    Join Date
    May 2002
    Location
    AUSTRIA
    Posts
    83

    Re: Performance of Display Lists

    I do only show lines or Flat shaded lines. Sometimes i display textures with colors.

  10. #10
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: Performance of Display Lists

    Hi,

    I would like to add a few questions here:
    What does the card do exactly to optimize your call to glDrawElements in your display list?
    Would it be better to use GL_QUADS, or is it better to use GL_TRIANGLES (vertex sharing of course)

    V-man
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Posting Permissions

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