var createScene = function () {
var scene = new BABYLON.Scene(engine);
var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 0, -5), scene);
camera.setTarget(BABYLON.Vector3.Zero());
camera.attachControl(canvas, true);
new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, -1), scene);
/**
* Is there any way to load an image from cross origin
* where Access-Control-Allow-Origin is not set by the server ?
*/
const src = 'https://vhaonline.usc.edu/vhaimages/stills/617269.jpeg';
//const src = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSArIeRcpcwIHj6R1zzYhEyJNPHHiBCXpN_vfjiloDdh9f9Svb8RUFGiJycz-kttSQpCeU&usqp=CAU';
BABYLON.Tools.CorsBehavior = 'anonymous';
BABYLON.Tools.SetCorsBehavior( src,canvas );
const mat = new BABYLON.StandardMaterial('billboard-material', scene);
mat.diffuseTexture = new BABYLON.Texture(
src,
scene
);
const billboard = BABYLON.MeshBuilder.CreatePlane('billboard-mesh', {}, scene);
billboard.material = mat;
return scene;
@Pryme8
Thanks for the input … I think I do not want to do a work-around i will just do the proper thing which is to get the server response corrected.
Well I mean, the definition of respond correctly is loose when you talk internet .
It’s prolly worth a look, you basically do a cors bypass php page that routs an ajax request and returns the results as Json/html/binary what have you then just parse it. Some assets on a html page might not come through but anything like images videos etc are totally accessable even if they don’t want you to have them.