src/gl/basicshaderprogram.cpp

changeset 118
8e1c9f18ae15
parent 70
f21b800b02a4
child 215
34c6e7bc4ee1
--- a/src/gl/basicshaderprogram.cpp	Tue Jul 27 13:23:34 2021 +0300
+++ b/src/gl/basicshaderprogram.cpp	Tue Jul 27 16:29:00 2021 +0300
@@ -37,8 +37,12 @@
 		this->program->bind();
 		this->buffer.create();
 		this->buffer.bind();
-		this->buffer.setUsagePattern(QOpenGLBuffer::StaticDraw);
-		this->buffer.allocate(this->vertexData(), this->vertexCount() * this->vertexSize());
+		const QOpenGLBuffer::UsagePattern pattern = this->usagePattern();
+		this->buffer.setUsagePattern(pattern);
+		if (pattern == QOpenGLBuffer::StaticDraw)
+		{
+			this->buffer.allocate(this->vertexData(), this->vertexCount() * this->vertexSize());
+		}
 		this->vertexArrayObject.create();
 		this->vertexArrayObject.bind();
 		this->setupVertexArrays();

mercurial