From 63e68c9ed57253994b7424dd03059064cc656e98 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 9 Feb 2012 15:52:45 -0800 Subject: Fixed switching between webGL and canvas 2d modes. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index b9c033aa..44723a1e 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -346,8 +346,10 @@ exports.ShapesController = Montage.create(CanvasController, { { world = new GLWorld(el, true); el.elementModel.shapeModel.GLWorld = world; - el.elementModel.shapeModel.GLGeomObj.setWorld(world); el.elementModel.shapeModel.useWebGl = true; + world.import(worldData); + el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); + sm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); fm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); if(sm && fm) @@ -356,9 +358,7 @@ exports.ShapesController = Montage.create(CanvasController, { el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm); el.elementModel.shapeModel.strokeMaterial = sm; el.elementModel.shapeModel.fillMaterial = fm; - el.elementModel.shapeModel.GLGeomObj.buildBuffers(); } - world.import(worldData); } } @@ -378,13 +378,13 @@ exports.ShapesController = Montage.create(CanvasController, { world = new GLWorld(el, false); el.elementModel.shapeModel.GLWorld = world; el.elementModel.shapeModel.useWebGl = false; + world.import(worldData); + el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null); el.elementModel.shapeModel.GLGeomObj.setFillMaterial(null); el.elementModel.shapeModel.strokeMaterial = null; el.elementModel.shapeModel.fillMaterial = null; - world.import(worldData); } - } } -- cgit v1.2.3