From: DeaDDooMER Date: Mon, 13 Feb 2023 16:56:20 +0000 (+0300) Subject: gl: fix build for gles (still not work on android) X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=commitdiff_plain;h=b5d789f0a119c0e2db9403c2e19e6344b88f582d gl: fix build for gles (still not work on android) --- diff --git a/src/game/renders/opengl/r_draw.pas b/src/game/renders/opengl/r_draw.pas index 8442a2a..fdb7c09 100644 --- a/src/game/renders/opengl/r_draw.pas +++ b/src/game/renders/opengl/r_draw.pas @@ -47,11 +47,7 @@ interface implementation uses - {$IFDEF USE_GLES1} - GLES11, - {$ELSE} - GL, GLEXT, - {$ENDIF} + {$I ../../../nogl/noGLuses.inc} SysUtils, Classes, Math, e_log, utils ; diff --git a/src/game/renders/opengl/r_loadscreen.pas b/src/game/renders/opengl/r_loadscreen.pas index 2786eb3..d95d3a4 100644 --- a/src/game/renders/opengl/r_loadscreen.pas +++ b/src/game/renders/opengl/r_loadscreen.pas @@ -31,11 +31,7 @@ interface implementation uses - {$IFDEF USE_GLES1} - GLES11, - {$ELSE} - GL, GLEXT, - {$ENDIF} + {$I ../../../nogl/noGLuses.inc} {$IFDEF ENABLE_SYSTEM} g_system, {$ENDIF} @@ -144,7 +140,7 @@ implementation hh := gScreenHeight - yy - 96; 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); r_Common_DrawBackground(GameWad + ':TEXTURES/INTER'); r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, 105); if menufont <> nil then diff --git a/src/game/renders/opengl/r_map.pas b/src/game/renders/opengl/r_map.pas index d2fa1f3..49ea34c 100644 --- a/src/game/renders/opengl/r_map.pas +++ b/src/game/renders/opengl/r_map.pas @@ -45,12 +45,8 @@ interface implementation uses + {$I ../../../nogl/noGLuses.inc} Math, SysUtils, - {$IFDEF USE_GLES1} - GLES11, - {$ELSE} - GL, GLEXT, - {$ENDIF} e_log, binheap, MAPDEF, utils, g_options, g_animations, g_basic, g_phys, diff --git a/src/game/renders/opengl/r_render.pas b/src/game/renders/opengl/r_render.pas index e6aa258..b896b06 100644 --- a/src/game/renders/opengl/r_render.pas +++ b/src/game/renders/opengl/r_render.pas @@ -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,7 +201,11 @@ 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} @@ -217,6 +217,9 @@ implementation raise Exception.Create('Failed to set videomode on startup.'); sys_EnableVSync(gVSync); {$ENDIF} + {$IFDEF NOGL_INIT} + nogl_Init; + {$ENDIF} r_LoadScreen_Initialize; r_Textures_Initialize; r_Console_Initialize; @@ -229,6 +232,9 @@ implementation r_Console_Finalize; r_Textures_Finalize; r_LoadScreen_Finalize; + {$IFDEF NOGL_INIT} + nogl_Quit; + {$ENDIF} end; procedure r_Render_Update; @@ -1065,7 +1071,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; @@ -1267,7 +1273,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; diff --git a/src/game/renders/opengl/r_textures.pas b/src/game/renders/opengl/r_textures.pas index 1025aba..b98c0d3 100644 --- a/src/game/renders/opengl/r_textures.pas +++ b/src/game/renders/opengl/r_textures.pas @@ -18,11 +18,7 @@ unit r_textures; interface uses - {$IFDEF USE_GLES1} - GLES11, - {$ELSE} - GL, GLEXT, - {$ENDIF} + {$I ../../../nogl/noGLuses.inc} g_base, g_animations, // TRectHW, TAnimInfo utils, r_atlas, r_fonts diff --git a/src/nogl/noGL.pas b/src/nogl/noGL.pas index 243d7c9..90735c3 100644 --- a/src/nogl/noGL.pas +++ b/src/nogl/noGL.pas @@ -57,6 +57,7 @@ interface GL_ZERO = $0; GL_POINTS = $0000; GL_LINES = $0001; + GL_LINE_LOOP = $0002; GL_DST_COLOR = $0306; GL_SRC_COLOR = $0300; GL_ONE_MINUS_DST_COLOR = $0307; @@ -125,6 +126,7 @@ interface GL_VERSION = $1F02; GL_EXTENSIONS = $1F03; GL_SHADING_LANGUAGE_VERSION = $8B8C; + GL_MAX_TEXTURE_SIZE = $0D33; // const // GL_CULL_FACE = $0B44; @@ -172,6 +174,7 @@ interface procedure glReadPixels(x, y: GLint; width, height: GLsizei; format, atype: GLenum; pixels: Pointer); + procedure glOrtho (left, right, bottom, top, near, far: GLfloat); procedure glLoadIdentity; procedure glScissor(x, y: GLint; width, height: GLsizei); procedure glViewport(x, y: GLint; width, height: GLsizei); diff --git a/src/nogl/noGLES1.inc b/src/nogl/noGLES1.inc index 05cce69..2bfec53 100644 --- a/src/nogl/noGLES1.inc +++ b/src/nogl/noGLES1.inc @@ -57,6 +57,7 @@ implementation es_glFlush: procedure; cdecl; es_glFinish: procedure; cdecl; + es_glOrthof: procedure (left, right, bottom, top, near, far: GLfloat); cdecl; es_glLoadIdentity: procedure; cdecl; es_glMatrixMode: procedure (mode: GLenum); cdecl; es_glLoadMatrixf: procedure (m: PGLfloat); cdecl; @@ -173,7 +174,7 @@ implementation procedure glBegin(mode: GLenum); begin assert(cmds.mode = GL_INVALID_ENUM); - assert((mode = GL_POINTS) or (mode = GL_LINES) or (mode = GL_QUADS)); + assert((mode = GL_POINTS) or (mode = GL_LINES) or (mode = GL_QUADS) or (mode = GL_LINE_LOOP)); cmds.mode := mode; SetLength(cmds.v, 0); SetLength(cmds.c, 0); @@ -296,6 +297,10 @@ implementation + procedure glOrtho (left, right, bottom, top, near, far: GLfloat); + begin + es_glOrthof(left, right, bottom, top, near, far); + end; procedure glLoadIdentity; begin @@ -509,6 +514,7 @@ implementation es_glFlush := SDL_GL_GetProcAddress('glFlush'); es_glFinish := SDL_GL_GetProcAddress('glFinish'); + es_glOrthof := SDL_GL_GetProcAddress('glOrthof'); es_glLoadIdentity := SDL_GL_GetProcAddress('glLoadIdentity'); es_glMatrixMode := SDL_GL_GetProcAddress('glMatrixMode'); es_glLoadMatrixf := SDL_GL_GetProcAddress('glLoadMatrixf'); @@ -577,6 +583,7 @@ implementation es_glFlush := nil; es_glFinish := nil; + es_glOrthof := nil; es_glLoadIdentity := nil; es_glMatrixMode := nil; es_glLoadMatrixf := nil; diff --git a/src/nogl/noGLSTUB.inc b/src/nogl/noGLSTUB.inc index 5fa0e47..1056fa3 100644 --- a/src/nogl/noGLSTUB.inc +++ b/src/nogl/noGLSTUB.inc @@ -99,6 +99,10 @@ implementation begin end; + procedure glOrtho (left, right, bottom, top, near, far: GLfloat); + begin + end; + procedure glLoadIdentity; begin end;