When compiling with sdl2 use it instead of glut for creating hidden window (as suggested by koda).
authorStepan777 <stepik-777@mail.ru>
Fri, 06 Jul 2012 13:22:33 +0400
changeset 7350 1dbf3f4340e0
parent 7347 88685fbb2679
child 7353 0e55228e1303
When compiling with sdl2 use it instead of glut for creating hidden window (as suggested by koda). This is not tested but it should work.
hedgewars/uStore.pas
--- a/hedgewars/uStore.pas	Fri Jul 06 12:50:18 2012 +0400
+++ b/hedgewars/uStore.pas	Fri Jul 06 13:22:33 2012 +0400
@@ -49,7 +49,8 @@
 
 implementation
 uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands,
-     uDebug{$IFDEF USE_CONTEXT_RESTORE}, uWorld{$ENDIF} {$IFDEF USE_VIDEO_RECORDING}, glut {$ENDIF};
+     uDebug{$IFDEF USE_CONTEXT_RESTORE}, uWorld{$ENDIF}
+     {$IF NOT DEFINED(SDL13) AND DEFINED(USE_VIDEO_RECORDING)}, glut {$ENDIF};
 
 //type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
 
@@ -1025,6 +1026,18 @@
 end;
 
 {$IFDEF USE_VIDEO_RECORDING}
+{$IFDEF SDL13}
+procedure InitOffscreenOpenGL;
+begin
+    // create hidden window
+    SDLwindow:= SDL_CreateWindow('hedgewars (you don''t see this)',
+                                 SDL_WINDOWPOS_CENTERED_MASK, SDL_WINDOWPOS_CENTERED_MASK,
+                                 cScreenWidth, cScreenHeight,
+                                 SDL_WINDOW_HIDDEN or SDL_WINDOW_OPENGL);
+    SDLTry(SDLwindow <> nil, true);
+    SetupOpenGL();
+end;
+{$ELSE}
 procedure InitOffscreenOpenGL;
 var ArgCount: LongInt;
     PrgName: pchar;
@@ -1033,11 +1046,12 @@
     PrgName:= 'hwengine';
     glutInit(@ArgCount, @PrgName);
     glutInitWindowSize(cScreenWidth, cScreenHeight);
-    glutCreateWindow('You don''t see this'); // we don't need a window, but if this function is not called then OpenGL will not be initialized
+    glutCreateWindow('hedgewars (you don''t see this)'); // we don't need a window, but if this function is not called then OpenGL will not be initialized
     glutHideWindow();
     SetupOpenGL();
 end;
-{$ENDIF}
+{$ENDIF} // SDL13
+{$ENDIF} // USE_VIDEO_RECORDING
 
 procedure chFullScr(var s: shortstring);
 var flags: Longword = 0;