diff --git a/src/map/map_draw.cpp b/src/map/map_draw.cpp index 3540a7286..2306fd01f 100644 --- a/src/map/map_draw.cpp +++ b/src/map/map_draw.cpp @@ -1306,16 +1306,16 @@ local void MapDraw32Tile32(int tile,int x,int y) #ifdef USE_OPENGL local void MapDrawTileOpenGL(int tile,int x,int y) { - GLfloat sx,ex,sy,ey; + GLint sx,ex,sy,ey; GLfloat stx,etx,sty,ety; Graphic *g; int t; g=TheMap.TileData; - sx=(GLfloat)x/VideoWidth; - ex=sx+(GLfloat)TileSizeX/VideoWidth; - ey=1.0f-(GLfloat)y/VideoHeight; - sy=ey-(GLfloat)TileSizeY/VideoHeight; + sx=x; + ex=sx+TileSizeX; + ey=VideoHeight-y; + sy=ey-TileSizeY; t=tile%(g->Width/TileSizeX); stx=(GLfloat)t*TileSizeX/g->Width*g->TextureWidth; @@ -1327,13 +1327,13 @@ local void MapDrawTileOpenGL(int tile,int x,int y) glBindTexture(GL_TEXTURE_2D, g->TextureNames[0]); glBegin(GL_QUADS); glTexCoord2f(stx, 1.0f-ety); - glVertex3f(sx, sy, 0.0f); + glVertex2i(sx, sy); glTexCoord2f(stx, 1.0f-sty); - glVertex3f(sx, ey, 0.0f); + glVertex2i(sx, ey); glTexCoord2f(etx, 1.0f-sty); - glVertex3f(ex, ey, 0.0f); + glVertex2i(ex, ey); glTexCoord2f(etx, 1.0f-ety); - glVertex3f(ex, sy, 0.0f); + glVertex2i(ex, sy); glEnd(); } #endif diff --git a/src/map/map_fog.cpp b/src/map/map_fog.cpp index 260ffd465..8d4a3e33c 100644 --- a/src/map/map_fog.cpp +++ b/src/map/map_fog.cpp @@ -1601,22 +1601,22 @@ global void VideoDrawOnlyFogAlphaOpenGL( const GraphicData* data __attribute__((unused)), int x,int y) { - GLfloat sx,ex,sy,ey; + GLint sx,ex,sy,ey; Graphic *g; g=TheMap.TileData; - sx=(GLfloat)x/VideoWidth; - ex=sx+(GLfloat)TileSizeX/VideoWidth; - ey=1.0f-(GLfloat)y/VideoHeight; - sy=ey-(GLfloat)TileSizeY/VideoHeight; + sx=x; + ex=sx+TileSizeX; + ey=VideoHeight-y; + sy=ey-TileSizeY; glDisable(GL_TEXTURE_2D); glColor4f(0.0f, 0.0f, 0.0f, 0.5f); glBegin(GL_QUADS); - glVertex3f(sx, sy, 0.0f); - glVertex3f(sx, ey, 0.0f); - glVertex3f(ex, ey, 0.0f); - glVertex3f(ex, sy, 0.0f); + glVertex2i(sx, sy); + glVertex2i(sx, ey); + glVertex2i(ex, ey); + glVertex2i(ex, sy); glEnd(); glEnable(GL_TEXTURE_2D); } diff --git a/src/video/font.cpp b/src/video/font.cpp index 527ab3a40..18a4e027b 100644 --- a/src/video/font.cpp +++ b/src/video/font.cpp @@ -323,19 +323,15 @@ local void VideoDrawChar32(const Graphic* sprite, local void VideoDrawCharOpenGL(const Graphic* sprite, int gx,int gy,int w,int h,int x,int y) { - GLfloat sx,sy; Palette c; int i; - sx=(GLfloat)x/VideoWidth; - sy=1.0f-(GLfloat)y/VideoHeight-(GLfloat)h/VideoHeight; - glDisable(GL_TEXTURE_2D); for( i=0; i<NumFontColors; ++i ) { c=GlobalPalette[TextColor[i]]; glColor3ub(c.r,c.g,c.b); - glRasterPos2f(sx,sy); + glRasterPos2i(x,VideoHeight-y-h); glBitmap(FontBitmapWidths[CurrentFont]*8,h, 0.0f,0.0f,0.0f,0.0f, FontBitmaps[CurrentFont][i]+(gy+Fonts[CurrentFont].Height-h)*FontBitmapWidths[CurrentFont]); diff --git a/src/video/graphic.cpp b/src/video/graphic.cpp index 32944622d..2fd889ec3 100644 --- a/src/video/graphic.cpp +++ b/src/video/graphic.cpp @@ -248,13 +248,13 @@ local void VideoDrawSubOpenGL( const Graphic* graphic,int gx,int gy,int w,int h, int x,int y) { - GLfloat sx,ex,sy,ey; + int sx,ex,sy,ey; GLfloat stx,etx,sty,ety; - sx=(GLfloat)x/VideoWidth; - ex=sx+(GLfloat)w/VideoWidth; - ey=1.0f-(GLfloat)y/VideoHeight; - sy=ey-(GLfloat)h/VideoHeight; + sx=x; + ex=sx+w; + ey=VideoHeight-y; + sy=ey-h; stx=(GLfloat)gx/graphic->Width*graphic->TextureWidth; etx=(GLfloat)(gx+w)/graphic->Width*graphic->TextureWidth; @@ -264,13 +264,13 @@ local void VideoDrawSubOpenGL( glBindTexture(GL_TEXTURE_2D, graphic->TextureNames[0]); glBegin(GL_QUADS); glTexCoord2f(stx, 1.0f-ety); - glVertex3f(sx, sy, 0.0f); + glVertex2i(sx, sy); glTexCoord2f(stx, 1.0f-sty); - glVertex3f(sx, ey, 0.0f); + glVertex2i(sx, ey); glTexCoord2f(etx, 1.0f-sty); - glVertex3f(ex, ey, 0.0f); + glVertex2i(ex, ey); glTexCoord2f(etx, 1.0f-ety); - glVertex3f(ex, sy, 0.0f); + glVertex2i(ex, sy); glEnd(); } #endif diff --git a/src/video/linedraw.cpp b/src/video/linedraw.cpp index 4aae47b1b..8acc5c4ff 100644 --- a/src/video/linedraw.cpp +++ b/src/video/linedraw.cpp @@ -625,7 +625,7 @@ local void DrawPixelOpenGL(SysColors color,int x,int y) glDisable(GL_TEXTURE_2D); glColor3ub(r, g, b); glBegin(GL_POINTS); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -755,7 +755,7 @@ local void Draw25TransPixelOpenGL(SysColors color,int x,int y) glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 192); glBegin(GL_POINTS); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -882,7 +882,7 @@ local void Draw50TransPixelOpenGL(SysColors color,int x,int y) glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 128); glBegin(GL_POINTS); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -1009,7 +1009,7 @@ local void Draw75TransPixelOpenGL(SysColors color,int x,int y) glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 64); glBegin(GL_POINTS); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -1215,7 +1215,7 @@ local void DrawTransPixelOpenGL(SysColors color,int x,int y,unsigned char alpha) glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 255-alpha); glBegin(GL_POINTS); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -1310,7 +1310,7 @@ local void DrawPixelClipOpenGL(SysColors color,int x,int y) glDisable(GL_TEXTURE_2D); glColor3ub(r, g, b); glBegin(GL_POINTS); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -1511,8 +1511,8 @@ local void DrawHLineOpenGL(SysColors color,int x,int y,int width) glDisable(GL_TEXTURE_2D); glColor3ub(r, g, b); glBegin(GL_LINES); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+width)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+width, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -1675,8 +1675,8 @@ local void Draw25TransHLineOpenGL(SysColors color,int x,int y,int width) glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 192); glBegin(GL_LINES); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+width)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+width, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -1836,8 +1836,8 @@ local void Draw50TransHLineOpenGL(SysColors color,int x,int y,int width) glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 128); glBegin(GL_LINES); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+width)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+width, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -1997,8 +1997,8 @@ local void Draw75TransHLineOpenGL(SysColors color,int x,int y,int width) glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 64); glBegin(GL_LINES); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+width)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+width, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -2269,8 +2269,8 @@ local void DrawTransHLineOpenGL(SysColors color,int x,int y,int width,unsigned c glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 255-alpha); glBegin(GL_LINES); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+width)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+width, VideoHeight-y); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -2472,8 +2472,8 @@ local void DrawVLineOpenGL(SysColors color,int x,int y,int height) glDisable(GL_TEXTURE_2D); glColor3ub(r, g, b); glBegin(GL_LINES); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+height)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x, VideoHeight-(y+height)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -2635,8 +2635,8 @@ local void Draw25TransVLineOpenGL(SysColors color,int x,int y,int height) glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 192); glBegin(GL_LINES); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+height)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x, VideoHeight-(y+height)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -2796,8 +2796,8 @@ local void Draw50TransVLineOpenGL(SysColors color,int x,int y,int height) glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 128); glBegin(GL_LINES); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+height)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x, VideoHeight-(y+height)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -2958,8 +2958,8 @@ local void Draw75TransVLineOpenGL(SysColors color,int x,int y,int height) glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 64); glBegin(GL_LINES); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+height)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x, VideoHeight-(y+height)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -3197,8 +3197,8 @@ local void DrawTransVLineOpenGL(SysColors color,int x,int y,int height,unsigned glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 255-alpha); glBegin(GL_LINES); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+height)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x, VideoHeight-(y+height)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -3705,8 +3705,8 @@ local void DrawLineOpenGL(SysColors color,int x1,int y1,int x2,int y2) glDisable(GL_TEXTURE_2D); glColor3ub(r, g, b); glBegin(GL_LINES); - glVertex3f((GLfloat)x1/VideoWidth, 1.0f-(GLfloat)y1/VideoHeight, 0.0f); - glVertex3f((GLfloat)x2/VideoWidth, 1.0f-(GLfloat)y2/VideoHeight, 0.0f); + glVertex2i(x1, VideoHeight-y1); + glVertex2i(x2, VideoHeight-y2); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -3999,10 +3999,10 @@ local void DrawRectangleOpenGL(SysColors color,int x,int y glDisable(GL_TEXTURE_2D); glColor3ub(r, g, b); glBegin(GL_LINE_LOOP); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+w, VideoHeight-y); + glVertex2i(x+w, VideoHeight-(y+h)); + glVertex2i(x, VideoHeight-(y+h)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -4311,10 +4311,10 @@ local void Draw25TransRectangleOpenGL(SysColors color,int x,int y glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 192); glBegin(GL_LINE_LOOP); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+w, VideoHeight-y); + glVertex2i(x+w, VideoHeight-(y+h)); + glVertex2i(x, VideoHeight-(y+h)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -4621,10 +4621,10 @@ local void Draw50TransRectangleOpenGL(SysColors color,int x,int y glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 128); glBegin(GL_LINE_LOOP); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+w, VideoHeight-y); + glVertex2i(x+w, VideoHeight-(y+h)); + glVertex2i(x, VideoHeight-(y+h)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -4931,10 +4931,10 @@ local void Draw75TransRectangleOpenGL(SysColors color,int x,int y glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 64); glBegin(GL_LINE_LOOP); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+w, VideoHeight-y); + glVertex2i(x+w, VideoHeight-(y+h)); + glVertex2i(x, VideoHeight-(y+h)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -5249,10 +5249,10 @@ local void DrawTransRectangleOpenGL(SysColors color,int x,int y glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 255-alpha); glBegin(GL_LINE_LOOP); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+w, VideoHeight-y); + glVertex2i(x+w, VideoHeight-(y+h)); + glVertex2i(x, VideoHeight-(y+h)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -5684,10 +5684,10 @@ local void DrawFillRectangleOpenGL(SysColors color,int x,int y glDisable(GL_TEXTURE_2D); glColor3ub(r, g, b); glBegin(GL_TRIANGLE_STRIP); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+w, VideoHeight-y); + glVertex2i(x, VideoHeight-(y+h)); + glVertex2i(x+w, VideoHeight-(y+h)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -5891,10 +5891,10 @@ local void DrawFill25TransRectangleOpenGL(SysColors color,int x,int y glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 192); glBegin(GL_TRIANGLE_STRIP); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+w, VideoHeight-y); + glVertex2i(x, VideoHeight-(y+h)); + glVertex2i(x+w, VideoHeight-(y+h)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -6095,10 +6095,10 @@ local void DrawFill50TransRectangleOpenGL(SysColors color,int x,int y glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 128); glBegin(GL_TRIANGLE_STRIP); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+w, VideoHeight-y); + glVertex2i(x, VideoHeight-(y+h)); + glVertex2i(x+w, VideoHeight-(y+h)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -6299,10 +6299,10 @@ local void DrawFill75TransRectangleOpenGL(SysColors color,int x,int y glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 64); glBegin(GL_TRIANGLE_STRIP); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+w, VideoHeight-y); + glVertex2i(x, VideoHeight-(y+h)); + glVertex2i(x+w, VideoHeight-(y+h)); glEnd(); glEnable(GL_TEXTURE_2D); } @@ -6567,10 +6567,10 @@ local void DrawFillTransRectangleOpenGL(SysColors color,int x,int y glDisable(GL_TEXTURE_2D); glColor4ub(r, g, b, 255-alpha); glBegin(GL_TRIANGLE_STRIP); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)y/VideoHeight, 0.0f); - glVertex3f((GLfloat)x/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); - glVertex3f((GLfloat)(x+w)/VideoWidth, 1.0f-(GLfloat)(y+h)/VideoHeight, 0.0f); + glVertex2i(x, VideoHeight-y); + glVertex2i(x+w, VideoHeight-y); + glVertex2i(x, VideoHeight-(y+h)); + glVertex2i(x+w, VideoHeight-(y+h)); glEnd(); glEnable(GL_TEXTURE_2D); } diff --git a/src/video/sdl.cpp b/src/video/sdl.cpp index 36c8df43e..273a0c989 100644 --- a/src/video/sdl.cpp +++ b/src/video/sdl.cpp @@ -133,7 +133,7 @@ local void InitOpenGL(void) glViewport(0, 0, (GLsizei)VideoWidth, (GLsizei)VideoHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0,1,0,1,-1,1); + glOrtho(0,VideoWidth,0,VideoHeight,-1,1); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepth(1.0f); diff --git a/src/video/sprite.cpp b/src/video/sprite.cpp index f34a8b83f..0f71ef970 100644 --- a/src/video/sprite.cpp +++ b/src/video/sprite.cpp @@ -192,23 +192,23 @@ local void VideoDraw8to32(const Graphic* sprite,unsigned frame,int x,int y) #ifdef USE_OPENGL local void VideoDrawOpenGL(const Graphic* sprite,unsigned frame,int x,int y) { - GLfloat sx,ex,sy,ey; + GLint sx,ex,sy,ey; - sx=(GLfloat)x/VideoWidth; - ex=sx+(GLfloat)sprite->Width/VideoWidth; - ey=1.0f-(GLfloat)y/VideoHeight; - sy=ey-(GLfloat)sprite->Height/VideoHeight; + sx=x; + ex=sx+sprite->Width; + ey=VideoHeight-y; + sy=ey-sprite->Height; glBindTexture(GL_TEXTURE_2D, sprite->TextureNames[frame]); glBegin(GL_QUADS); glTexCoord2f(0.0f, 1.0f-sprite->TextureHeight); - glVertex3f(sx, sy, 0.0f); + glVertex2i(sx, sy); glTexCoord2f(0.0f, 1.0f); - glVertex3f(sx, ey, 0.0f); + glVertex2i(sx, ey); glTexCoord2f(sprite->TextureWidth, 1.0f); - glVertex3f(ex, ey, 0.0f); + glVertex2i(ex, ey); glTexCoord2f(sprite->TextureWidth, 1.0f-sprite->TextureHeight); - glVertex3f(ex, sy, 0.0f); + glVertex2i(ex, sy); glEnd(); } #endif @@ -399,23 +399,23 @@ local void VideoDraw8to32X(const Graphic* sprite,unsigned frame,int x,int y) #ifdef USE_OPENGL local void VideoDrawXOpenGL(const Graphic* sprite,unsigned frame,int x,int y) { - GLfloat sx,ex,sy,ey; + GLint sx,ex,sy,ey; - sx=(GLfloat)x/VideoWidth; - ex=sx+(GLfloat)sprite->Width/VideoWidth; - ey=1.0f-(GLfloat)y/VideoHeight; - sy=ey-(GLfloat)sprite->Height/VideoHeight; + sx=x; + ex=sx+sprite->Width; + ey=VideoHeight-y; + sy=ey-sprite->Height; glBindTexture(GL_TEXTURE_2D, sprite->TextureNames[frame]); glBegin(GL_QUADS); glTexCoord2f(0.0f, 1.0f-sprite->TextureHeight); - glVertex3f(sx, sy, 0.0f); + glVertex2i(sx, sy); glTexCoord2f(0.0f, 1.0f); - glVertex3f(sx, ey, 0.0f); + glVertex2i(sx, ey); glTexCoord2f(sprite->TextureWidth, 1.0f); - glVertex3f(ex, ey, 0.0f); + glVertex2i(ex, ey); glTexCoord2f(sprite->TextureWidth, 1.0f-sprite->TextureHeight); - glVertex3f(ex, sy, 0.0f); + glVertex2i(ex, sy); glEnd(); } #endif @@ -976,7 +976,7 @@ right_trans: #ifdef USE_OPENGL local void VideoDrawClipOpenGL(const Graphic* sprite,unsigned frame,int x,int y) { - GLfloat svx,evx,svy,evy; + GLint svx,evx,svy,evy; GLfloat stx,etx,sty,ety; int ox; int oy; @@ -988,10 +988,10 @@ local void VideoDrawClipOpenGL(const Graphic* sprite,unsigned frame,int x,int y) h=sprite->Height; CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex); - svx=(GLfloat)x/VideoWidth; - evx=svx+(GLfloat)w/VideoWidth; - evy=1.0f-(GLfloat)y/VideoHeight; - svy=evy-(GLfloat)h/VideoHeight; + svx=x; + evx=svx+w; + evy=VideoHeight-y; + svy=evy-h; stx=(GLfloat)ox/sprite->Width*sprite->TextureWidth; etx=(GLfloat)(ox+w)/sprite->Width*sprite->TextureWidth; @@ -1576,7 +1576,7 @@ right_trans: local void VideoDrawClipXOpenGL(const Graphic* sprite,unsigned frame ,int x,int y) { - GLfloat svx,evx,svy,evy; + GLint svx,evx,svy,evy; GLfloat stx,etx,sty,ety; int ox; int oy; @@ -1588,10 +1588,10 @@ local void VideoDrawClipXOpenGL(const Graphic* sprite,unsigned frame h=sprite->Height; CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex); - svx=(GLfloat)x/VideoWidth; - evx=svx+(GLfloat)w/VideoWidth; - evy=1.0f-(GLfloat)y/VideoHeight; - svy=evy-(GLfloat)h/VideoHeight; + svx=x; + evx=svx+w; + evy=VideoHeight-y; + svy=evy-h; if( w<sprite->Width ) { if( ox==0 ) { @@ -1608,13 +1608,13 @@ local void VideoDrawClipXOpenGL(const Graphic* sprite,unsigned frame glBindTexture(GL_TEXTURE_2D, sprite->TextureNames[frame]); glBegin(GL_QUADS); glTexCoord2f(stx, sty); - glVertex3f(evx, svy, 0.0f); + glVertex2i(evx, svy); glTexCoord2f(stx, ety); - glVertex3f(evx, evy, 0.0f); + glVertex2i(evx, evy); glTexCoord2f(etx, ety); - glVertex3f(svx, evy, 0.0f); + glVertex2i(svx, evy); glTexCoord2f(etx, sty); - glVertex3f(svx, svy, 0.0f); + glVertex2i(svx, svy); glEnd(); } #endif