OhNoItsATornahdo Posted August 30, 2017 Share Posted August 30, 2017 So I treid using Pixi.js for the first time and I tried loading an image onto a web page. When I tried doing so, I got this error: Uncaught DOMException: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin pixi.js:2367 image at file:///C:/Users/x/Desktop/Projects/project/img/bck1.png may not be loaded. Here's the code to my project: PIXI.utils.sayHello(); var renderer = PIXI.autoDetectRenderer(800, 600, { transparent: true, resolution: 1 }); document.getElementById('main').appendChild(renderer.view); var stage = new PIXI.Container(); PIXI.loader .add('image', 'img/bck1.png') .load(setup); var image; function setup() { image = new PIXI.Sprite(PIXI.loader.resources['image'].texture); stage.addChild(image); renderer.render(stage); } What is the problem? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 30, 2017 Share Posted August 30, 2017 Start a web-server. As an example: install node.js, run "npm install -g http-server", and in the directory with your app type "http-server -c-1", web-page will be accessible at http://localhost:8080 OhNoItsATornahdo 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.