Jump to content

WebGL Not Working for Babylon.js in Firefox and Chrome, on Windows and Mac


Kingmarc77
 Share

Recommended Posts

Here is my simple code:

<html>    <head></head>    <body>        <canvas id="renderCanvas"></canvas>        <script src="jquery-2.1.4.min.js"></script>        <script src="babylon.2.2.max.js"></script>        <script>            var canvas = $("#renderCanvas");            var engine = new BABYLON.Engine(canvas, true);            var scene = new BABYLON.Scene(engine);            var camera = new BABYLON.ArcRotateCamera("Camera", 1, 2, 10, new BABYLON.Vector3(0, 0, 0), scene);            scene.activeCamera.attachControl(camera);            engine.runRenderLoop(function () {                scene.render();            });        </script>    </body></html>

When I open that with jQuery and BabylonJS in the same directory, I get this error in Firebug:

 

Error: WebGL not supported

 

It works in neither Firefox nor Chrome.

 

WebGL does otherwise work. I can, for example, run https://videos.cdn.mozilla.net/uploads/mozhacks/flight-of-the-navigator/ and the Three.js examples.

 

I get this same problem on both my Windows and my Mac.

 

Anyone have any idea what's wrong?

 

Here is my Firefox-configuration on Windows:

post-16828-0-70543800-1444506192_thumb.p

Link to comment
Share on other sites

 

It's because your canvas is a JQuery element, instead of being a DOM element.

Replace this line by : 

var canvas = document.getElementById("renderCanvas");

or : 

var canvas = $("#renderCanvas").get(0); // returns the DOM element linked to the jquery element

 

Thank you! :)

 

Also, the scene.activeCamera.attachControl(camera); line wanted changing to camera.attachControl(canvas);.

 

Now I can finally start working with BabylonJS! Thank you all! :)

Link to comment
Share on other sites

  • 5 months later...

you tourrr.babylon files aren't served by your web server (http error 404)

This is a web server configuration error, not a BJS one.

What webserver are you using ? it seems it's a nginx server after some hacking, so not Windows OS

Are you sure that your tourrr.babylon files have the correct rights to be read by the nginx server ?

Link to comment
Share on other sites

1 hour ago, vegasgroup said:
the server is linux on Arvixe, I have included MIME babylon ... you can help me I do not understand where I'm wrong I'm sorry :( help me thanks

Doesn't look like linux to me.
Your loading the babylon file from: http://www.arteinart.com/bonci3d/tourrr.babylon
If you open this link in the browser you get an IIS error page -> its a windows server running IIS 8.5
 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...