changeset 2514:50cff4c9286e

Fix crash in render_fill_rect in GL mode with no static images
author Michael Pavone <pavone@retrodev.com>
date Sat, 31 Aug 2024 22:41:17 -0700
parents 61645edbe30f
children 0775f5e0c468
files render_sdl.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/render_sdl.c	Fri Aug 30 21:16:46 2024 -0700
+++ b/render_sdl.c	Sat Aug 31 22:41:17 2024 -0700
@@ -1827,6 +1827,11 @@
 	}
 #ifndef DISABLE_OPENGL
 	else {
+		if (!extra->image_vertices) {
+			extra->image_vertices = malloc(sizeof(vertex_data_default));
+			SDL_GL_MakeCurrent(extra->win, extra->gl_context);
+			glGenBuffers(1, &extra->image_buffer);
+		}
 		extra_update_verts(extra, x, y, width, height);
 		extra->color[0] = b;
 		extra->color[1] = g;