From 1babad1640d958754e98930e96567b178f4433a8 Mon Sep 17 00:00:00 2001 From: Khangaroo Date: Mon, 11 Nov 2024 20:08:21 -0500 Subject: [PATCH] Don't use default VAO (#487) * Don't use default VAO * Don't use a VAO on OpenGL 2.1 --- src/pc/gfx/gfx_opengl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pc/gfx/gfx_opengl.c b/src/pc/gfx/gfx_opengl.c index 0df60f58..3da2dc5b 100644 --- a/src/pc/gfx/gfx_opengl.c +++ b/src/pc/gfx/gfx_opengl.c @@ -67,6 +67,7 @@ static struct ShaderProgram shader_program_pool[CC_MAX_SHADERS]; static uint8_t shader_program_pool_size = 0; static uint8_t shader_program_pool_index = 0; static GLuint opengl_vbo; +static GLuint opengl_vao; static int tex_cache_size = 0; static int num_textures = 0; @@ -707,6 +708,11 @@ static void gfx_opengl_init(void) { glGenBuffers(1, &opengl_vbo); glBindBuffer(GL_ARRAY_BUFFER, opengl_vbo); + + if (vmajor >= 3 && !is_es) { + glGenVertexArrays(1, &opengl_vao); + glBindVertexArray(opengl_vao); + } glDepthFunc(GL_LEQUAL); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);