hedgewars/uRender.pas
changeset 10952 8ad21fe5d062
parent 10873 84c00d1127d6
child 11000 b1c8027cc8f7
equal deleted inserted replaced
10950:356c8fb7fb56 10952:8ad21fe5d062
   467     tmpstr := StrPas(PChar(glGetString(GL_EXTENSIONS)));
   467     tmpstr := StrPas(PChar(glGetString(GL_EXTENSIONS)));
   468     tmpn := WordCount(tmpstr, [' ']);
   468     tmpn := WordCount(tmpstr, [' ']);
   469     tmpint := 1;
   469     tmpint := 1;
   470 
   470 
   471     repeat
   471     repeat
   472     begin
   472         begin
   473         // print up to 3 extentions per row
   473         // print up to 3 extentions per row
   474         // ExtractWord will return empty string if index out of range
   474         // ExtractWord will return empty string if index out of range
   475         AddFileLog(TrimRight(
   475         AddFileLog(TrimRight(
   476             ExtractWord(tmpint, tmpstr, [' ']) + ' ' +
   476             ExtractWord(tmpint, tmpstr, [' ']) + ' ' +
   477             ExtractWord(tmpint+1, tmpstr, [' ']) + ' ' +
   477             ExtractWord(tmpint+1, tmpstr, [' ']) + ' ' +
   478             ExtractWord(tmpint+2, tmpstr, [' '])
   478             ExtractWord(tmpint+2, tmpstr, [' '])
   479         ));
   479         ));
   480         tmpint := tmpint + 3;
   480         tmpint := tmpint + 3;
   481     end;
   481         end;
   482     until (tmpint > tmpn);
   482     until (tmpint > tmpn);
   483 {$ENDIF}
   483 {$ENDIF}
   484     AddFileLog('');
   484     AddFileLog('');
   485 
   485 
   486     defaultFrame:= 0;
   486     defaultFrame:= 0;
   487 
   487 
   488 {$IFDEF USE_VIDEO_RECORDING}
   488 {$IFDEF USE_VIDEO_RECORDING}
   489     if GameType = gmtRecord then
   489     if GameType = gmtRecord then
   490     begin
   490         begin
   491         if glLoadExtension('GL_EXT_framebuffer_object') then
   491         if glLoadExtension('GL_EXT_framebuffer_object') then
   492         begin
   492             begin
   493             CreateFramebuffer(defaultFrame, depthv, texv);
   493             CreateFramebuffer(defaultFrame, depthv, texv);
   494             glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, defaultFrame);
   494             glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, defaultFrame);
   495             AddFileLog('Using framebuffer for video recording.');
   495             AddFileLog('Using framebuffer for video recording.');
   496         end
   496             end
   497         else if AuxBufNum > 0 then
   497         else if AuxBufNum > 0 then
   498         begin
   498             begin
   499             glDrawBuffer(GL_AUX0);
   499             glDrawBuffer(GL_AUX0);
   500             glReadBuffer(GL_AUX0);
   500             glReadBuffer(GL_AUX0);
   501             AddFileLog('Using auxiliary buffer for video recording.');
   501             AddFileLog('Using auxiliary buffer for video recording.');
   502         end
   502             end
   503         else
   503         else
   504         begin
   504             begin
   505             glDrawBuffer(GL_BACK);
   505             glDrawBuffer(GL_BACK);
   506             glReadBuffer(GL_BACK);
   506             glReadBuffer(GL_BACK);
   507             AddFileLog('Warning: off-screen rendering is not supported; using back buffer but it may not work.');
   507             AddFileLog('Warning: off-screen rendering is not supported; using back buffer but it may not work.');
       
   508             end;
   508         end;
   509         end;
   509     end;
       
   510 {$ENDIF}
   510 {$ENDIF}
   511 
   511 
   512 {$IFDEF GL2}
   512 {$IFDEF GL2}
   513 
   513 
   514 {$IFDEF PAS2C}
   514 {$IFDEF PAS2C}
   515     err := glewInit();
   515     err := glewInit();
   516     if err <> GLEW_OK then
   516     if err <> GLEW_OK then
   517     begin
   517         begin
   518         WriteLnToConsole('Failed to initialize GLEW.');
   518         WriteLnToConsole('Failed to initialize GLEW.');
   519         halt(HaltStartupError);
   519         halt(HaltStartupError);
   520     end;
   520         end;
   521 {$ENDIF}
   521 {$ENDIF}
   522 
   522 
   523 {$IFNDEF PAS2C}
   523 {$IFNDEF PAS2C}
   524     if not Load_GL_VERSION_2_0 then
   524     if not Load_GL_VERSION_2_0 then
   525         halt;
   525         halt;
   542     UpdateModelviewProjection;
   542     UpdateModelviewProjection;
   543 {$ENDIF}
   543 {$ENDIF}
   544 
   544 
   545 {$IFDEF USE_S3D_RENDERING}
   545 {$IFDEF USE_S3D_RENDERING}
   546     if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) then
   546     if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) then
   547     begin
   547         begin
   548         // prepare left and right frame buffers and associated textures
   548         // prepare left and right frame buffers and associated textures
   549         if glLoadExtension('GL_EXT_framebuffer_object') then
   549         if glLoadExtension('GL_EXT_framebuffer_object') then
   550             begin
   550             begin
   551             CreateFramebuffer(framel, depthl, texl);
   551             CreateFramebuffer(framel, depthl, texl);
   552             CreateFramebuffer(framer, depthr, texr);
   552             CreateFramebuffer(framer, depthr, texr);
   557             // reset
   557             // reset
   558             glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, defaultFrame)
   558             glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, defaultFrame)
   559             end
   559             end
   560         else
   560         else
   561             cStereoMode:= smNone;
   561             cStereoMode:= smNone;
   562     end;
   562         end;
   563 
   563 
   564     // set up vertex/texture buffers for frame textures
   564     // set up vertex/texture buffers for frame textures
   565     texLRDtb[0].X:= 0.0;
   565     texLRDtb[0].X:= 0.0;
   566     texLRDtb[0].Y:= 0.0;
   566     texLRDtb[0].Y:= 0.0;
   567     texLRDtb[1].X:= 1.0;
   567     texLRDtb[1].X:= 1.0;