diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index 9dd7a5a6a..46ecdd814 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -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) { + GLfloat coord[] = {x, y}; + gl.prepareDraw(); gl.bindTexture(gl.getDefaultTexture()); - glBegin(GL_POINTS); - glVertex2f(x, y); - glEnd(); - - ++gl.stats.drawCalls; + glEnableVertexAttribArray(ATTRIB_POS); + glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, coord); + gl.drawArrays(GL_POINTS, 0, 1); + glDisableVertexAttribArray(ATTRIB_POS); } 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()); glEnableVertexAttribArray(ATTRIB_POS); 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); } } diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index e07f246e7..f1e344cd2 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -431,6 +431,8 @@ bool Window::setContext(int msaa, bool vsync, bool sRGB) 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::cerr << title << std::endl << message << std::endl; + // Display a message box with the error, but only once. if (!displayedContextError) { @@ -438,7 +440,6 @@ bool Window::setContext(int msaa, bool vsync, bool sRGB) displayedContextError = true; } - std::cerr << title << std::endl << message << std::endl; return false; }