Skip to content

Commit

Permalink
UPBGE: Fix unbinded primitives after unset material.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
panzergame committed Apr 2, 2016
1 parent 2fcd145 commit 30503d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/gameengine/Rasterizer/RAS_BucketManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 30503d5

Please sign in to comment.