From eaead2a0d51dca2dd30c418b1c863e1a275f10b3 Mon Sep 17 00:00:00 2001 From: Julian Stamm Date: Sat, 20 Jun 2026 14:06:03 +0200 Subject: [PATCH] Fix mesh loading on Apple --- src/framework/mesh.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/framework/mesh.cpp b/src/framework/mesh.cpp index 07baba2..bcbb35b 100644 --- a/src/framework/mesh.cpp +++ b/src/framework/mesh.cpp @@ -17,6 +17,9 @@ using namespace glm; void Mesh::load(const std::vector& vertices, const std::vector& indices) { // Load data into buffers numIndices = indices.size(); +#ifndef MODERN_GL + vao.bind(); +#endif vbo.load(vertices, GL_STATIC_DRAW); ebo.load(indices, GL_STATIC_DRAW); @@ -30,7 +33,6 @@ void Mesh::load(const std::vector& vertices, const std::vector& vertices, const std::vector& vertices, const std::vector& attributeSizes, const std::vector& indices) { // Load data into buffers numIndices = indices.size(); +#ifndef MODERN_GL + vao.bind(); // NOTE: Bind VAO first as Core Profile requires a VAO to be bound when loading buffers +#endif vbo.load(vertices, GL_STATIC_DRAW); ebo.load(indices, GL_STATIC_DRAW); @@ -62,7 +67,6 @@ void Mesh::load(const std::vector& vertices, const std::vector& vertices, const std::vector& vertices, const std::vector& indices) { // Load data into buffers numIndices = indices.size(); +#ifndef MODERN_GL + vao.bind(); // NOTE: Bind VAO first as Core Profile requires a VAO to be bound when loading buffers +#endif vbo.load(vertices, GL_STATIC_DRAW); ebo.load(indices, GL_STATIC_DRAW); @@ -94,7 +101,6 @@ void Mesh::load(const std::vector& vertices, const std::vector& vertices, const std::vector& vertices, const std::vector& indices) { // Load data into buffers numIndices = indices.size(); +#ifndef MODERN_GL + vao.bind(); // NOTE: Bind VAO first as Core Profile requires a VAO to be bound when loading buffers +#endif vbo.load(vertices, GL_STATIC_DRAW); ebo.load(indices, GL_STATIC_DRAW); @@ -129,7 +138,6 @@ void Mesh::load(const std::vector& vertices, const std::vector& vertices, const std::vector& vertices, const std::vector& indices) { // Load data into buffers numIndices = indices.size(); +#ifndef MODERN_GL + vao.bind(); // NOTE: Bind VAO first as Core Profile requires a VAO to be bound when loading buffers +#endif vbo.load(vertices, GL_STATIC_DRAW); ebo.load(indices, GL_STATIC_DRAW); @@ -170,7 +181,6 @@ void Mesh::load(const std::vector& vertices, const std::vector