dagen Guest |
Quote
|
2011-06-01 10:54:02 |
|
Hi all,
im start reading docs and make some changes to source code of tutorial2:
(add manually creating canvas and move all code to head section)
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript" src="copperlichtdata/copperlicht.js"></script> <script> window.=function(){ var canvas = document.createElement('canvas'); canvas.id = "3darea"; canvas.style.position = 'fixed'; canvas.style.top = '0px'; canvas.style.left = '0px'; canvas.style.zIndex = '-10'; //canvas.width = document.body.offsetWidth; canvas.width = window.innerWidth; canvas.height = window.innerHeight; document.body.appendChild(canvas); var engine = startCopperLichtFromFile('3darea', 'copperlichtdata/index.ccbjs'); var cubeSceneNode = null; // this is called when loading the 3d scene has finished engine.ingComplete = function() { var scene = engine.getScene(); if (scene) { // find the cube scene node cubeSceneNode = scene.getSceneNodeFromName('cubeMesh1'); // also, force the 3d engine to update the scene every frame scene.setRedrawMode(CL3D.Scene.REDRAW_EVERY_FRAME); // additional, let the sphere constantly rotate var sphereSceneNode = scene.getSceneNodeFromName('sphereMesh1'); if (sphereSceneNode) sphereSceneNode.addAnimator(new CL3D.AnimatorRotation(new CL3D.Vect3d(0, 1.6, 0.8))); } } document. = function(event) { var key = String.fromCharCode(event.keyCode); // when pressed 'L', move the cube scene node a bit up if (key == 'F' && cubeSceneNode) cubeSceneNode.Pos.Y += 5; // when pressed 'G', move the cube scene node a bit down if (key == 'G' && cubeSceneNode) cubeSceneNode.Pos.Y -= 5; // we need to call the key handler of the 3d engine as well, so that the user is // able to move the camera using the keys engine.handleKeyDown(event); }; } </script> </head> <body> //some tags </body> </html>
in FF4 all works good, but in Chrome11 mouse control isn't available.
what's wrong with this?
or it's just CopperLicht's not fixed bug?
|
dagen Registered User |
Quote
|
2011-06-01 11:38:44 |
|
of course,
window.onl/oad = function(){....
|
dagen Registered User |
Quote
|
2011-06-01 15:48:50 |
|
commenting the line with 'zIndex' make this demo workable)
i will be happy to learn why.
thx to all)
|
kingkohle Registered User |
Quote
|
2011-06-01 15:50:31 |
|
Chrome still sucks using WebGL, though.. Should be fixed in the future. CanĀ“t you pan the view at all?
|
niko Moderator |
Quote
|
2011-06-02 06:35:02 |
|
Not sure about that, I'll have a closer look at it.
|