mirror of
https://github.com/love2d/love.git
synced 2026-08-19 04:06:17 +02:00
Updated love.graphics.polygon and love.graphics.point to work with OpenGL ES.
--HG-- branch : minor
This commit is contained in:
@@ -1025,13 +1025,14 @@ void Graphics::printf(const std::string &str, float x, float y, float wrap, Alig
|
|||||||
|
|
||||||
void Graphics::point(float x, float y)
|
void Graphics::point(float x, float y)
|
||||||
{
|
{
|
||||||
|
GLfloat coord[] = {x, y};
|
||||||
|
|
||||||
gl.prepareDraw();
|
gl.prepareDraw();
|
||||||
gl.bindTexture(gl.getDefaultTexture());
|
gl.bindTexture(gl.getDefaultTexture());
|
||||||
glBegin(GL_POINTS);
|
glEnableVertexAttribArray(ATTRIB_POS);
|
||||||
glVertex2f(x, y);
|
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, coord);
|
||||||
glEnd();
|
gl.drawArrays(GL_POINTS, 0, 1);
|
||||||
|
glDisableVertexAttribArray(ATTRIB_POS);
|
||||||
++gl.stats.drawCalls;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::polyline(const float *coords, size_t count)
|
void Graphics::polyline(const float *coords, size_t count)
|
||||||
@@ -1151,7 +1152,7 @@ void Graphics::polygon(DrawMode mode, const float *coords, size_t count)
|
|||||||
gl.bindTexture(gl.getDefaultTexture());
|
gl.bindTexture(gl.getDefaultTexture());
|
||||||
glEnableVertexAttribArray(ATTRIB_POS);
|
glEnableVertexAttribArray(ATTRIB_POS);
|
||||||
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, coords);
|
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, coords);
|
||||||
gl.drawArrays(GL_POLYGON, 0, count/2-1); // opengl will close the polygon for us
|
gl.drawArrays(GL_TRIANGLE_FAN, 0, count/2-1); // opengl will close the polygon for us
|
||||||
glDisableVertexAttribArray(ATTRIB_POS);
|
glDisableVertexAttribArray(ATTRIB_POS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -431,6 +431,8 @@ bool Window::setContext(int msaa, bool vsync, bool sRGB)
|
|||||||
std::string title = "Unable to initialize OpenGL";
|
std::string title = "Unable to initialize OpenGL";
|
||||||
std::string message = "This program requires a graphics card and video drivers which support OpenGL 2.1 or OpenGL ES 2.";
|
std::string message = "This program requires a graphics card and video drivers which support OpenGL 2.1 or OpenGL ES 2.";
|
||||||
|
|
||||||
|
std::cerr << title << std::endl << message << std::endl;
|
||||||
|
|
||||||
// Display a message box with the error, but only once.
|
// Display a message box with the error, but only once.
|
||||||
if (!displayedContextError)
|
if (!displayedContextError)
|
||||||
{
|
{
|
||||||
@@ -438,7 +440,6 @@ bool Window::setContext(int msaa, bool vsync, bool sRGB)
|
|||||||
displayedContextError = true;
|
displayedContextError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << title << std::endl << message << std::endl;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user