Results 1 to 5 of 5

Thread: glDrawElements vs. glDrawArrays

  1. #1
    Member Contributor
    Join Date
    Mar 2014
    Posts
    65

    glDrawElements vs. glDrawArrays

    What's the general advice concerning these two functions in cases where an index buffer is not really necessary.

    I have a relatively large buffer with a few 1000 triangles but the vertices are all different, i.e. the index buffer would just contain the values from 0 - maxVertex in linear order, it's all drawn with a single GL_TRIANGLES draw call.
    So obviously it can be easily drawn with glDrawArrays without ever creating an index buffer. But I'm wondering if some hardware may not really like this ending up being slower than creating the redundant index buffer anyway.
    Any info?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,649
    Pipelines have been long optimized for indexed triangles, but unless there's some odd driver bug, I wouldn't expect to see DrawArrays in your circumstance being less efficient. Since it's easy, I would try it both ways just to be sure though.

  3. #3
    Member Contributor
    Join Date
    Mar 2014
    Posts
    65
    On my hardware (NVidia Geforce 550Ti) I cannot detect any difference, even when repeatedly calling it in a loop. But we all know that drivers of different manufacturers act differently but without anything quickly available to test I was hoping that someone knew.

  4. #4
    Senior Member Regular Contributor Agent D's Avatar
    Join Date
    Sep 2011
    Location
    Innsbruck, Austria
    Posts
    281
    If you don't specifically target that one weired driver/card combination that only five people in the world use, why do you want to optimize for it?

  5. #5
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789
    Quote Originally Posted by Agent D View Post
    If you don't specifically target that one weired driver/card combination that only five people in the world use, why do you want to optimize for it?
    This, basically.

    Wanting to run on "all hardware" is, IMO, a completely unrealistic objective.

Similar Threads

  1. glDrawArrays vs glDrawElements
    By Kopelrativ in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 06-20-2011, 04:59 AM
  2. glDrawElements vs glDrawArrays
    By V-man in forum OpenGL: Basic Coding
    Replies: 10
    Last Post: 09-19-2001, 05:36 PM
  3. glDrawElements vs glDrawArrays
    By jorritTyberghein in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 05-24-2001, 12:51 AM
  4. glDrawElements or glDrawArrays?
    By jesusgumbau in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 01-10-2001, 10:54 AM
  5. glDrawArrays vs glDrawElements
    By KRONOS in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 07-22-2000, 02:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean