hedgewars/uRender.pas
branchqmlfrontend
changeset 11403 b894922d58cc
parent 11071 3851ce4f2061
parent 11379 7bc9042549c1
child 11828 a69124eb7ce7
equal deleted inserted replaced
11076:fcbdee9cdd74 11403:b894922d58cc
   356     CompileProgram:= program_;
   356     CompileProgram:= program_;
   357 end;
   357 end;
   358 {$ENDIF}
   358 {$ENDIF}
   359 
   359 
   360 function glLoadExtension(extension : shortstring) : boolean;
   360 function glLoadExtension(extension : shortstring) : boolean;
   361 begin
   361 var logmsg: shortstring;
   362 //TODO: pas2c does not handle {$IF (GLunit = gles11) OR DEFINED(PAS2C)}
   362 begin
   363 {$IFNDEF PAS2C}
       
   364 {$IF GLunit = gles11}
       
   365     // FreePascal doesnt come with OpenGL ES 1.1 Extension headers
       
   366     extension:= extension; // avoid hint
   363     extension:= extension; // avoid hint
   367     glLoadExtension:= false;
   364     glLoadExtension:= false;
   368     AddFileLog('OpenGL - "' + extension + '" skipped')
   365     logmsg:= 'OpenGL - "' + extension + '" skipped';
   369 {$ELSE}
   366 
       
   367 {$IFNDEF IPHONEOS}
       
   368 //TODO: pas2c does not handle
       
   369 {$IFNDEF PAS2C}
       
   370 // FreePascal doesnt come with OpenGL ES 1.1 Extension headers
       
   371 {$IF GLunit <> gles11}
       
   372 
   370     glLoadExtension:= glext_LoadExtension(extension);
   373     glLoadExtension:= glext_LoadExtension(extension);
       
   374 
   371     if glLoadExtension then
   375     if glLoadExtension then
   372         AddFileLog('OpenGL - "' + extension + '" loaded')
   376         logmsg:= 'OpenGL - "' + extension + '" loaded'
   373     else
   377     else
   374         AddFileLog('OpenGL - "' + extension + '" failed to load');
   378         logmsg:= 'OpenGL - "' + extension + '" failed to load';
   375 {$ENDIF}
   379 
   376 
   380 {$ENDIF}
   377 {$ELSE} // pas2c part
   381 {$ENDIF}
   378     glLoadExtension:= false;
   382 {$ENDIF}
   379 {$ENDIF}
   383     AddFileLog(logmsg);
   380 end;
   384 end;
   381 
   385 
   382 {$IFDEF USE_S3D_RENDERING OR USE_VIDEO_RECORDING}
   386 {$IFDEF USE_S3D_RENDERING OR USE_VIDEO_RECORDING}
   383 procedure CreateFramebuffer(var frame, depth, tex: GLuint);
   387 procedure CreateFramebuffer(var frame, depth, tex: GLuint);
   384 begin
   388 begin
   425 var AuxBufNum: LongInt = 0;
   429 var AuxBufNum: LongInt = 0;
   426     tmpstr: ansistring;
   430     tmpstr: ansistring;
   427     tmpint: LongInt;
   431     tmpint: LongInt;
   428     tmpn: LongInt;
   432     tmpn: LongInt;
   429 begin
   433 begin
   430 {$IFDEF MOBILE}
       
   431     // TODO: this function creates an opengles1.1 context
       
   432     // un-comment below and add proper logic to support opengles2.0
       
   433     //SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
       
   434     //SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
       
   435     if SDLGLcontext = nil then
       
   436         SDLGLcontext:= SDL_GL_CreateContext(SDLwindow);
       
   437     SDLTry(SDLGLcontext <> nil, true);
       
   438     SDL_GL_SetSwapInterval(1);
       
   439 {$ENDIF}
       
   440 
       
   441     // suppress hint/warning
   434     // suppress hint/warning
   442     AuxBufNum:= AuxBufNum;
   435     AuxBufNum:= AuxBufNum;
   443 
   436 
   444     // get the max (h and v) size for textures that the gpu can support
   437     // get the max (h and v) size for textures that the gpu can support
   445     glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTextureSize);
   438     glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTextureSize);