Sign in to follow this  
CGinSeattle

Absolute Newbie Question: Basic Scene, Running static HTML with babylon.js locally (no localserver) - fails with Uncaught TypeError: scene.render is not a function

Recommended Posts

I know something seems to be wrong here. I"m using the simpliest example, the one in the beginning docs, the full HTML given there.

I am running static.

I've managed to get the HTML to load statically (i.e. no localserver, no webserver, just off the desktop) and have the generated babylon.js file in the same directory as the index.html page.

I know it's loading and finding the .js file. It fails in the same place whether I use my custom generated babylon js file or if I point the page to the same babylon.js file that the playground uses.

the error from the inspector is:

Uncaught TypeError: scene.render is not a function

I am running in Chrome, but I have no issues with running Playground in Chrome. Also the HTML does the same thing in IE (though it's debugger picks up no errors, just won't run beyond creating the canvas). 

Error reported from Chrome:

BJS - [17:31:37]: Babylon.js engine (v3.1-alpha) launched
index.html:79 Uncaught TypeError: scene.render is not a function
    at index.html:79
    at r._renderLoop (babylon.js:4)

It points at the line in index.html (at scene.render)

      engine.runRenderLoop(function () { // Register a render loop to repeatedly render the scene
                    scene.render();
            });

Attaching the index.html file.

Any ideas? I don't want to have to deal with localserver. And am working on a way to load OBJ files (that's how I got here. I wanted to see if I could get the objloader to work from the desktop, since I cannot get it to work in the Playground via file chooser. I can only get .babylon files to load successfully in that case.)

If you're curious about that, see: https://www.babylonjs-playground.com/#6N13NV#7

So I thought I would try a different tack. After all, I should be able to load .js files locally (static HTML), including the objloader extension. But I didn't anticipate that I would have problems with getting babylon.js to work in that situation.

 It seems it must be something simple, after all this is just the beginner sample that the docs list. Nothing fancy. But after a number of hours of searching forums and experimenting, I'm out of ideas. :(

Thanks!

 

index.html

Share this post


Link to post
Share on other sites

@Gijs Perfect! That did it! Thank you so much!! I don't have enough experience yet with babylonJS to spot such a simple fix, so thank you!

@Deltakosh This page is where I got the HTML. http://babylonjsguide.github.io/begins/Introducing_Babylonjs  You may want to ask the doc writers to update it to the correct call and the correct url for babylon.js online. It's a minor thing, of course, but for newbies like me, that don't know any better, it might be helpful...  :)

 

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.