ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:
Ambiera Forum > CopperLicht
addScene() with Overlay2D probleme
Author Text

Registered User
2012-04-11 15:21:01

Hi everybody,

I've got a little probleme and i don't know if it's a bug or I'm doing it in the wrong way. here is my case, i load first file1.ccbj in canvas1, then i load file2.ccbj to canvas2, then i try to get a scene from the seconde canvas and add it to the first loaded engine.

var engine1 = startCopperLichtFromFile('Canvas1', 'file1.ccbj');
engine1.ingComplete=function (){
var engine2 = startCopperLichtFromFile('Canvas2', 'file2.ccbj');
engine2.ingComplete=function (){

All is working file, the probleme is when I have Overlay2D in the scene that will be imported, the text dont show correctly in the engine1.

thanks by advence.

2012-04-11 15:46:23

Hm, I'm not sure if this would work, it wasn't designed so you can switch scenes and data between to instances of an engine, on different canvases. I'm surprised this works at all :)

Registered User
2012-04-11 15:49:11

Is there a way to get scenes from different files ?

2012-04-11 16:15:51

Sure, just use


Registered User
2012-04-11 16:32:15

I'm stupid, Think you bro, You made my day !

Registered User
2015-05-25 03:42:01

destroy the content of the original file, if not saved and added on reloading. (IMO)

So I tried the code of @xakiru - he said that worked:

<script type="text/javascript">

var engineSphere = startCopperLichtFromFile('spherearea', 'copperlichtdata/sphere.ccbjs');
var savedBuffer = null;
engineSphere.OnLoa_dingComplete = function() {
console.log("sphere complete");
var sceneSphere = engineSphere.getScene();
if (sceneSphere) {
savedBuffer = sceneSphere.getSceneNodeFromName('sphereMesh1');
//shows buffered javaScript object == sphereMesh1

var engine = startCopperLichtFromFile('cubearea', 'copperlichtdata/cube.ccbjs');
var cubeSceneNode = null;
engine.OnLoa_dingComplete = function() {
console.log("cube complete");
var scene = engine.getScene();
if (scene){
loadModel = function(){
console.log("savedBuffer before addChild");
// find the cube scene node
cubeSceneNode = scene.getSceneNodeFromName('cubeMesh1');
// also, force the 3d engine to update the scene every frame

document. = function(event){
var key = String.fromCharCode(event.keyCode);
// when pressed 'F', 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

<button ="loadModel()">Load Sphere</button>

example here:

Even if I used the same engine and same scene – in different <DIV>'s, or engine= new CL3D.CopperLicht(), engine.load() - It seems that we could control only the engine loaded in the first <DIV> - see arrow keys and F, G keys implemented from tutorial2.
On trying to copy the node from one engine to another I’ve got the same error message: WebGL: INVALID_OPERATION: bind(‘something’): object not from this context. for all elements of the javascript object.
The javascript object was copied but empty (only has his name and appear in nodes list)
What does it mean “not for this context” webgl buffer binding error for copperlicht?
How could I transfer nodes between running ccbj files?

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Inter?ational" (you are not logged in)




Forum Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Software: Ambiera Light Forum. © 2008-2019 Nikolaus Gebhardt, Ambiera e.U.