hedgewars/uRender.pas
changeset 10318 c2e81eea375f
parent 10312 eda8d563f677
child 10324 5d90d8ca9657
equal deleted inserted replaced
10317:fe2721f870ab 10318:c2e81eea375f
   555         {$ELSE}
   555         {$ELSE}
   556         glDisableClientState(GL_COLOR_ARRAY);
   556         glDisableClientState(GL_COLOR_ARRAY);
   557         glEnableClientState(GL_TEXTURE_COORD_ARRAY);
   557         glEnableClientState(GL_TEXTURE_COORD_ARRAY);
   558         {$ENDIF}
   558         {$ENDIF}
   559         end;
   559         end;
       
   560     EnableTexture(not b);
   560 end;
   561 end;
   561 
   562 
   562 procedure UpdateModelviewProjection(); inline;
   563 procedure UpdateModelviewProjection(); inline;
   563 {$IFDEF GL2}
   564 {$IFDEF GL2}
   564 var
   565 var
   627         glDisable(GL_TEXTURE_2D);
   628         glDisable(GL_TEXTURE_2D);
   628     {$ENDIF}
   629     {$ENDIF}
   629 end;
   630 end;
   630 
   631 
   631 procedure UpdateViewLimits();
   632 procedure UpdateViewLimits();
   632 var tmp: real;
   633 var tmp: LongInt;
   633 begin
   634 begin
   634     // cScaleFactor is 2.0 on "no zoom"
   635     // cScaleFactor is 2.0 on "no zoom"
   635     tmp:= cScreenWidth / cScaleFactor;
   636     tmp:= round(0.5 + cScreenWidth / cScaleFactor);
   636     ViewRightX:= 1 + round(tmp);
   637     ViewRightX :=  tmp;
   637     ViewLeftX:= round(-tmp);
   638     ViewLeftX  := -tmp;
   638     tmp:= cScreenHeight / cScaleFactor;
   639     tmp:= round(0.5 + cScreenHeight / cScaleFactor);
   639     ViewBottomY:= 1 + round(tmp) + cScreenHeight div 2;
   640     ViewBottomY:=  tmp + cScreenHeight div 2;
   640     ViewTopY:= round(-tmp) + cScreenHeight div 2;
   641     ViewTopY   := -tmp + cScreenHeight div 2;
   641 
   642 
   642     // visual debugging fun :D
   643     // visual debugging fun :D
   643     if cViewLimitsDebug then
   644     if cViewLimitsDebug then
   644         begin
   645         begin
   645         // some margin on each side
   646         // some margin on each side
   646         tmp:= min(cScreenWidth, cScreenHeight) div 2 / cScaleFactor;
   647         tmp:= trunc(min(cScreenWidth, cScreenHeight) div 2 / cScaleFactor);
   647         ViewLeftX  := ViewLeftX   + trunc(tmp);
   648         ViewLeftX  := ViewLeftX   + trunc(tmp);
   648         ViewRightX := ViewRightX  - trunc(tmp);
   649         ViewRightX := ViewRightX  - trunc(tmp);
   649         ViewBottomY:= ViewBottomY - trunc(tmp);
   650         ViewBottomY:= ViewBottomY - trunc(tmp);
   650         ViewTopY   := ViewTopY    + trunc(tmp);
   651         ViewTopY   := ViewTopY    + trunc(tmp);
   651         end;
   652         end;