From fd18332856ddd03f79a54dd034d53cb0a384335d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 30 Oct 2019 00:02:51 +0200 Subject: [PATCH] Require vertex arrays to have a buffer when adding them to VertexSetup --- source/vertexsetup.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/vertexsetup.cpp b/source/vertexsetup.cpp index 2a3b2f1a..7cfc1b6d 100644 --- a/source/vertexsetup.cpp +++ b/source/vertexsetup.cpp @@ -11,6 +11,8 @@ #include "vertexarray.h" #include "vertexsetup.h" +using namespace std; + namespace Msp { namespace GL { @@ -36,6 +38,9 @@ VertexSetup::~VertexSetup() void VertexSetup::set_vertex_array(const VertexArray &a) { + if(!a.get_buffer()) + throw invalid_argument("VertexSetup::set_vertex_array"); + vertex_array = &a; update(VERTEX_ARRAY); } @@ -43,7 +48,12 @@ void VertexSetup::set_vertex_array(const VertexArray &a) void VertexSetup::set_instance_array(const VertexArray *a) { if(a) + { + if(!a->get_buffer()) + throw invalid_argument("VertexSetup::set_instance_array"); + static Require req(ARB_instanced_arrays); + } inst_array = a; update(INSTANCE_ARRAY); -- 2.45.2