Commit 97ae2354 authored by Sam Lantinga's avatar Sam Lantinga

Fixed issues closing lines with the OpenGL ES renderer.

parent a6adb039
...@@ -889,7 +889,8 @@ D3D_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, ...@@ -889,7 +889,8 @@ D3D_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
/* DirectX 9 has the same line rasterization semantics as GDI, /* DirectX 9 has the same line rasterization semantics as GDI,
so we need to close the endpoint of the line */ so we need to close the endpoint of the line */
if (points[0].x != points[count-1].x || points[0].y != points[count-1].y) { if (count == 2 ||
points[0].x != points[count-1].x || points[0].y != points[count-1].y) {
vertices[0].x = (float) points[count-1].x; vertices[0].x = (float) points[count-1].x;
vertices[0].y = (float) points[count-1].y; vertices[0].y = (float) points[count-1].y;
result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_POINTLIST, 1, vertices, sizeof(*vertices)); result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_POINTLIST, 1, vertices, sizeof(*vertices));
......
...@@ -625,6 +625,8 @@ GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, ...@@ -625,6 +625,8 @@ GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
glDrawArrays(GL_LINE_LOOP, 0, count); glDrawArrays(GL_LINE_LOOP, 0, count);
} else { } else {
glDrawArrays(GL_LINE_STRIP, 0, count); glDrawArrays(GL_LINE_STRIP, 0, count);
/* We need to close the endpoint of the line */
glDrawArrays(GL_POINTS, count-1, 1);
} }
SDL_stack_free(vertices); SDL_stack_free(vertices);
......
...@@ -944,6 +944,12 @@ GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count ...@@ -944,6 +944,12 @@ GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count
glGetError(); glGetError();
glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
glDrawArrays(GL_LINE_STRIP, 0, count); glDrawArrays(GL_LINE_STRIP, 0, count);
/* We need to close the endpoint of the line */
if (count == 2 ||
points[0].x != points[count-1].x || points[0].y != points[count-1].y) {
glDrawArrays(GL_POINTS, count-1, 1);
}
SDL_stack_free(vertices); SDL_stack_free(vertices);
if (glGetError() != GL_NO_ERROR) if (glGetError() != GL_NO_ERROR)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment