From: DeaDDooMER Date: Mon, 13 Feb 2023 19:01:13 +0000 (+0300) Subject: nogl: fix glOrtho X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=923ff56209bf28a54bd5bd63a786e67af8af121b;p=d2df-sdl.git nogl: fix glOrtho --- diff --git a/src/nogl/noGL.pas b/src/nogl/noGL.pas index 90735c3..fe9601c 100644 --- a/src/nogl/noGL.pas +++ b/src/nogl/noGL.pas @@ -174,7 +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 glOrtho (left, right, bottom, top, near, far: GLdouble); 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 2bfec53..6bc0acb 100644 --- a/src/nogl/noGLES1.inc +++ b/src/nogl/noGLES1.inc @@ -57,7 +57,8 @@ implementation es_glFlush: procedure; cdecl; es_glFinish: procedure; cdecl; - es_glOrthof: procedure (left, right, bottom, top, near, far: GLfloat); cdecl; + es_glMultMatrixf: procedure (m: PGLfloat); 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; @@ -297,9 +298,27 @@ implementation - procedure glOrtho (left, right, bottom, top, near, far: GLfloat); + procedure glOrtho (left, right, bottom, top, near, far: GLdouble); + var m: array [0..15] of GLfloat; begin - es_glOrthof(left, right, bottom, top, near, far); + {es_glOrthof(left, right, bottom, top, near, far);} + m[0] := 2 / (right - left); + m[1] := 0; + m[2] := 0; + m[3] := 0; + m[4] := 0; + m[5] := 2 / (top - bottom); + m[6] := 0; + m[7] := 0; + m[8] := 0; + m[9] := 0; + m[10] := -2 / (far - near); + m[11] := 0; + m[12] := -((right + left) / (right - left)); + m[13] := -((top + bottom) / (top - bottom)); + m[14] := -((far + near) / (far - near)); + m[15] := 1; + es_glMultMatrixf(@m[0]); end; procedure glLoadIdentity; @@ -514,7 +533,8 @@ implementation es_glFlush := SDL_GL_GetProcAddress('glFlush'); es_glFinish := SDL_GL_GetProcAddress('glFinish'); - es_glOrthof := SDL_GL_GetProcAddress('glOrthof'); + es_glMultMatrixf := SDL_GL_GetProcAddress('glMultMatrixf'); + //es_glOrthof := SDL_GL_GetProcAddress('glOrthof'); es_glLoadIdentity := SDL_GL_GetProcAddress('glLoadIdentity'); es_glMatrixMode := SDL_GL_GetProcAddress('glMatrixMode'); es_glLoadMatrixf := SDL_GL_GetProcAddress('glLoadMatrixf'); @@ -583,7 +603,8 @@ implementation es_glFlush := nil; es_glFinish := nil; - es_glOrthof := nil; + es_glMultMatrixf := 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 1056fa3..1dbd524 100644 --- a/src/nogl/noGLSTUB.inc +++ b/src/nogl/noGLSTUB.inc @@ -99,7 +99,7 @@ implementation begin end; - procedure glOrtho (left, right, bottom, top, near, far: GLfloat); + procedure glOrtho (left, right, bottom, top, near, far: GLdouble); begin end;