hedgewars/uStore.pas
changeset 7198 5debd5fe526e
parent 7180 53ffc8853008
child 7235 baa69bd025d9
equal deleted inserted replaced
7196:4fba5519c37f 7198:5debd5fe526e
    45 procedure WarpMouse(x, y: Word); inline;
    45 procedure WarpMouse(x, y: Word); inline;
    46 procedure SwapBuffers; inline;
    46 procedure SwapBuffers; inline;
    47 
    47 
    48 implementation
    48 implementation
    49 uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands,
    49 uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands,
    50      uDebug{$IFDEF USE_CONTEXT_RESTORE}, uWorld{$ENDIF}, glut;
    50      uDebug{$IFDEF USE_CONTEXT_RESTORE}, uWorld{$ENDIF} {$IFDEF USE_VIDEO_RECORDING}, glut {$ENDIF};
    51 
    51 
    52 //type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
    52 //type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
    53 
    53 
    54 var MaxTextureSize: LongInt;
    54 var MaxTextureSize: LongInt;
    55 {$IFDEF SDL13}
    55 {$IFDEF SDL13}
   437 if not reload then
   437 if not reload then
   438     AddProgress;
   438     AddProgress;
   439 IMG_Quit();
   439 IMG_Quit();
   440 end;
   440 end;
   441 
   441 
       
   442 {$IF NOT DEFINED(S3D_DISABLED) OR DEFINED(USE_VIDEO_RECORDING)}
   442 procedure CreateFramebuffer(var frame, depth, tex: GLuint);
   443 procedure CreateFramebuffer(var frame, depth, tex: GLuint);
   443 begin
   444 begin
   444     glGenFramebuffersEXT(1, @frame);
   445     glGenFramebuffersEXT(1, @frame);
   445     glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frame);
   446     glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frame);
   446     glGenRenderbuffersEXT(1, @depth);
   447     glGenRenderbuffersEXT(1, @depth);
   459 begin
   460 begin
   460     glDeleteTextures(1, @tex);
   461     glDeleteTextures(1, @tex);
   461     glDeleteRenderbuffersEXT(1, @depth);
   462     glDeleteRenderbuffersEXT(1, @depth);
   462     glDeleteFramebuffersEXT(1, @frame);
   463     glDeleteFramebuffersEXT(1, @frame);
   463 end;
   464 end;
       
   465 {$ENDIF}
   464 
   466 
   465 procedure StoreRelease(reload: boolean);
   467 procedure StoreRelease(reload: boolean);
   466 var ii: TSprite;
   468 var ii: TSprite;
   467     ai: TAmmoType;
   469     ai: TAmmoType;
   468     i, t: LongInt;
   470     i, t: LongInt;
   533                 FreeTexture(TeamsArray[t]^.Hedgehogs[i].HatTex);
   535                 FreeTexture(TeamsArray[t]^.Hedgehogs[i].HatTex);
   534                 TeamsArray[t]^.Hedgehogs[i].HatTex:= nil;
   536                 TeamsArray[t]^.Hedgehogs[i].HatTex:= nil;
   535                 end;
   537                 end;
   536             end;
   538             end;
   537         end;
   539         end;
       
   540 {$IFDEF USE_VIDEO_RECORDING}
   538     if defaultFrame <> 0 then
   541     if defaultFrame <> 0 then
   539         DeleteFramebuffer(defaultFrame, depthv, texv);
   542         DeleteFramebuffer(defaultFrame, depthv, texv);
       
   543 {$ENDIF}
   540 {$IFNDEF S3D_DISABLED}
   544 {$IFNDEF S3D_DISABLED}
   541     if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) or (cStereoMode = smAFR) then
   545     if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) or (cStereoMode = smAFR) then
   542         begin
   546         begin
   543         DeleteFramebuffer(framel, depthl, texl);
   547         DeleteFramebuffer(framel, depthl, texl);
   544         DeleteFramebuffer(framer, depthr, texr);
   548         DeleteFramebuffer(framer, depthr, texr);
   705     AddFileLog('  |----- Texture Size: ' + inttostr(MaxTextureSize));
   709     AddFileLog('  |----- Texture Size: ' + inttostr(MaxTextureSize));
   706     AddFileLog('  |----- Number of auxilary buffers: ' + inttostr(AuxBufNum));
   710     AddFileLog('  |----- Number of auxilary buffers: ' + inttostr(AuxBufNum));
   707     AddFileLog('  \----- Extensions: ');
   711     AddFileLog('  \----- Extensions: ');
   708     AddFileLogRaw(glGetString(GL_EXTENSIONS));
   712     AddFileLogRaw(glGetString(GL_EXTENSIONS));
   709     AddFileLog('');
   713     AddFileLog('');
   710     //TODO: don't have the Extensions line trimmed but slipt it into multiple lines
   714     //TODO: slipt Extensions line into multiple lines
   711 
   715 
   712     defaultFrame:= 0;
   716     defaultFrame:= 0;
       
   717 {$IFDEF USE_VIDEO_RECORDING}
   713     if GameType = gmtRecord then
   718     if GameType = gmtRecord then
   714     begin  
   719     begin  
   715         if AuxBufNum > 0 then
   720         if AuxBufNum > 0 then
   716         begin
   721         begin
   717             glDrawBuffer(GL_AUX0);
   722             glDrawBuffer(GL_AUX0);
   729             glDrawBuffer(GL_BACK);
   734             glDrawBuffer(GL_BACK);
   730             glReadBuffer(GL_BACK);
   735             glReadBuffer(GL_BACK);
   731             AddFileLog('Warning: off-screen rendering is not supported; using back buffer but it may not work.');
   736             AddFileLog('Warning: off-screen rendering is not supported; using back buffer but it may not work.');
   732         end;
   737         end;
   733     end;
   738     end;
       
   739 {$ENDIF}
   734 
   740 
   735 {$IFNDEF S3D_DISABLED}
   741 {$IFNDEF S3D_DISABLED}
   736     if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) or (cStereoMode = smAFR) then
   742     if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) or (cStereoMode = smAFR) then
   737     begin
   743     begin
   738         // prepare left and right frame buffers and associated textures
   744         // prepare left and right frame buffers and associated textures