line being sent as array

This commit is contained in:
Eric Levin 2015-05-28 15:48:31 -07:00
parent 4d4a90e9ce
commit 533148f26d
3 changed files with 5 additions and 4 deletions

View file

@ -43,7 +43,7 @@ void RenderableLineEntityItem::render(RenderArgs* args) {
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
geometryCache->renderVertices(gpu::LINES, _lineVerticesID);
geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID);
glPopMatrix();
RenderableDebugableEntityItem::render(this, args);
};

View file

@ -66,9 +66,11 @@ class LineEntityItem : public EntityItem {
_points = points;
// _points = QVector<glm::vec3>(0);
// glm::vec3 p1 = { 0,0,0};
// glm::vec3 p2 = {1, 1,0};
// glm::vec3 p2 = {1, -1,2};
// glm::vec3 p3 = {4, 0, 0};
// _points <<p1;
// _points<< p2;
// _points<<p3;
}
const QVector<glm::vec3>& getLinePoints() const{

View file

@ -660,7 +660,6 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec2>& points, con
void GeometryCache::updateVertices(int id, const QVector<glm::vec3>& points, const glm::vec4& color) {
BatchItemDetails& details = _registeredVertices[id];
if (details.isCreated) {
details.clear();
#ifdef WANT_DEBUG
@ -799,7 +798,7 @@ void GeometryCache::renderVertices(gpu::Primitive primitiveType, int id) {
batch.setInputFormat(details.streamFormat);
batch.setInputStream(0, *details.stream);
batch.draw(primitiveType, details.vertices, 0);
gpu::GLBackend::renderBatch(batch);
glDisableClientState(GL_VERTEX_ARRAY);