DEADSOFTWARE

gl: do not scale vitrual keyboard with r_resoulution scale
[d2df-sdl.git] / src / game / renders / opengl / r_render.pas
index 80783b6d7f82784d21db3a21ab4e1b90d29e7719..791a29fc55731ac3277c4445e29bea4191a41c2d 100644 (file)
@@ -82,11 +82,7 @@ interface
 implementation
 
   uses
-    {$IFDEF USE_GLES1}
-      GLES11,
-    {$ELSE}
-      GL, GLEXT,
-    {$ENDIF}
+    {$I ../../../nogl/noGLuses.inc}
     {$IFDEF ENABLE_MENU}
       r_gui,
     {$ENDIF}
@@ -205,11 +201,24 @@ implementation
     info.maximized := gRC_Maximized;
     info.major := 1;
     info.minor := 1;
-    info.profile := TGLProfile.Compat;
+    {$IFDEF USE_GLES1}
+      info.profile := TGLProfile.Common;
+    {$ELSE}
+      info.profile := TGLProfile.Compat;
+    {$ENDIF}
     result := info;
   end;
 {$ENDIF}
 
+  procedure r_Render_LogGLInfo;
+  begin
+    e_LogWritefln('GL Vendor: %s', [glGetString(GL_VENDOR)]);
+    e_LogWritefln('GL Renderer: %s', [glGetString(GL_RENDERER)]);
+    e_LogWritefln('GL Version: %s', [glGetString(GL_VERSION)]);
+    e_LogWritefln('GL Shaders: %s', [glGetString(GL_SHADING_LANGUAGE_VERSION)]);
+    e_LogWritefln('GL Extensions: %s', [glGetString(GL_EXTENSIONS)]);
+  end;
+
   procedure r_Render_Initialize;
   begin
     {$IFDEF ENABLE_SYSTEM}
@@ -217,6 +226,10 @@ implementation
         raise Exception.Create('Failed to set videomode on startup.');
       sys_EnableVSync(gVSync);
     {$ENDIF}
+    {$IFDEF NOGL_INIT}
+      nogl_Init;
+    {$ENDIF}
+    r_Render_LogGLInfo;
     r_LoadScreen_Initialize;
     r_Textures_Initialize;
     r_Console_Initialize;
@@ -229,6 +242,9 @@ implementation
     r_Console_Finalize;
     r_Textures_Finalize;
     r_LoadScreen_Finalize;
+    {$IFDEF NOGL_INIT}
+      nogl_Quit;
+    {$ENDIF}
   end;
 
   procedure r_Render_Update;
@@ -323,7 +339,7 @@ implementation
 
     if gShowScore and (gGameSettings.GameMode in [GM_TDM, GM_CTF]) then
     begin
-      (* RED TEAM GOALS *)
+      (* RED TEAM SCORE *)
       fw := 0;
       if gGameSettings.GameMode = GM_CTF then
       begin
@@ -340,7 +356,7 @@ implementation
       end;
       r_Common_DrawText(IntToStr(gTeamStat[TEAM_RED].Score), x + w - 16 - fw, y + 240 - 72 - 4, TEAMCOLOR[TEAM_RED].R, TEAMCOLOR[TEAM_RED].G, TEAMCOLOR[TEAM_RED].B, 255, menufont, TBasePoint.BP_RIGHTUP);
 
-      (* BLUE TEAM GOALS *)
+      (* BLUE TEAM SCORE *)
       fw := 0;
       if gGameSettings.GameMode = GM_CTF then
       begin
@@ -557,7 +573,7 @@ implementation
     w3 := cw * 8;           (* frags width *)
     w2 := cw * 12;          (* ping/loss width *)
     w1 := w - w2 - w3 - w4; (* name width *)
-    tw := w1 - cw * 2 - w2; (* team goals *)
+    tw := w1 - cw * 2 - w2; (* team score *)
     if cs.PlayerStat = nil then players := 0 else players := Length(cs.PlayerStat);
     yy := y;
     if cs.GameMode in [GM_TDM, GM_CTF] then
@@ -1065,7 +1081,7 @@ implementation
     r_Draw_Setup(gWinSizeX, gWinSizeY, gScreenWidth, gScreenHeight);
 
     glClearColor(0.0, 0.0, 0.0, 0.0);
-    glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
+    glClear(GL_COLOR_BUFFER_BIT);
 
     p1 := nil;
     p2 := nil;
@@ -1244,6 +1260,7 @@ implementation
     {$ENDIF}
 
     {$IFDEF ENABLE_TOUCH}
+      glScalef(1 / r_pixel_scale, 1 / r_pixel_scale, 0);
       r_Touch_Draw;
     {$ENDIF}
 
@@ -1267,7 +1284,10 @@ implementation
         e_LogWriteln('resolution changed')
       else
         e_LogWriteln('resolution not changed');
-      sys_EnableVSync(gVSync)
+      sys_EnableVSync(gVSync);
+    {$ENDIF}
+    {$IFDEF NOGL_INIT}
+      nogl_Init;
     {$ENDIF}
   end;