From 27268a6489bc1ab3f1977e1d7a3b14a2d700baf2 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 19 Jan 2015 15:43:20 -0800 Subject: [PATCH] fix updateVertices to correctly copy all data --- libraries/render-utils/src/GeometryCache.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libraries/render-utils/src/GeometryCache.cpp b/libraries/render-utils/src/GeometryCache.cpp index 67af878c52..e8a7a1d6cf 100644 --- a/libraries/render-utils/src/GeometryCache.cpp +++ b/libraries/render-utils/src/GeometryCache.cpp @@ -607,7 +607,7 @@ void GeometryCache::renderGrid(int x, int y, int width, int height, int rows, in } void GeometryCache::updateVertices(int id, const QVector& points, const glm::vec4& color) { - qDebug() << "GeometryCache::updateVertices(vec2.... id=" << id <<")..."; + //qDebug() << "GeometryCache::updateVertices(vec2.... id=" << id <<")..."; BatchItemDetails& details = _registeredVertices[id]; if (details.isCreated) { @@ -652,18 +652,14 @@ void GeometryCache::updateVertices(int id, const QVector& points, con int* colorData = new int[details.vertices]; int* colorDataAt = colorData; - //qDebug() << " details.vertices:" << details.vertices; - //qDebug() << " points.size:" << points.size(); - foreach (const glm::vec2& point, points) { - //qDebug() << " point:" << point; *(vertex++) = point.x; *(vertex++) = point.y; *(colorDataAt++) = compactColor; } - details.verticesBuffer->append(FLOATS_PER_VERTEX * details.vertices, (gpu::Buffer::Byte*) vertexData); + details.verticesBuffer->append(sizeof(GLfloat) * FLOATS_PER_VERTEX * details.vertices, (gpu::Buffer::Byte*) vertexData); details.colorBuffer->append(sizeof(int) * details.vertices, (gpu::Buffer::Byte*) colorData); delete[] vertexData; delete[] colorData; @@ -727,7 +723,7 @@ void GeometryCache::updateVertices(int id, const QVector& points, con *(colorDataAt++) = compactColor; } - details.verticesBuffer->append(FLOATS_PER_VERTEX * details.vertices, (gpu::Buffer::Byte*) vertexData); + details.verticesBuffer->append(sizeof(GLfloat) * FLOATS_PER_VERTEX * details.vertices, (gpu::Buffer::Byte*) vertexData); details.colorBuffer->append(sizeof(int) * details.vertices, (gpu::Buffer::Byte*) colorData); delete[] vertexData; delete[] colorData; @@ -738,7 +734,7 @@ void GeometryCache::updateVertices(int id, const QVector& points, con } void GeometryCache::renderVertices(gpu::Primitive primitiveType, int id) { - qDebug() << "GeometryCache::renderVertices(id=" << id <<")..."; + //qDebug() << "GeometryCache::renderVertices(id=" << id <<")..."; BatchItemDetails& details = _registeredVertices[id]; if (details.isCreated) {