From 1d4c97f2f4337614b6d270ddacbfd00e408f4e9a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 12 Jun 2014 01:17:38 +0300 Subject: In modernopengl add support for draw point and draw line. --- src/render/modernopenglgraphics.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index 73a594f32..6955571eb 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -661,10 +661,35 @@ void ModernOpenGLGraphics::popClipArea() void ModernOpenGLGraphics::drawPoint(int x, int y) { + setTexturingAndBlending(false); + const ClipRect &clipArea = mClipStack.top(); + GLfloat vertices[] = + { + x + clipArea.xOffset, y + clipArea.yOffset, 0.0f, 0.0f + }; + mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), + vertices, GL_DYNAMIC_DRAW); +#ifdef DEBUG_DRAW_CALLS + mDrawCalls ++; +#endif + glDrawArrays(GL_POINTS, 0, 1); } void ModernOpenGLGraphics::drawLine(int x1, int y1, int x2, int y2) { + setTexturingAndBlending(false); + const ClipRect &clipArea = mClipStack.top(); + GLfloat vertices[] = + { + x1 + clipArea.xOffset, y1 + clipArea.yOffset, 0.0f, 0.0f, + x2 + clipArea.xOffset, y2 + clipArea.yOffset, 0.0f, 0.0f + }; + mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), + vertices, GL_DYNAMIC_DRAW); +#ifdef DEBUG_DRAW_CALLS + mDrawCalls ++; +#endif + glDrawArrays(GL_LINES, 0, 2); } void ModernOpenGLGraphics::drawRectangle(const Rect& rect) -- cgit v1.2.3-70-g09d2