From 1b8b144bc8d93b0cc6cf09696eda9af0b5de9edb Mon Sep 17 00:00:00 2001 From: vrld Date: Mon, 25 Apr 2011 23:45:15 +0200 Subject: [PATCH] Fix polygon drawing: index of coordinates was off by one. --HG-- branch : minor --- src/modules/graphics/opengl/Graphics.cpp | 2 +- src/modules/graphics/opengl/wrap_Graphics.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index bc30da925..4fabd5327 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -914,7 +914,7 @@ namespace opengl glDisable(GL_TEXTURE_2D); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, (const GLvoid*)coords); - glDrawArrays(GL_POLYGON, 0, count / 2); // opengl will close the polygon for us + glDrawArrays(GL_POLYGON, 0, count/2-1); // opengl will close the polygon for us glDisableClientState(GL_VERTEX_ARRAY); glEnable(GL_TEXTURE_2D); } diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 702289353..883128a40 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -901,7 +901,7 @@ namespace opengl } } else { for (int i = 0; i < args; ++i) - coords[i] = lua_tonumber(L, i + 1); + coords[i] = lua_tonumber(L, i + 2); } // make a closed loop