--- a/hedgewars/uStore.pas Fri Aug 05 01:22:51 2011 +0200
+++ b/hedgewars/uStore.pas Sat Aug 06 07:09:30 2011 +0200
@@ -525,17 +525,24 @@
end;
procedure SetupOpenGL;
-{$IFNDEF IPHONEOS}
-var vendor: shortstring;
+var vendor: shortstring = '';
{$IFDEF DARWIN}
const one : LongInt = 1;
{$ENDIF}
+begin
+{$IFDEF SDL13}
+ // this function creates an opengles1.1 context by default on mobile devices
+ // use SDL_GL_SetAttribute to change this behaviour
+ SDLGLcontext:=SDL_GL_CreateContext(SDLwindow);
+ SDLTry(SDLGLcontext <> nil, true);
+ SDL_GL_SetSwapInterval(1);
{$ENDIF}
-begin
{$IFDEF IPHONEOS}
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0);
SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1);
+ vendor:= vendor; // avoid hint
+ one:= one; // avoid hint
{$ELSE}
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
vendor:= LowerCase(shortstring(pchar(glGetString(GL_VENDOR))));
@@ -709,7 +716,7 @@
DrawFromRect( -squaresize div 2, (cScreenHeight - squaresize) shr 1, @r, ProgrTex);
{$IFDEF SDL13}
- SDL_RenderPresent(SDLrender);
+ SDL_GL_SwapWindow(SDLwindow);
{$ELSE}
SDL_GL_SwapBuffers();
{$ENDIF}
@@ -957,24 +964,11 @@
x:= x or (SDL_GetNumVideoDisplays() - 1);
y:= y or (SDL_GetNumVideoDisplays() - 1);
- // hardcode the opengles driver as we do our own drawing
- SDL_SetHint('SDL_RENDER_DRIVER','opengles');
- flags:= flags or SDL_WINDOW_BORDERLESS; // do not set SDL_WINDOW_RESIZABLE on iOS
+ flags:= flags or SDL_WINDOW_BORDERLESS or SDL_WINDOW_RESIZABLE;
{$ENDIF}
SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cScreenWidth, cScreenHeight, flags);
SDLTry(SDLwindow <> nil, true);
- SDLrender:= SDL_CreateRenderer(SDLwindow, -1, SDL_RENDERER_ACCELERATED or SDL_RENDERER_PRESENTVSYNC);
- SDLTry(SDLrender <> nil, true);
-
- // clean the renderer before using it
- SDL_SetRenderDrawColor(SDLrender, 0, 0, 0, 255);
- SDL_RenderClear(SDLrender);
- SDL_RenderPresent(SDLrender);
-
- // reset the gl context from the one created by SDL (as we have our own drawing system)
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
{$ELSE}
if not cOnlyStats then
begin