OpenGL glDrawArrays max size

I know this isn't an OpenGL-specific forum, but I figure I'd ask anyway:

I can't find a good resource saying how big I should make arrays to draw.

In my init function I have
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
typedef glm::vec2 point2;
const int NumPoints = 259437;
void init()
{
    point2 points[NumPoints];
    // fill each point

    // Set up the buffer stuff:
    GLuint abuffer;
    glGenVertexArrays(1, &abuffer);
    glBindVertexArray(abuffer);

    GLuint buffer;
    glGenBuffers(1, &buffer);
    glBindBuffer(GL_ARRAY_BUFFER, buffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(points),
                 points, GL_STATIC_DRAW);
}


In my main's loop, I have
 
glDrawArrays(GL_POINTS, 0, NumPoints);


If I make NumPoints be 259436 instead of 259437, it works fine.
This is obviously some implementation- or hardware-dependent number though.
If I make it greater than this, it crashes on the draw call.

I tried searching the web, but I can't find a good resource to say what the max size of an array should be for drawing. I'm sure it should be less than 250k though.

The macro GL_MAX_ELEMENTS_VERTICES prints out 33k, FYI. So should I using some number less than this?
Last edited on
Topic archived. No new replies allowed.