diff --git a/src/Mod/Arch/importWebGL.py b/src/Mod/Arch/importWebGL.py
index 019b43fcea..d4165fb7e0 100644
--- a/src/Mod/Arch/importWebGL.py
+++ b/src/Mod/Arch/importWebGL.py
@@ -52,68 +52,68 @@ wireframeStyle = "faceloop" # this can be "faceloop", "multimaterial", or None
cameraPosition = None # set this to a tuple to change, for ex. (0,0,0)
linewidth = 1
template = """
-
-
- FreeCAD model
-
-
-
- var SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight;
- var VIEW_ANGLE = 35, ASPECT = SCREEN_WIDTH / SCREEN_HEIGHT, NEAR = 0.1, FAR = 20000;
+
-
-
- """
+ var camera, controls, scene, renderer;
+
+ window.onload = function() {
+
+ var SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight;
+ var VIEW_ANGLE = 35, ASPECT = SCREEN_WIDTH / SCREEN_HEIGHT, NEAR = 0.1, FAR = 20000;
+
+ renderer = new THREE.WebGLRenderer();
+ renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+ document.body.appendChild( renderer.domElement );
+
+ scene = new THREE.Scene();
+
+ camera = new THREE.PerspectiveCamera(
+ VIEW_ANGLE, // Field of view
+ ASPECT, // Aspect ratio
+ NEAR, // Near plane
+ FAR // Far plane
+ );
+ $CameraData // placeholder for the FreeCAD camera
+
+ controls = new THREE.TrackballControls( camera );
+ controls.rotateSpeed = 1.0;
+ controls.zoomSpeed = 1.2;
+ controls.panSpeed = 0.8;
+ controls.noZoom = false;
+ controls.noPan = false;
+ controls.staticMoving = true;
+ controls.dynamicDampingFactor = 0.3;
+ controls.keys = [ 65, 83, 68 ];
+
+ $ObjectsData // placeholder for the FreeCAD objects
+
+ var light = new THREE.PointLight( 0xFFFF00 );
+ light.position.set( -10000, -10000, 10000 );
+ scene.add( light );
+
+ renderer.render( scene, camera );
+
+ animate();
+ };
+
+ function animate(){
+ requestAnimationFrame( animate );
+ render();
+ };
+
+ function render(){
+ controls.update();
+ renderer.render( scene, camera );
+ };
+
+
+
+