hedgewars/uRender.pas
changeset 11798 984f9c76146d
parent 11792 d8b7884abf9c
child 11800 6e6248c43942
equal deleted inserted replaced
11797:d9d48143dcbe 11798:984f9c76146d
   102 procedure openglTranslatef      (X, Y, Z: GLfloat); inline;
   102 procedure openglTranslatef      (X, Y, Z: GLfloat); inline;
   103 
   103 
   104 
   104 
   105 implementation
   105 implementation
   106 uses {$IFNDEF PAS2C} StrUtils, {$ENDIF}SysUtils, uVariables, uUtils, uConsts
   106 uses {$IFNDEF PAS2C} StrUtils, {$ENDIF}SysUtils, uVariables, uUtils, uConsts
   107      {$IFDEF GL2}, uMatrix, uConsole{$ENDIF};
   107      {$IFDEF GL2}, uMatrix, uConsole{$ENDIF}, uPhysFSLayer, uDebug;
   108 
   108 
   109 {$IFDEF USE_TOUCH_INTERFACE}
   109 {$IFDEF USE_TOUCH_INTERFACE}
   110 const
   110 const
   111     FADE_ANIM_TIME = 500;
   111     FADE_ANIM_TIME = 500;
   112     MOVE_ANIM_TIME = 500;
   112     MOVE_ANIM_TIME = 500;
   254 
   254 
   255 {$IFDEF GL2}
   255 {$IFDEF GL2}
   256 function CompileShader(shaderFile: string; shaderType: GLenum): GLuint;
   256 function CompileShader(shaderFile: string; shaderType: GLenum): GLuint;
   257 var
   257 var
   258     shader: GLuint;
   258     shader: GLuint;
   259     f: Textfile;
   259     f: PFSFile;
   260     source, line: AnsiString;
   260     source, line: AnsiString;
   261     sourceA: Pchar;
   261     sourceA: Pchar;
   262     lengthA: GLint;
   262     lengthA: GLint;
   263     compileResult: GLint;
   263     compileResult: GLint;
   264     logLength: GLint;
   264     logLength: GLint;
   265     log: PChar;
   265     log: PChar;
   266 begin
   266 begin
   267     Assign(f, PathPrefix + cPathz[ptShaders] + '/' + shaderFile);
   267     f:= pfsOpenRead(cPathz[ptShaders] + '/' + shaderFile);
   268     filemode:= 0; // readonly
   268     checkFails(f <> nil, 'Unable to load ' + shaderFile, true);
   269     Reset(f);
       
   270     if IOResult <> 0 then
       
   271     begin
       
   272         AddFileLog('Unable to load ' + shaderFile);
       
   273         halt(HaltStartupError);
       
   274     end;
       
   275 
   269 
   276     source:='';
   270     source:='';
   277     while not eof(f) do
   271     while not pfsEof(f) do
   278     begin
   272     begin
   279         ReadLn(f, line);
   273         pfsReadLnA(f, line);
   280         source:= source + line + #10;
   274         source:= source + line + #10;
   281     end;
   275     end;
   282 
   276 
   283     Close(f);
   277     pfsClose(f);
   284 
   278 
   285     WriteLnToConsole('Compiling shader: ' + PathPrefix + cPathz[ptShaders] + '/' + shaderFile);
   279     WriteLnToConsole('Compiling shader: ' + PathPrefix + cPathz[ptShaders] + '/' + shaderFile);
   286 
   280 
   287     sourceA:=PChar(source);
   281     sourceA:=PChar(source);
   288     lengthA:=Length(source);
   282     lengthA:=Length(source);