voxel/voxel-engine-stackgl

gl-shader compiling error

petuhovskiy opened this issue · 4 comments

Hello! I'm trying to use the following code,

var createEngine = require('voxel-engine-stackgl');

createEngine({
  require: require,
  pluginOpts: {
    'voxel-engine-stackgl': {
      appendDocument: true,
      exposeGlobal: true
    }
  }
});

But I get an error in console when try to run it. What am I doing wrong? (I use Chrome on Windows)
Console output

gl-shader error stacktrace

createShader    @bundle.js:15955
(anonymous function)    @bundle.js:15517
ShaderPlugin.createAOShader @bundle.js:15456
ShaderPlugin.ginit  @bundle.js:15379
EventEmitter.emit   @bundle.js:39172
initGLNow   @bundle.js:6407
EventEmitter.emit   @bundle.js:39147
initGameShell   @bundle.js:7614

maybe related: voxel/voxel-shader#11 gl-shader: Error compling vertex shader: ERROR: 0:18: '=' : global variable initializers must be constant expressions

@petuhovskiy I saw slightly different errors:

[Error] gl-shader: Error compling vertex shader: – "ERROR: 0:12: Invalid call of undeclared identifier 'webgl_a39852140000000d'↵ERROR: 0:26: Use of undeclared identifier 'webgl_7d8bd5b70000000c'↵"
[Error] Error: gl-shader: Error compiling vertex shader:ERROR: 0:12: Invalid call of undeclared identifier 'webgl_a39852140000000d'
ERROR: 0:26: Use of undeclared identifier 'webgl_7d8bd5b70000000c'
[Error] Error: voxel-shader render() called before gl-init, shader=
[Error] Error: voxel-shader render() called before gl-init, shader=
[Error] Error: voxel-shader render() called before gl-init, shader=

but they were preceded by another error which caused them, and quickly scrolled past the console output, but fixing this error fixed my errors at least:

voxel/voxel-shader#11 gl-shader: Error compling vertex shader: ERROR: 0:18: '=' : global variable initializers must be constant expressions

can you check if http://deathcap.github.io/voxel-example/ (now updated with this fix) reproduces your original errors? If not, will need to test Chrome on Windows, there might be some other incompatibilities, the "ERROR 0:12: '=' : cannot convert from 'const float' to 'highp 4X4 matrix of float'" is suspicious..

Tested Google Chrome 47 on Windows 7 in VMware Fusion, voxel-engine-stackgl 1.0.1 works for me - pretty sure this was fixed by voxel/voxel-shader#11:

screen shot 2015-12-30 at 7 43 21 pm