Hi guys I need some help with this as I spent quite a while and I cannot solve it on my own. I have added a new method inside the Geometry class and I am trying to create new VertexBuffer but when I call SetSize it crashes. Inside the method I have:
SharedPtr<VertexBuffer> cVertBuffer(new VertexBuffer(context_));
cVertBuffer->SetShadowed(true);
cVertBuffer->SetSize(GetVertexCount() * instances.Size(), vertexBuffers_[0]->GetElementMask(), false);
Everything passed to SetSize seems to be valid in the debugger. The last method of the crash is at glGenBuffers(1, &object_) inside the OGLVertexBuffer, VertexBuffer::Create() method. If I create the VertexBuffer headless it doesn’t crash. The same applies for the IndexBuffer.
#3 0x00000001000b4ccb in Urho3D::Geometry::CreateCombinedGeometry() const at Geometry.cpp:465
#2 0x0000000100112e6b in Urho3D::VertexBuffer::SetSize(unsigned int, unsigned int, bool) at OGLVertexBuffer.cpp:197
#1 0x0000000100112828 in Urho3D::VertexBuffer::Create() at OGLVertexBuffer.cpp:406