Commit 4e3be96
committed
(GL1) Fix on-screen overlay rendering
gl1_render_overlay was missing essentially all of the GL state setup
needed to actually draw anything. Three issues, all fixed by mirroring
the patterns already used in gfx_display_gl1_draw and
gl1_raster_font_draw_vertices:
1. Client arrays were never enabled. The function assigned values to
gl->coords.vertex/tex_coord/color, but those struct fields don't
drive GL state — they need to be wired up via glEnableClientState
plus glVertexPointer/glTexCoordPointer/glColorPointer pointing at
the overlay coord buffers. Without them glDrawArrays runs with
whatever client array state happened to be active from the
previous draw, which generally meant nothing rendered.
2. The PROJECTION matrix was pushed but never popped, leaking a
matrix-stack entry every frame. The MODELVIEW matrix was also
never reset to identity.
3. The viewport size source was wrong. Callers pass video_width/
video_height from video_info, which in gl1 is the emulated core
frame size (e.g. 256x224 for SNES, 320x240 default for the menu
surface) — not the window size. Fullscreen overlays need the
actual window viewport, so use gl->screen_width/height (set from
the context driver's get_video_size) instead, with fallback to the
passed-in width/height for safety. Same semantic mismatch fixed
recently for the statistics font in commit 1224324.
Additionally, the projection itself was loaded as identity, which
gives clip space [-1,1] x [-1,1]. Overlay vertices are emitted in
[0,1] UI space by gl1_overlay_vertex_geom, so an identity projection
mapped them into the upper-right quadrant of the viewport instead of
filling it. Load gl->mvp_no_rot — the pre-built ortho(0,1,0,1,-1,1)
matrix — for the projection so [0,1] vertices map to the full
viewport, matching what gl3 does with the same matrix in its shader
uniform.
With these changes overlays render at the correct full-screen size
and position, matching the gl/glcore behaviour.1 parent 2f4ce7b commit 4e3be96
1 file changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
999 | 999 | | |
1000 | 1000 | | |
1001 | 1001 | | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
1002 | 1013 | | |
1003 | 1014 | | |
1004 | 1015 | | |
| |||
1009 | 1020 | | |
1010 | 1021 | | |
1011 | 1022 | | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
1012 | 1031 | | |
1013 | 1032 | | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
1014 | 1037 | | |
1015 | 1038 | | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
1016 | 1048 | | |
1017 | 1049 | | |
1018 | 1050 | | |
1019 | 1051 | | |
1020 | 1052 | | |
1021 | 1053 | | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
1022 | 1063 | | |
1023 | 1064 | | |
1024 | 1065 | | |
| |||
0 commit comments