From eb80c997b8255e86b86096bc4ac9218929eaeddd Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Fri, 22 Jan 2021 19:44:22 +0000 Subject: [PATCH] Avoid OSG setting array binding from multiple threads --- components/terrain/buffercache.cpp | 2 +- components/terrain/chunkmanager.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/components/terrain/buffercache.cpp b/components/terrain/buffercache.cpp index 5871b96bc0..f9eb7ae635 100644 --- a/components/terrain/buffercache.cpp +++ b/components/terrain/buffercache.cpp @@ -186,7 +186,7 @@ namespace Terrain int vertexCount = numVerts * numVerts; - osg::ref_ptr uvs (new osg::Vec2Array); + osg::ref_ptr uvs (new osg::Vec2Array(osg::Array::BIND_PER_VERTEX)); uvs->reserve(vertexCount); for (unsigned int col = 0; col < numVerts; ++col) diff --git a/components/terrain/chunkmanager.cpp b/components/terrain/chunkmanager.cpp index 041414a87a..50724628dd 100644 --- a/components/terrain/chunkmanager.cpp +++ b/components/terrain/chunkmanager.cpp @@ -197,8 +197,7 @@ osg::ref_ptr ChunkManager::createChunk(float chunkSize, const osg::Ve bool useCompositeMap = chunkSize >= mCompositeMapLevel; unsigned int numUvSets = useCompositeMap ? 1 : 2; - for (unsigned int i=0; isetTexCoordArray(i, mBufferCache.getUVBuffer(numVerts)); + geometry->setTexCoordArrayList(osg::Geometry::ArrayList(numUvSets, mBufferCache.getUVBuffer(numVerts))); geometry->createClusterCullingCallback();