Опитвам се да изобразя куб от страната на сървъра и успях да го направя с помощта на CanvasRenderer, но искам да мога да го изобразя с WebGLRenderer, което би трябвало да доведе до по-добри резултати. стесних го до този кодов фрагмент:
var jsdom = require('jsdom')
, document = jsdom.jsdom('<!doctype html><html><head></head><body></body></html>')
, window = document.createWindow()
, THREE = require('three');
document.onload = docOnLoad();
function docOnLoad()
{
console.log("docOnLoad called.");
global.document = document;
global.window = window;
//renderer = new THREE.CanvasRenderer(); //works
renderer = new THREE.WebGLRenderer();
renderer.setSize(400, 400);
document.body.appendChild(renderer.domElement);
}
Когато използвах WebGLRenderer, получих:
_glExtensionTextureFloat = _gl.getExtension( 'OES_texture_float');
^
TypeError: Cannot call method 'getExtension' of undefined
at initGL (C:\programming\nodejs\node_modules\three\three.js:25870:34)
когато се опитвате да отстраните грешки в кода three.js, console.log(_gl) наистина показва, че _gl е недефиниран и източникът му е ред #25856, където:
_gl = _canvas.getContext( 'webgl', attributes ) || _canvas.getContext( 'experimental-webgl', attributes );
сега console.log() на _canvas показва: [Canvas 0x0]
Някой срещал ли е нещо подобно?