From e8bb985edc34d99c678b477344d95cb62e8a52b8 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 20 Mar 2020 11:25:40 +0100 Subject: [PATCH] Fix VColors initialization, as it can be used with indexed data or not. --- Polyhedron/demo/Polyhedron/Triangle_container.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Triangle_container.cpp b/Polyhedron/demo/Polyhedron/Triangle_container.cpp index 0ac9a14e2cb..54c09875b64 100644 --- a/Polyhedron/demo/Polyhedron/Triangle_container.cpp +++ b/Polyhedron/demo/Polyhedron/Triangle_container.cpp @@ -41,9 +41,14 @@ void Triangle_container::initGL( Viewer_interface* viewer) } else { - if(!getVao(viewer)) setVao(viewer, new Vao(viewer->getShaderProgram(getProgram()))); + //in both because of the soup item + if(!getVbo(VColors)) + setVbo(VColors, + new Vbo("colors", + Vbo::COLORS)); + getVao(viewer)->addVbo(getVbo(VColors)); if(isDataIndexed()) { if(!getVbo(Smooth_vertices)) @@ -65,11 +70,6 @@ void Triangle_container::initGL( Viewer_interface* viewer) Vbo::NORMALS)); getVao(viewer)->addVbo(getVbo(Smooth_normals)); } - if(!getVbo(VColors)) - setVbo(VColors, - new Vbo("colors", - Vbo::COLORS)); - getVao(viewer)->addVbo(getVbo(VColors)); if(viewer->getShaderProgram(getProgram())->property("hasDistanceValues").toBool()) { if(!getVbo(Distances))