summaryrefslogtreecommitdiff
path: root/src/render/modernopenglgraphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-12 01:17:38 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-12 01:17:38 +0300
commit1d4c97f2f4337614b6d270ddacbfd00e408f4e9a (patch)
treed9e37c915ac5478fd93eb71e9f0e5d74f693916c /src/render/modernopenglgraphics.cpp
parent73af9be58f0f35a4478b9d1aed2dfd2e06a6e3a3 (diff)
downloadplus-1d4c97f2f4337614b6d270ddacbfd00e408f4e9a.tar.gz
plus-1d4c97f2f4337614b6d270ddacbfd00e408f4e9a.tar.bz2
plus-1d4c97f2f4337614b6d270ddacbfd00e408f4e9a.tar.xz
plus-1d4c97f2f4337614b6d270ddacbfd00e408f4e9a.zip
In modernopengl add support for draw point and draw line.
Diffstat (limited to 'src/render/modernopenglgraphics.cpp')
-rw-r--r--src/render/modernopenglgraphics.cpp25
1 files changed, 25 insertions, 0 deletions
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)