Mistake

Uncaught TypeError: _loaders.render is not a function at loaders.js: 131

code itself: https://jsfiddle.net/hsydbhea/

here is the last topic Displaying obj / stl objects there is a slightly different code there, but the problem is

_loaders.render(); _loaders.render = function () { _loaders.orbitControls.update(_loaders.clock.getDelta()); _loaders.requestAnimationFrame(_loaders.render); _loaders.webGLRenderer.render(_loaders.scene, _loaders.camera); }; 

the site is just a black screen

    1 answer 1

    This code does not work, since it is first used and only after the announcement.

    So it will be right:

     _loaders.render = function () { // add code }; _loaders.render(); 

    I recommend reading the article " The scope in JavaScript and" raising "variables and function declarations ."

    • now such an error> Uncaught TypeError: Cannot read property 'update' of Object._loaders.render (loaders.js: 136) at loaders.js: 140 - Michael
    • @Michael so _loaders.orbitControls not declared, you need to call before render I suppose _loaders.loadCurrentObject - Codd Wrench
    • I copied this script for myself jsfiddle.net/yozmrb74 - Michael
    • loaders.js: 137 Uncaught TypeError: _loaders.requestAnimationFrame is not a function at Object._loaders.render (loaders.js: 137) at loaders.js: 142 - Michael