Revert OpenGL point drawing performance, do to proper batching
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index 47d5ae8..dd34b27 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -1111,7 +1111,8 @@ SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader
}
}
- vertex_array = cmd->command == SDL_RENDERCMD_DRAW_LINES
+ vertex_array = cmd->command == SDL_RENDERCMD_DRAW_POINTS
+ || cmd->command == SDL_RENDERCMD_DRAW_LINES
|| cmd->command == SDL_RENDERCMD_GEOMETRY;
color_array = cmd->command == SDL_RENDERCMD_GEOMETRY;
texture_array = cmd->data.draw.texture != NULL;
@@ -1189,7 +1190,6 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
{
/* !!! FIXME: it'd be nice to use a vertex buffer instead of immediate mode... */
GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
- size_t i;
if (GL_ActivateRenderer(renderer) < 0) {
return -1;
@@ -1280,11 +1280,10 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
const size_t count = cmd->data.draw.count;
const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first);
SetDrawState(data, cmd, SHADER_SOLID);
- data->glBegin(GL_POINTS);
- for (i = 0; i < count; i++, verts += 2) {
- data->glVertex2f(verts[0], verts[1]);
- }
- data->glEnd();
+
+ /* SetDrawState handles glEnableClientState. */
+ data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, verts);
+ data->glDrawArrays(GL_POINTS, 0, (GLsizei) count);
break;
}