Switch quads over to floats instead of ints (issue #285)

This commit is contained in:
Bart van Strien
2011-08-24 09:58:16 +02:00
parent ceab3f7a44
commit f0dad41f39
4 changed files with 32 additions and 32 deletions
+14 -14
View File
@@ -33,7 +33,7 @@ namespace graphics
{
namespace opengl
{
Quad::Quad(const Viewport & v, int sw, int sh)
Quad::Quad(const Viewport & v, float sw, float sh)
: sw(sw), sh(sh)
{
memset(vertices, 255, sizeof(vertex)*4);
@@ -44,7 +44,7 @@ namespace opengl
{
}
void Quad::refresh(const Viewport & v, int sw, int sh)
void Quad::refresh(const Viewport & v, float sw, float sh)
{
if (!GLEE_ARB_texture_non_power_of_two)
{
@@ -56,20 +56,20 @@ namespace opengl
vertices[0].x = 0;
vertices[0].y = 0;
vertices[1].x = 0;
vertices[1].y = (float)v.h;
vertices[2].x = (float)v.w;
vertices[2].y = (float)v.h;
vertices[3].x = (float)v.w;
vertices[1].y = v.h;
vertices[2].x = v.w;
vertices[2].y = v.h;
vertices[3].x = v.w;
vertices[3].y = 0;
vertices[0].s = (float)v.x/(float)sw;
vertices[0].t = (float)v.y/(float)sh;
vertices[1].s = (float)v.x/(float)sw;
vertices[1].t = (float)(v.y+v.h)/(float)sh;
vertices[2].s = (float)(v.x+v.w)/(float)sw;
vertices[2].t = (float)(v.y+v.h)/(float)sh;
vertices[3].s = (float)(v.x+v.w)/(float)sw;
vertices[3].t = (float)v.y/(float)sh;
vertices[0].s = v.x/sw;
vertices[0].t = v.y/sh;
vertices[1].s = v.x/sw;
vertices[1].t = (v.y+v.h)/sh;
vertices[2].s = (v.x+v.w)/sw;
vertices[2].t = (v.y+v.h)/sh;
vertices[3].s = (v.x+v.w)/sw;
vertices[3].t = v.y/sh;
}
void Quad::setViewport(const Quad::Viewport & v)