From 58593822a3494e43f4768c4f7a4777e5ab32bb31 Mon Sep 17 00:00:00 2001 From: Linloir <3145078758@qq.com> Date: Tue, 13 Dec 2022 10:10:10 +0800 Subject: [PATCH] Add extra checks to ebo, vao and vbo --- FinalProject/ebo.h | 3 +++ FinalProject/vao.h | 3 +++ FinalProject/vbo.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/FinalProject/ebo.h b/FinalProject/ebo.h index 41d022b..7a8e5f8 100644 --- a/FinalProject/ebo.h +++ b/FinalProject/ebo.h @@ -51,5 +51,8 @@ inline void ElementBufferObject::dispose() { inline void ElementBufferObject::ensureInitialized() { if (_id == 0) { OPENGL_EXTRA_FUNCTIONS->glGenBuffers(1, &_id); + if (_id == 0) { + Logger::error("Failed to create ElementBufferObject"); + } } } \ No newline at end of file diff --git a/FinalProject/vao.h b/FinalProject/vao.h index adf93f1..573d0c1 100644 --- a/FinalProject/vao.h +++ b/FinalProject/vao.h @@ -60,6 +60,9 @@ inline void VertexArrayObject::dispose() { inline void VertexArrayObject::ensureInitialized() { if (_id == 0) { OPENGL_EXTRA_FUNCTIONS->glGenVertexArrays(1, &_id); + if (_id == 0) { + Logger::error("Failed to create VertexArrayObject"); + } } } diff --git a/FinalProject/vbo.h b/FinalProject/vbo.h index 411b8c5..8a0f8c0 100644 --- a/FinalProject/vbo.h +++ b/FinalProject/vbo.h @@ -51,5 +51,8 @@ inline void VertexBufferObject::dispose() { inline void VertexBufferObject::ensureInitialized() { if (_id == 0) { OPENGL_EXTRA_FUNCTIONS->glGenBuffers(1, &_id); + if (_id == 0) { + Logger::error("Failed to create VertexBufferObject"); + } } } \ No newline at end of file