Use GL_TRIANGLE_FAN instead of GL_TRIANGLES (more efficient)
authorunc0rr
Sun, 22 Mar 2009 17:39:12 +0000
changeset 1908 5be17e24751a
parent 1907 a104432e8301
child 1909 30fa1608b54f
Use GL_TRIANGLE_FAN instead of GL_TRIANGLES (more efficient)
hedgewars/uConsts.pas
hedgewars/uStore.pas
--- a/hedgewars/uConsts.pas	Sun Mar 22 14:35:45 2009 +0000
+++ b/hedgewars/uConsts.pas	Sun Mar 22 17:39:12 2009 +0000
@@ -492,8 +492,8 @@
 			Width:  32; Height: 32; saveSurf: false), // sprHandPlane
 			(FileName:    'Utility'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
 			Width:  48; Height: 48; saveSurf: false), // sprUtility
-			(FileName:  'Invulnerable'; Path: ptHedgehog;AltPath: ptNone; Texture: nil; Surface: nil;
-			Width: 48; Height: 48; saveSurf: false) // sprInvulnerable
+			(FileName:'Invulnerable';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+			Width:  48; Height: 48; saveSurf: false) // sprInvulnerable
 			);
 
 	Wavez: array [TWave] of record
--- a/hedgewars/uStore.pas	Sun Mar 22 14:35:45 2009 +0000
+++ b/hedgewars/uStore.pas	Sun Mar 22 17:39:12 2009 +0000
@@ -348,7 +348,7 @@
 end;
 
 procedure DrawTexture(X, Y: LongInt; Texture: PTexture);
-var VertexBuffer, TextureBuffer: array [0..5] of TVertex2f;
+var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
 begin
 glPushMatrix;
 glTranslatef(X, Y, 0);
@@ -363,8 +363,6 @@
 VertexBuffer[2].Y:= Texture^.h;
 VertexBuffer[3].X:= 0;
 VertexBuffer[3].Y:= Texture^.h;
-VertexBuffer[4]:= VertexBuffer[0];
-VertexBuffer[5]:= VertexBuffer[2];
 
 TextureBuffer[0].X:= 0;
 TextureBuffer[0].Y:= 0;
@@ -374,15 +372,13 @@
 TextureBuffer[2].Y:= Texture^.ry;
 TextureBuffer[3].X:= 0;
 TextureBuffer[3].Y:= Texture^.ry;
-TextureBuffer[4]:= TextureBuffer[0];
-TextureBuffer[5]:= TextureBuffer[2];
 
 glEnableClientState(GL_VERTEX_ARRAY);
 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 
 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]);
-glDrawArrays(GL_TRIANGLES, 0, Length(VertexBuffer));
+glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
 
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 glDisableClientState(GL_VERTEX_ARRAY);