Does openGL has a limit of how many vertices one can pass to glDrawArrays() function?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Does openGL has a limit of how many vertices one can pass to glDrawArrays() function?

ElvJOGL
Hi,

Can anyone tell me whether JOGL (OpenGL) has a limit of how many vertices one can pass at once to glDrawArrays() function?

For instance in OpenGL SuperBible (Edition 6) textbook, it states in page 99, "You can literally put millions of vertices worth of data into your buffer object and draw them all with a single command such as a call to glDrawArrays()."

Since the text states MILLIONS, what does that really mean in OpenGL convention?

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Does openGL has a limit of how many vertices one can pass to glDrawArrays() function?

jmaasing
The limiting factors are the hardware (free memory/GPU memory et c) and video card driver so it is different on different computers. You can always try to put millions in the buffer and see if it works - it actually might work.
Reply | Threaded
Open this post in threaded view
|

Re: Does openGL has a limit of how many vertices one can pass to glDrawArrays() function?

ElvJOGL
Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Does openGL has a limit of how many vertices one can pass to glDrawArrays() function?

elect
In reply to this post by jmaasing
jmaasing is right, unfortunately you cannot know that a priori, you just know you hit the limit if you catch a GL_OUT_OF_MEMORY error

http://stackoverflow.com/a/7369392/1047713
Reply | Threaded
Open this post in threaded view
|

Re: Does openGL has a limit of how many vertices one can pass to glDrawArrays() function?

gouessej
Administrator
In reply to this post by ElvJOGL
Hi

Look at GL_MAX_ELEMENTS_VERTICES and GL_MAX_ELEMENTS_INDICES. If it returns weird values (the biggest integer or a negative value), assume it's around 3000 and 4096. Of course, you can perform several calls of glDrawArrays or use glMultiDrawArrays (but it's sometimes buggy and not noticeably more efficient that a dummy loop).

N.B: It's an hint, you can ignore it but your program will become slower.
Julien Gouesse | Personal blog | Website