3

This is just out of mere interest, but is there a limit to the amount of vertecies GL_VERTEX_ARRAY will 'hold' and render through something like drawArrays()? Or could I theoretically pass through a few million vertexes and still be able to call drawArrays()?

MPainter
  • 79
  • 1
  • 1
  • 7

2 Answers2

3

There is definitely a limit, but as far as I know it is just based on available memory, so you may well be able to have a few million vertices.

jncraton
  • 9,022
  • 3
  • 34
  • 49
3

Since OpenGL-1.2 a sort of limitation applies when using glDrawRangeElements:

Implementations denote recommended maximum amounts of vertex and index data, which may be queried by calling GetIntegerv with the symbolic constants MAX_ELEMENTS_VERTICES and MAX_ELEMENTS_INDICES. If end-start+1 is greater than the value of MAX_ELEMENTS_VERTICES, or if count is greater than the value of MAX_ELEMENTS_INDICES, then the call may operate at reduced performance. There is no requirement that all vertices in the range start; end be referenced. However, the implementation may partially process unused vertices, reducing performance from what could be achieved with an optimal index set.

But that's more of a recommendation, that a hard constraint. Other than that, the true limit is the amount of memory installed, and what can be addressed by the chosen type for the index element array

However the limits for glDrawRangeElements usually also make a good indication for batch sizes in general.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • Don't these values only apply to the range (glDrawRangeElements) commands? As I remember these values being quite small (like 4k or something) on my 7950. – Christian Rau Jun 25 '11 at 11:12
  • @Christian Rau: Indeed the specification has this paragraph right after glDrawRangeElements, however as I understood it, is universally applicable, since glDrawElements essentially is glDrawRangeElement(start=0, end=maximum_value_of_index_type, ...) (of course a driver may will hopefully not as naive in it's implementation). – datenwolf Jun 25 '11 at 11:38
  • But these enums also come from the `EXT_draw_range_elements` extension. I alsways understood those like: when the range is valid, the call can optimize a bit and run faster, but when the range is too large, it will revert to something similar to `glDrawElements` (or even worse), but I have not too much insight into drivers. – Christian Rau Jun 25 '11 at 11:42
  • @Christian Rau: You're right, I just read and compared the specifications from extensions to current, and this is the only interpretation that makes sense if one looks at the intersection of the documents. Edited my answer with respect to that. – datenwolf Jun 25 '11 at 11:50