From: Mikko Rasa Date: Wed, 23 Oct 2019 11:25:46 +0000 (+0300) Subject: Always use buffers in Mesh X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=42923751e8e2ef1472058f32194ad95d47d073ea;p=libs%2Fgl.git Always use buffers in Mesh --- diff --git a/source/mesh.cpp b/source/mesh.cpp index a8129d9b..746b07d8 100644 --- a/source/mesh.cpp +++ b/source/mesh.cpp @@ -30,7 +30,6 @@ void Mesh::init(ResourceManager *rm) vbuf = 0; ibuf = 0; vtx_setup = 0; - defer_buffers = ARB_vertex_buffer_object; disallow_rendering = false; winding = 0; @@ -52,25 +51,8 @@ void Mesh::clear() batches.clear(); } -void Mesh::use_buffers(bool b) -{ - defer_buffers = false; - if(b) - create_buffers(); - else - { - vertices.use_buffer(0); - delete vbuf; - vbuf = 0; - delete ibuf; - ibuf = 0; - } -} - void Mesh::create_buffers() { - defer_buffers = false; - if(!vbuf) vbuf = new Buffer(ARRAY_BUFFER); vertices.use_buffer(vbuf); @@ -98,8 +80,7 @@ float *Mesh::modify_vertex(unsigned i) void Mesh::add_batch(const Batch &b) { - if(defer_buffers) - create_buffers(); + create_buffers(); if(!batches.empty() && batches.back().can_append(b.get_type())) batches.back().append(b); @@ -237,7 +218,6 @@ void Mesh::unload() batches.clear(); delete vbuf; delete ibuf; - defer_buffers = (vbuf || ibuf); vbuf = 0; ibuf = 0; } @@ -290,8 +270,7 @@ Mesh::AsyncLoader::AsyncLoader(Mesh &m, IO::Seekable &i): phase(0) { mesh.disallow_rendering = true; - if(mesh.defer_buffers) - mesh.create_buffers(); + mesh.create_buffers(); } Mesh::AsyncLoader::~AsyncLoader() diff --git a/source/mesh.h b/source/mesh.h index 1ee58a62..c09fad6d 100644 --- a/source/mesh.h +++ b/source/mesh.h @@ -71,7 +71,6 @@ public: ~Mesh(); void clear(); - void use_buffers(bool); private: void create_buffers();