Use vertex arrays for drawing points in addition to lines
authorSam Lantinga <slouken@libsdl.org>
Sun, 20 Oct 2013 10:35:51 -0700
changeset 7842a37d23ee1812
parent 7841 b5d893a07471
child 7843 9e7a3c4b7267
Use vertex arrays for drawing points in addition to lines
src/render/opengl/SDL_render_gl.c
     1.1 --- a/src/render/opengl/SDL_render_gl.c	Sun Oct 20 10:19:51 2013 -0700
     1.2 +++ b/src/render/opengl/SDL_render_gl.c	Sun Oct 20 10:35:51 2013 -0700
     1.3 @@ -1048,15 +1048,17 @@
     1.4                      int count)
     1.5  {
     1.6      GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
     1.7 -    int i;
     1.8  
     1.9      GL_SetDrawingState(renderer);
    1.10  
    1.11 -    data->glBegin(GL_POINTS);
    1.12 -    for (i = 0; i < count; ++i) {
    1.13 -        data->glVertex2f(0.5f + points[i].x, 0.5f + points[i].y);
    1.14 -    }
    1.15 -    data->glEnd();
    1.16 +    data->glTranslatef(0.5f, 0.5f, 0.0f);
    1.17 +    data->glVertexPointer(2, GL_FLOAT, 0, points);
    1.18 +    data->glEnableClientState(GL_VERTEX_ARRAY);
    1.19 +
    1.20 +    data->glDrawArrays(GL_POINTS, 0, count);
    1.21 +
    1.22 +    data->glDisableClientState(GL_VERTEX_ARRAY);
    1.23 +    data->glTranslatef(-0.5f, -0.5f, 0.0f);
    1.24  
    1.25      return 0;
    1.26  }