From 30503d5844b5e644ee99222b49192469e173fc05 Mon Sep 17 00:00:00 2001 From: Porteries Tristan Date: Sat, 2 Apr 2016 12:05:57 +0200 Subject: [PATCH] UPBGE: Fix unbinded primitives after unset material. This causes that the VBO or VA unset none vertex attribut because just before in the material deactivation the vertex attribut number was set to zero. This was only for the last transparency material. The result was a glitch in the UI or worse, a crash. To fix it we just invert the call order : first unbind VBO/VA later unset material. --- source/gameengine/Rasterizer/RAS_BucketManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp index 2c33dd81e323..94ac878029a4 100644 --- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp +++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp @@ -174,10 +174,12 @@ void RAS_BucketManager::RenderSortedBuckets(const MT_Transform& cameratrans, RAS bucket->RenderMeshSlot(cameratrans, rasty, sit->m_ms); } + // Always unbind VBO or VA before unset the material to use the correct material attributs. + rasty->UnbindPrimitives(lastDisplayArrayBucket); + if (matactivated && lastMaterialBucket) { lastMaterialBucket->DesactivateMaterial(rasty); } - rasty->UnbindPrimitives(lastDisplayArrayBucket); } void RAS_BucketManager::RenderBasicBuckets(const MT_Transform& cameratrans, RAS_IRasterizer *rasty, RAS_BucketManager::BucketType bucketType)