796 VertexBuffer[2].X:= lw; |
796 VertexBuffer[2].X:= lw; |
797 VertexBuffer[2].Y:= lh; |
797 VertexBuffer[2].Y:= lh; |
798 VertexBuffer[3].X:= -lw; |
798 VertexBuffer[3].X:= -lw; |
799 VertexBuffer[3].Y:= lh; |
799 VertexBuffer[3].Y:= lh; |
800 |
800 |
801 glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
801 BeginWater; |
802 glEnableClientState(GL_COLOR_ARRAY); |
|
803 if SuddenDeathDmg then |
802 if SuddenDeathDmg then |
804 glColorPointer(4, GL_UNSIGNED_BYTE, 0, @SDWaterColorArray[0]) |
803 SetColorPointer(@SDWaterColorArray[0]) |
805 else |
804 else |
806 glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]); |
805 SetColorPointer(@WaterColorArray[0]); |
807 |
806 |
808 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
807 SetVertexPointer(@VertexBuffer[0]); |
809 |
808 |
810 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
809 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
811 |
810 |
812 glDisableClientState(GL_COLOR_ARRAY); |
811 EndWater; |
813 glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
812 {$IFNDEF GL2} |
814 glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required |
813 glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required |
|
814 {$ENDIF} |
815 glEnable(GL_TEXTURE_2D); |
815 glEnable(GL_TEXTURE_2D); |
816 end; |
816 end; |
817 end; |
817 end; |
818 |
818 |
819 procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte); |
819 procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte); |
861 r.w:= Trunc(lw + lw); |
861 r.w:= Trunc(lw + lw); |
862 r.h:= SpritesData[sprite].Texture^.h; |
862 r.h:= SpritesData[sprite].Texture^.h; |
863 ComputeTexcoords(SpritesData[sprite].Texture, @r, @TextureBuffer); |
863 ComputeTexcoords(SpritesData[sprite].Texture, @r, @TextureBuffer); |
864 |
864 |
865 |
865 |
866 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
866 SetVertexPointer(@VertexBuffer[0]); |
867 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); |
867 SetTexCoordPointer(@TextureBuffer[0]); |
868 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
868 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
869 |
869 |
870 Tint($FF, $FF, $FF, $FF); |
870 Tint($FF, $FF, $FF, $FF); |
871 |
871 |
872 {for i:= -1 to cWaterSprCount do |
872 {for i:= -1 to cWaterSprCount do |
1073 {$ENDIF} |
1073 {$ENDIF} |
1074 end; |
1074 end; |
1075 |
1075 |
1076 procedure ChangeDepth(rm: TRenderMode; d: GLfloat); |
1076 procedure ChangeDepth(rm: TRenderMode; d: GLfloat); |
1077 begin |
1077 begin |
1078 {$IFDEF S3D_DISABLED} |
|
1079 rm:= rm; d:= d; // avoid hint |
|
1080 exit; |
|
1081 {$ELSE} |
|
1082 d:= d / 5; |
1078 d:= d / 5; |
1083 if rm = rmDefault then |
1079 if rm = rmLeftEye then |
1084 exit |
|
1085 else if rm = rmLeftEye then |
|
1086 d:= -d; |
1080 d:= -d; |
1087 cStereoDepth:= cStereoDepth + d; |
1081 cStereoDepth:= cStereoDepth + d; |
1088 UpdateProjection; |
1082 UpdateProjection; |
1089 {$ENDIF} |
|
1090 end; |
1083 end; |
1091 |
1084 |
1092 procedure ResetDepth(rm: TRenderMode); |
1085 procedure ResetDepth(rm: TRenderMode); |
1093 begin |
1086 begin |
1094 {$IFDEF S3D_DISABLED} |
|
1095 rm:= rm; // avoid hint |
|
1096 exit; |
|
1097 {$ELSE} |
|
1098 if rm = rmDefault then |
|
1099 exit; |
|
1100 cStereoDepth:= 0; |
1087 cStereoDepth:= 0; |
1101 UpdateProjection; |
1088 UpdateProjection; |
1102 {$ENDIF} |
|
1103 end; |
1089 end; |
1104 |
1090 |
1105 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
1091 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
1106 var i, t, h: LongInt; |
1092 var i, t, h: LongInt; |
1107 r: TSDL_Rect; |
1093 r: TSDL_Rect; |
1553 VertexBuffer[3].X:= cScreenWidth; |
1539 VertexBuffer[3].X:= cScreenWidth; |
1554 VertexBuffer[3].Y:= cScreenHeight; |
1540 VertexBuffer[3].Y:= cScreenHeight; |
1555 |
1541 |
1556 glDisable(GL_TEXTURE_2D); |
1542 glDisable(GL_TEXTURE_2D); |
1557 |
1543 |
1558 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
1544 SetVertexPointer(@VertexBuffer[0]); |
1559 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
1545 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
1560 |
1546 |
1561 glEnable(GL_TEXTURE_2D); |
1547 glEnable(GL_TEXTURE_2D); |
1562 Tint($FF, $FF, $FF, $FF); |
1548 Tint($FF, $FF, $FF, $FF); |
1563 if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then |
1549 if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then |