Jump to content

Babylonjs on Webbrowser

Ahmet Gürbüz

Recommended Posts

Hi Everyone.

I have winform application C# .Net. I tried to use webbrowser to display BABYLONJS, but I have have some problems. Is it possible to display it on webbrowser?

Unfourtunately, photos are not turkish, but it says

"Belirleyici gerekli" means needs definer"

'"BABYLON' tanımız" means "BABYLON is undefined".

on webbrowser side:

        private void button1_Click(object sender, EventArgs e)
            string curDir = Directory.GetCurrentDirectory();
            webBrowser1.Url = new Uri("file:///D:/Musteriler/Liv%20Makina/_Omron%20Konfigürasyon/_CNC_Omron/PC/OmronCncV4/BabylonJS/index.html");
            webBrowser1.ScriptErrorsSuppressed = true;

thank you.




Link to comment
Share on other sites

Yes, Babylon.js works inside the WebBrowser control as long as you're running at least IE11 on your machine. Looks like you've not referenced correctly babylon.js in your html file. 

Try to change your URI to "https://www.babylonjs.com/demos/spaceship/" and if it displays the spaceship in your Winform application, this means that Babylon.js is supported on your machine inside the webbrowser control.

Link to comment
Share on other sites

Hi Davrosu,

thanks for your reply.

I have changed my Uri to "https://www.babylonjs.com/demos/spaceship/" as you said. and now I see this screens.

Screen0: I think it is related with sequrity of https. I say "YES" to go on

Screen1: Hata (Error) : Script Error. URL: https://preview.babylonjs.com/babylon.jsI say "YES" to go on

Screen2: Hata (Error) : BABYLON is undefined. URL: https://www.babylonjs.com/js/loader.js. I say "YES" to go on

 Screen3: Last viewing. I see the buttons on right side. I can not see 3d object.

what could be reason?

also I have changed my button1_click event on following.

        private void button1_Click(object sender, EventArgs e)
            webBrowser1.Url = new Uri("https://www.babylonjs.com/demos/spaceship/");

        thank you Ahmet.       






Link to comment
Share on other sites

Ok, I know why.

1 - the WebBrowser control doesn't support https... So you need to have only http reference. This demo should work: http://www.3dpanacea.com/automotive_showroom/cybrox.html as all our demos now is forcing https

2 - next problem is that the WebBrowser is using by default the IE7 compatibility mode: no WebGL and lot of missing JavaScript features to load Babylon.js (hence your first errors). You need to force the IE11 rendering mode using of the approach described there: https://blogs.msdn.microsoft.com/patricka/2015/01/12/controlling-webbrowser-control-compatibility/

I've been able to load the car demo using that.



Link to comment
Share on other sites

Hi David,

now I am able to display my local html file on webbrowser. what i did to do, only I modified 

<meta http-equiv="X-UA-Compatible" content="IE=edge"> in my Html file. As I read "IE=edge" uses the last IE version on the client side.

after that modification, I can see my index.html in my webbrowser. But the another problem comes that is I can not use my mouse events to rotate shapes over webbrowser. the arrow keys of keyboard is working well to rotate. Also Mouse wheel is working to zoom In&Out.

the second problem is whenever I put your link as  " webBrowser1.Navigate("http://www.3dpanacea.com/automotive_showroom/cybrox.html"); " , I am got still some script.

what could be reason?

Thank you.





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.

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.


  • Recently Browsing   0 members

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