Use vertex arrays for drawing points in addition to lines
authorSam Lantinga <slouken@libsdl.org>
Sun, 20 Oct 2013 10:35:51 -0700
changeset 7842 a37d23ee1812
parent 7841 b5d893a07471
child 7843 9e7a3c4b7267
Use vertex arrays for drawing points in addition to lines
src/render/opengl/SDL_render_gl.c
--- a/src/render/opengl/SDL_render_gl.c	Sun Oct 20 10:19:51 2013 -0700
+++ b/src/render/opengl/SDL_render_gl.c	Sun Oct 20 10:35:51 2013 -0700
@@ -1048,15 +1048,17 @@
                     int count)
 {
     GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
-    int i;
 
     GL_SetDrawingState(renderer);
 
-    data->glBegin(GL_POINTS);
-    for (i = 0; i < count; ++i) {
-        data->glVertex2f(0.5f + points[i].x, 0.5f + points[i].y);
-    }
-    data->glEnd();
+    data->glTranslatef(0.5f, 0.5f, 0.0f);
+    data->glVertexPointer(2, GL_FLOAT, 0, points);
+    data->glEnableClientState(GL_VERTEX_ARRAY);
+
+    data->glDrawArrays(GL_POINTS, 0, count);
+
+    data->glDisableClientState(GL_VERTEX_ARRAY);
+    data->glTranslatef(-0.5f, -0.5f, 0.0f);
 
     return 0;
 }