Skip to content

Commit

Permalink
Fixed flipped texts and menu elements that were beyond the near clip …
Browse files Browse the repository at this point in the history
…plane.
  • Loading branch information
MaikelChan committed Aug 15, 2023
1 parent 20fd3a8 commit 6f35e00
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
4 changes: 3 additions & 1 deletion port/fast3d/gfx_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,9 @@ static void gfx_opengl_init(void) {
glBindVertexArray(opengl_vao);
#endif

// glEnable(GL_DEPTH_CLAMP); // GL4 only
if (GLAD_GL_ARB_depth_clamp) {
glEnable(GL_DEPTH_CLAMP);
}
glDepthFunc(GL_LEQUAL);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Expand Down
5 changes: 1 addition & 4 deletions port/fast3d/gfx_pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2133,10 +2133,7 @@ static void gfx_dp_texture_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int3
// dsdx and dtdy are S5.10
// lrx, lry, ulx, uly are U10.2
// lrs, lrt are S10.5
if (flip) {
dsdx = -dsdx;
dtdy = -dtdy;
}

int16_t width = !flip ? lrx - ulx : lry - uly;
int16_t height = !flip ? lry - uly : lrx - ulx;
float lrs = ((uls << 7) + dsdx * width) >> 7;
Expand Down
9 changes: 6 additions & 3 deletions port/fast3d/glad/glad.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
OpenGL loader generated by glad 0.1.34 on Sun Jul 30 09:46:53 2023.
OpenGL loader generated by glad 0.1.34 on Tue Aug 15 02:22:41 2023.
Language/Generator: C/C++
Specification: gl
APIs: gl=2.1
Profile: compatibility
Extensions:
GL_ARB_depth_clamp,
GL_ARB_framebuffer_object,
GL_EXT_framebuffer_object
Loader: True
Expand All @@ -15,9 +16,9 @@
Reproducible: False
Commandline:
--profile="compatibility" --api="gl=2.1" --generator="c" --spec="gl" --local-files --extensions="GL_ARB_framebuffer_object,GL_EXT_framebuffer_object"
--profile="compatibility" --api="gl=2.1" --generator="c" --spec="gl" --local-files --extensions="GL_ARB_depth_clamp,GL_ARB_framebuffer_object,GL_EXT_framebuffer_object"
Online:
https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D2.1&extensions=GL_ARB_framebuffer_object&extensions=GL_EXT_framebuffer_object
https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D2.1&extensions=GL_ARB_depth_clamp&extensions=GL_ARB_framebuffer_object&extensions=GL_EXT_framebuffer_object
*/

#include <stdio.h>
Expand Down Expand Up @@ -815,6 +816,7 @@ PFNGLWINDOWPOS3IPROC glad_glWindowPos3i = NULL;
PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL;
PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL;
PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL;
int GLAD_GL_ARB_depth_clamp = 0;
int GLAD_GL_ARB_framebuffer_object = 0;
int GLAD_GL_EXT_framebuffer_object = 0;
PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL;
Expand Down Expand Up @@ -1474,6 +1476,7 @@ static void load_GL_EXT_framebuffer_object(GLADloadproc load) {
}
static int find_extensionsGL(void) {
if (!get_exts()) return 0;
GLAD_GL_ARB_depth_clamp = has_ext("GL_ARB_depth_clamp");
GLAD_GL_ARB_framebuffer_object = has_ext("GL_ARB_framebuffer_object");
GLAD_GL_EXT_framebuffer_object = has_ext("GL_EXT_framebuffer_object");
free_exts();
Expand Down
12 changes: 9 additions & 3 deletions port/fast3d/glad/glad.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
OpenGL loader generated by glad 0.1.34 on Sun Jul 30 09:46:53 2023.
OpenGL loader generated by glad 0.1.34 on Tue Aug 15 02:22:41 2023.
Language/Generator: C/C++
Specification: gl
APIs: gl=2.1
Profile: compatibility
Extensions:
GL_ARB_depth_clamp,
GL_ARB_framebuffer_object,
GL_EXT_framebuffer_object
Loader: True
Expand All @@ -15,9 +16,9 @@
Reproducible: False
Commandline:
--profile="compatibility" --api="gl=2.1" --generator="c" --spec="gl" --local-files --extensions="GL_ARB_framebuffer_object,GL_EXT_framebuffer_object"
--profile="compatibility" --api="gl=2.1" --generator="c" --spec="gl" --local-files --extensions="GL_ARB_depth_clamp,GL_ARB_framebuffer_object,GL_EXT_framebuffer_object"
Online:
https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D2.1&extensions=GL_ARB_framebuffer_object&extensions=GL_EXT_framebuffer_object
https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D2.1&extensions=GL_ARB_depth_clamp&extensions=GL_ARB_framebuffer_object&extensions=GL_EXT_framebuffer_object
*/


Expand Down Expand Up @@ -2691,6 +2692,7 @@ typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei cou
GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv;
#define glUniformMatrix4x3fv glad_glUniformMatrix4x3fv
#endif
#define GL_DEPTH_CLAMP 0x864F
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
Expand Down Expand Up @@ -2815,6 +2817,10 @@ GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv;
#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
#ifndef GL_ARB_depth_clamp
#define GL_ARB_depth_clamp 1
GLAPI int GLAD_GL_ARB_depth_clamp;
#endif
#ifndef GL_ARB_framebuffer_object
#define GL_ARB_framebuffer_object 1
GLAPI int GLAD_GL_ARB_framebuffer_object;
Expand Down

0 comments on commit 6f35e00

Please sign in to comment.