diff --git a/libraries/render/src/render/DrawStatus.cpp b/libraries/render/src/render/DrawStatus.cpp index ef91efda71..f61a4e56c3 100644 --- a/libraries/render/src/render/DrawStatus.cpp +++ b/libraries/render/src/render/DrawStatus.cpp @@ -2,8 +2,8 @@ // DrawStatus.cpp // render/src/render // -// Created by Niraj Venkat on 5/21/15. -// Copyright 20154 High Fidelity, Inc. +// Created by Niraj Venkat on 6/29/15. +// Copyright 2015 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -34,7 +34,7 @@ using namespace render; const gpu::PipelinePointer& DrawStatus::getDrawItemBoundsPipeline() { - if (!_drawItemBoundsPipeline) { + if (!_drawItemBoundsPipeline) { auto vs = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(drawItemBounds_vert))); auto ps = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(drawItemBounds_frag))); gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps)); @@ -160,13 +160,12 @@ void DrawStatus::run(const SceneContextPointer& sceneContext, const RenderContex AABox* itemAABox = reinterpret_cast (_itemBounds->editData()); glm::vec4* itemStatus = reinterpret_cast (_itemStatus->editData()); - + for (int i = 0; i < nbItems; i++) { - batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const GLfloat*) (itemAABox + i)); batch._glUniform3fv(_drawItemBoundDimLoc, 1, ((const GLfloat*) (itemAABox + i)) + 3); - batch.draw(gpu::LINE_STRIP, 13, 0); + batch.draw(gpu::LINES, 24, 0); } batch.setPipeline(getDrawItemStatusPipeline()); diff --git a/libraries/render/src/render/drawItemBounds.slv b/libraries/render/src/render/drawItemBounds.slv index a74d105cf1..4cb9a82371 100644 --- a/libraries/render/src/render/drawItemBounds.slv +++ b/libraries/render/src/render/drawItemBounds.slv @@ -20,22 +20,31 @@ uniform vec3 inBoundPos; uniform vec3 inBoundDim; void main(void) { - const vec4 UNIT_BOX[13] = vec4[13]( + const vec4 UNIT_BOX[8] = vec4[8]( vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), + vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), - vec4(0.0, 1.0, 0.0, 1.0), - vec4(0.0, 0.0, 0.0, 1.0), - vec4(1.0, 0.0, 0.0, 1.0), + vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), - vec4(0.0, 0.0, 1.0, 1.0), - vec4(0.0, 0.0, 0.0, 1.0), - vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), - vec4(0.0, 0.0, 1.0, 1.0), - vec4(0.0, 0.0, 0.0, 1.0) + vec4(1.0, 1.0, 1.0, 1.0) ); - vec4 pos = UNIT_BOX[gl_VertexID]; + const int UNIT_BOX_LINE_INDICES[24] = int[24]( + 0, 1, + 1, 3, + 3, 2, + 2, 0, + 4, 5, + 5, 7, + 7, 6, + 6, 4, + 2, 6, + 3, 7, + 0, 4, + 1, 5 + ); + vec4 pos = UNIT_BOX[UNIT_BOX_LINE_INDICES[gl_VertexID]]; pos.xyz = inBoundPos + inBoundDim * pos.xyz;