File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
bindings/Modules/src/SofaPython3/SofaGL Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,17 @@ using DrawToolGL = sofa::gl::DrawToolGL;
3939
4040namespace py { using namespace pybind11 ; }
4141
42+ sofa::core::visual::VisualParams* vparam = nullptr ;
43+ sofa::gl::DrawToolGL *drawtool = new sofa::gl::DrawToolGL();
44+
4245void moduleAddDrawToolGL (pybind11::module & m) {
4346 m.def (" draw" , [](Node* node){
44- auto * vparam = sofa::core::visual::VisualParams::defaultInstance ();
45- vparam->drawTool () = new sofa::gl::DrawToolGL ();
46- vparam->setSupported (sofa::core::visual::API_OpenGL);
47+ if (!vparam)
48+ {
49+ vparam = sofa::core::visual::VisualParams::defaultInstance ();
50+ vparam->drawTool () = drawtool;
51+ vparam->setSupported (sofa::core::visual::API_OpenGL);
52+ }
4753 sofa::simulation::getSimulation ()->draw (vparam, node);
4854 }, doc::SofaGL::draw);
4955
You can’t perform that action at this time.
0 commit comments