hedgewars/uRender.pas
changeset 10020 67e127027af6
parent 9998 736015b847e3
child 10040 4ac87acbaed9
--- a/hedgewars/uRender.pas	Sun Jan 19 14:58:54 2014 +0100
+++ b/hedgewars/uRender.pas	Sun Jan 19 16:35:06 2014 +0100
@@ -33,6 +33,7 @@
 
 procedure DrawTexture           (X, Y: LongInt; Texture: PTexture); inline;
 procedure DrawTexture           (X, Y: LongInt; Texture: PTexture; Scale: GLfloat);
+procedure DrawTexture2          (X, Y: LongInt; Texture: PTexture; Scale, Overlap: GLfloat);
 procedure DrawTextureFromRect   (X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline;
 procedure DrawTextureFromRect   (X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline;
 procedure DrawTextureFromRectDir(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture; Dir: LongInt);
@@ -167,6 +168,33 @@
 glPopMatrix
 end;
 
+{ this contains tweaks in order to avoid land tile borders in blurry land mode }
+procedure DrawTexture2(X, Y: LongInt; Texture: PTexture; Scale, Overlap: GLfloat);
+var
+    TextureBuffer: array [0..3] of TVertex2f;
+begin
+glPushMatrix();
+glTranslatef(X, Y, 0);
+glScalef(Scale, Scale, 1);
+
+glBindTexture(GL_TEXTURE_2D, Texture^.id);
+
+TextureBuffer[0].X:= Texture^.tb[0].X + Overlap;
+TextureBuffer[0].Y:= Texture^.tb[0].Y + Overlap;
+TextureBuffer[1].X:= Texture^.tb[1].X - Overlap;
+TextureBuffer[1].Y:= Texture^.tb[1].Y + Overlap;
+TextureBuffer[2].X:= Texture^.tb[2].X - Overlap;
+TextureBuffer[2].Y:= Texture^.tb[2].Y - Overlap;
+TextureBuffer[3].X:= Texture^.tb[3].X + Overlap;
+TextureBuffer[3].Y:= Texture^.tb[3].Y - Overlap;
+
+glVertexPointer(2, GL_FLOAT, 0, @Texture^.vb);
+glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer);
+glDrawArrays(GL_TRIANGLE_FAN, 0, Length(Texture^.vb));
+
+glPopMatrix();
+end;
+
 procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt);
 begin
     DrawTextureRotatedF(Texture, Scale, 0, 0, X, Y, Frame, Dir, w, h, 0)