hedgewars/uWorld.pas
changeset 3641 98319a621dc8
parent 3638 33ee433749ba
child 3663 8c28abf427f5
equal deleted inserted replaced
3640:54676a34b9ad 3641:98319a621dc8
   419         VertexBuffer[2].X:= lw;
   419         VertexBuffer[2].X:= lw;
   420         VertexBuffer[2].Y:= lh;
   420         VertexBuffer[2].Y:= lh;
   421         VertexBuffer[3].X:= -lw;
   421         VertexBuffer[3].X:= -lw;
   422         VertexBuffer[3].Y:= lh;
   422         VertexBuffer[3].Y:= lh;
   423 
   423 
   424         glEnableClientState (GL_COLOR_ARRAY);
   424         glDisableClientState(GL_TEXTURE_COORD_ARRAY);
       
   425         glEnableClientState(GL_COLOR_ARRAY);
   425         glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]);
   426         glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]);
   426 
   427 
   427         glEnableClientState(GL_VERTEX_ARRAY);
       
   428         glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
   428         glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
   429 
   429 
   430         glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   430         glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   431 
   431 
   432         glDisableClientState(GL_VERTEX_ARRAY);
       
   433         glDisableClientState(GL_COLOR_ARRAY);
   432         glDisableClientState(GL_COLOR_ARRAY);
   434 
   433         glEnableClientState(GL_TEXTURE_COORD_ARRAY);
   435         glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required
   434         glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required
   436         glEnable(GL_TEXTURE_2D);
   435         glEnable(GL_TEXTURE_2D);
   437     end;
   436     end;
   438 end;
   437 end;
   439 
   438 
   469 TextureBuffer[2].X:= TextureBuffer[1].X;
   468 TextureBuffer[2].X:= TextureBuffer[1].X;
   470 TextureBuffer[2].Y:= SpritesData[sprWater].Texture^.ry;
   469 TextureBuffer[2].Y:= SpritesData[sprWater].Texture^.ry;
   471 TextureBuffer[3].X:= TextureBuffer[0].X;
   470 TextureBuffer[3].X:= TextureBuffer[0].X;
   472 TextureBuffer[3].Y:= TextureBuffer[2].Y;
   471 TextureBuffer[3].Y:= TextureBuffer[2].Y;
   473 
   472 
   474 glEnableClientState(GL_VERTEX_ARRAY);
       
   475 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
       
   476 
   473 
   477 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
   474 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
   478 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]);
   475 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]);
   479 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   476 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   480 
   477 
   481 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
       
   482 glDisableClientState(GL_VERTEX_ARRAY);
       
   483 Tint($FF, $FF, $FF, $FF);
   478 Tint($FF, $FF, $FF, $FF);
   484 
   479 
   485 {for i:= -1 to cWaterSprCount do
   480 {for i:= -1 to cWaterSprCount do
   486     DrawSprite(sprWater,
   481     DrawSprite(sprWater,
   487         i * cWaveWidth + ((WorldDx + (RealTicks shr 6) * Dir + dX) mod cWaveWidth) - (cScreenWidth div 2),
   482         i * cWaveWidth + ((WorldDx + (RealTicks shr 6) * Dir + dX) mod cWaveWidth) - (cScreenWidth div 2),
   961         VertexBuffer[2].Y:= 0;
   956         VertexBuffer[2].Y:= 0;
   962         VertexBuffer[3].X:= cScreenWidth;
   957         VertexBuffer[3].X:= cScreenWidth;
   963         VertexBuffer[3].Y:= cScreenHeight;
   958         VertexBuffer[3].Y:= cScreenHeight;
   964          
   959          
   965         glDisable(GL_TEXTURE_2D);
   960         glDisable(GL_TEXTURE_2D);
   966         glEnableClientState(GL_VERTEX_ARRAY);
   961 
   967         glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
   962         glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
   968         glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   963         glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   969         glDisableClientState(GL_VERTEX_ARRAY);
   964 
   970         glEnable(GL_TEXTURE_2D);
   965         glEnable(GL_TEXTURE_2D);
   971         Tint($FF, $FF, $FF, $FF);
   966         Tint($FF, $FF, $FF, $FF);
   972         if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then ScreenFade:= sfNone
   967         if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then ScreenFade:= sfNone
   973         end
   968         end
   974     end;
   969     end;