hedgewars/uStore.pas
changeset 10309 e338ccbbe100
parent 10304 7e40820b7ed6
child 10443 42dadeb6e8ae
equal deleted inserted replaced
10308:7350be35b335 10309:e338ccbbe100
   487     end;
   487     end;
   488 
   488 
   489 IMG_Quit();
   489 IMG_Quit();
   490 end;
   490 end;
   491 
   491 
   492 {$IF DEFINED(USE_S3D_RENDERING) OR DEFINED(USE_VIDEO_RECORDING)}
       
   493 procedure CreateFramebuffer(var frame, depth, tex: GLuint);
       
   494 begin
       
   495     glGenFramebuffersEXT(1, @frame);
       
   496     glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frame);
       
   497     glGenRenderbuffersEXT(1, @depth);
       
   498     glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depth);
       
   499     glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, cScreenWidth, cScreenHeight);
       
   500     glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth);
       
   501     glGenTextures(1, @tex);
       
   502     glBindTexture(GL_TEXTURE_2D, tex);
       
   503     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8,  cScreenWidth, cScreenHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil);
       
   504     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
       
   505     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
       
   506     glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex, 0);
       
   507 end;
       
   508 
       
   509 procedure DeleteFramebuffer(var frame, depth, tex: GLuint);
       
   510 begin
       
   511     glDeleteTextures(1, @tex);
       
   512     glDeleteRenderbuffersEXT(1, @depth);
       
   513     glDeleteFramebuffersEXT(1, @frame);
       
   514 end;
       
   515 {$ENDIF}
       
   516 
       
   517 procedure StoreRelease(reload: boolean);
   492 procedure StoreRelease(reload: boolean);
   518 var ii: TSprite;
   493 var ii: TSprite;
   519     ai: TAmmoType;
   494     ai: TAmmoType;
   520     i, t: LongInt;
   495     i, t: LongInt;
   521 begin
   496 begin
   739             prevHat:= newHat
   714             prevHat:= newHat
   740         // cleanup: free temporary surface mem
   715         // cleanup: free temporary surface mem
   741         else
   716         else
   742             freeTmpHatSurf();
   717             freeTmpHatSurf();
   743         end;
   718         end;
   744 end;
       
   745 
       
   746 function glLoadExtension(extension : shortstring) : boolean;
       
   747 begin
       
   748 //TODO: pas2c does not handle {$IF (GLunit = gles11) OR DEFINED(PAS2C)}
       
   749 {$IFNDEF PAS2C}
       
   750 {$IF GLunit = gles11}
       
   751     // FreePascal doesnt come with OpenGL ES 1.1 Extension headers
       
   752     extension:= extension; // avoid hint
       
   753     glLoadExtension:= false;
       
   754     AddFileLog('OpenGL - "' + extension + '" skipped')
       
   755 {$ELSE}
       
   756     glLoadExtension:= glext_LoadExtension(extension);
       
   757     if glLoadExtension then
       
   758         AddFileLog('OpenGL - "' + extension + '" loaded')
       
   759     else
       
   760         AddFileLog('OpenGL - "' + extension + '" failed to load');
       
   761 {$ENDIF}
       
   762 
       
   763 {$ELSE} // pas2c part
       
   764     glLoadExtension:= false;
       
   765 {$ENDIF}
       
   766 end;
   719 end;
   767 
   720 
   768 procedure SetupOpenGLAttributes;
   721 procedure SetupOpenGLAttributes;
   769 begin
   722 begin
   770 {$IFDEF IPHONEOS}
   723 {$IFDEF IPHONEOS}
  1091     // we do not need a window, but without this call OpenGL will not initialize
  1044     // we do not need a window, but without this call OpenGL will not initialize
  1092     glutCreateWindow('hedgewars video rendering (glut hidden window)');
  1045     glutCreateWindow('hedgewars video rendering (glut hidden window)');
  1093     glutHideWindow();
  1046     glutHideWindow();
  1094     // we do not need to set this callback, but it is required for GLUT3 compat
  1047     // we do not need to set this callback, but it is required for GLUT3 compat
  1095     glutDisplayFunc(@SwapBuffers);
  1048     glutDisplayFunc(@SwapBuffers);
  1096     SetupRenderer();
  1049     RenderSetup();
  1097 end;
  1050 end;
  1098 {$ENDIF} // SDL2
  1051 {$ENDIF} // SDL2
  1099 {$ENDIF} // USE_VIDEO_RECORDING
  1052 {$ENDIF} // USE_VIDEO_RECORDING
  1100 
  1053 
  1101 procedure chFullScr(var s: shortstring);
  1054 procedure chFullScr(var s: shortstring);