this supposedly makes hwengine work with sdl 1.3 past rev 5296
authorkoda
Thu, 24 Mar 2011 16:06:03 +0100
changeset 5045 f215eb5d4b75
parent 5043 2df62e1a6c02
child 5046 fc6639d56799
this supposedly makes hwengine work with sdl 1.3 past rev 5296
hedgewars/uStore.pas
hedgewars/uVariables.pas
--- a/hedgewars/uStore.pas	Wed Mar 23 16:27:24 2011 +0100
+++ b/hedgewars/uStore.pas	Thu Mar 24 16:06:03 2011 +0100
@@ -627,7 +627,7 @@
     // enable alpha blending
     glEnable(GL_BLEND);
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-    // disable/lower perspective correction (won't need it anyway)
+    // disable/lower perspective correction (will not need it anyway)
     glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
     // disable dithering
     glDisable(GL_DITHER);
@@ -871,7 +871,7 @@
 
 procedure FreeWeaponTooltip;
 begin
-// free the existing texture (if there's any)
+// free the existing texture (if there is any)
 if WeaponTooltipTex = nil then
     exit;
 FreeTexture(WeaponTooltipTex);
@@ -938,10 +938,13 @@
     SDL_SetRenderDrawColor(SDLrender, 0, 0, 0, 255);
     SDL_RenderClear(SDLrender);
     SDL_RenderPresent(SDLrender);
+
+    // we need to reset the gl context from the one created by SDL as we have our own drawing system
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
 {$ELSE}
     SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags);
     SDLTry(SDLPrimSurface <> nil, true);
-    PixelFormat:= SDLPrimSurface^.format;
 {$ENDIF}
 
     AddFileLog('Setting up OpenGL (using driver: ' + shortstring(SDL_VideoDriverName(buf, sizeof(buf))) + ')');
@@ -954,7 +957,6 @@
 begin
     RegisterVariable('fullscr', vtCommand, @chFullScr, true);
 
-    PixelFormat:= nil;
     SDLPrimSurface:= nil;
 
 {$IFNDEF IPHONEOS}
--- a/hedgewars/uVariables.pas	Wed Mar 23 16:27:24 2011 +0100
+++ b/hedgewars/uVariables.pas	Thu Mar 24 16:06:03 2011 +0100
@@ -2166,7 +2166,6 @@
     bAFRRight: Boolean;
 
 
-    PixelFormat: PSDL_PixelFormat;
     SDLPrimSurface: PSDL_Surface;
     PauseTexture,
     SyncTexture,