DEADSOFTWARE

system: fix stencil check
[d2df-sdl.git] / src / game / sdl2 / g_system.pas
index 9cd1ee194b0ae4b89bb587e593c689067fd477cb..6f48d28bef982189e1b68bd9243f897eb723ce5f 100644 (file)
@@ -75,17 +75,27 @@ implementation
   (* --------- Graphics --------- *)
 
   function LoadGL: Boolean;
+    var ltmp: Integer;
   begin
     result := true;
     {$IFDEF NOGL_INIT}
-    nogl_Init;
-    if glRenderToFBO and (not nogl_ExtensionSupported('GL_OES_framebuffer_object')) then
+      nogl_Init;
+      if glRenderToFBO and (not nogl_ExtensionSupported('GL_OES_framebuffer_object')) then
+      begin
+        e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering');
+        glRenderToFBO := false;
+      end;
     {$ELSE}
-    if glRenderToFBO and (not Load_GL_ARB_framebuffer_object) then
+      if glRenderToFBO and (not Load_GL_ARB_framebuffer_object) then
+      begin
+        e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering');
+        glRenderToFBO := false;
+      end;
     {$ENDIF}
+    if SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, @ltmp) = 0 then
     begin
-      e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering');
-      glRenderToFBO := false;
+      e_LogWritefln('stencil buffer size: %s', [ltmp]);
+      gwin_has_stencil := (ltmp > 0);
     end;
   end;