Replaced love.graphics.point with love.graphics.points, which draws a number of points at a time.

It currently has 3 variants, with the last one using optional per-point colors:

- love.graphics.points(x1, y1, x2, y2, ...)

- love.graphics.points({x1, y1, x2, y2, ...})

- love.graphics.points({{x1, y1 [, r, g, b, a]}, {x2, y2 [, r, g, b, a]}, ...}).
This commit is contained in:
Alex Szpakowski
2015-08-19 17:48:27 -03:00
parent 306049bcfe
commit 1261427304
4 changed files with 96 additions and 14 deletions
+14 -7
View File
@@ -1109,17 +1109,24 @@ void Graphics::printf(const std::string &str, float x, float y, float wrap, Font
* Primitives
**/
void Graphics::point(float x, float y)
void Graphics::points(const float *coords, const uint8 *colors, size_t numpoints)
{
OpenGL::TempDebugGroup debuggroup("Graphics point draw");
GLfloat coord[] = {x, y};
OpenGL::TempDebugGroup debuggroup("Graphics points draw");
gl.prepareDraw();
gl.bindTexture(gl.getDefaultTexture());
gl.useVertexAttribArrays(ATTRIBFLAG_POS);
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, coord);
gl.drawArrays(GL_POINTS, 0, 1);
uint32 attribflags = ATTRIBFLAG_POS;
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, coords);
if (colors)
{
attribflags |= ATTRIBFLAG_COLOR;
glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, colors);
}
gl.useVertexAttribArrays(attribflags);
gl.drawArrays(GL_POINTS, 0, numpoints);
}
void Graphics::polyline(const float *coords, size_t count)