summaryrefslogtreecommitdiff
path: root/src/OpenGLGraphics.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-25 16:52:04 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-25 16:52:04 (GMT)
commit44e41a3b28b656af32a58dc001d51ff2355c7d53 (patch)
treebf277d805f08c612f0024bb6a8b05121df475bfa /src/OpenGLGraphics.cpp
parentdacb774ae01102f756e92449ef395fb938a2acf0 (diff)
downloadpowder-44e41a3b28b656af32a58dc001d51ff2355c7d53.zip
powder-44e41a3b28b656af32a58dc001d51ff2355c7d53.tar.gz
Fix Line scaling for OpenGL inetrgsdfkjdslkfjs
Diffstat (limited to 'src/OpenGLGraphics.cpp')
-rw-r--r--src/OpenGLGraphics.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/OpenGLGraphics.cpp b/src/OpenGLGraphics.cpp
index d688639..ce65ad2 100644
--- a/src/OpenGLGraphics.cpp
+++ b/src/OpenGLGraphics.cpp
@@ -301,16 +301,21 @@ void Graphics::draw_line(int x, int y, int x2, int y2, int r, int g, int b, int
void Graphics::drawrect(int x, int y, int width, int height, int r, int g, int b, int a)
{
- x++;
- height--;
- width--;
+ float fx = float(x)+0.5f;
+ float fy = float(y)+0.5f;
+ float fwidth = width-1.0f;
+ float fheight = height-1.0f;
+ //x++;
+ //y++;
+ //height-=2;
+ //width-=2;
glColor4ub(r, g, b, a);
glBegin(GL_LINE_STRIP);
- glVertex2f(x, y);
- glVertex2f(x+width, y);
- glVertex2f(x+width, y+height);
- glVertex2f(x, y+height+1); //+1 is a hack to prevent squares from missing their corners, will make smoothed lines look like SHIT
- glVertex2f(x, y);
+ glVertex2f(fx, fy);
+ glVertex2f(fx+fwidth, fy);
+ glVertex2f(fx+fwidth, fy+fheight);
+ glVertex2f(fx, fy+fheight); //+1 is a hack to prevent squares from missing their corners, will make smoothed lines look like SHIT
+ glVertex2f(fx, fy);
glEnd();
}