Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
deathcap opened this issue Dec 30, 2015 · 0 comments

Comments

@deathcap
Copy link
Member

gl-shader: Error compling vertex shader: ERROR: 0:18: '=' : global variable initializers must be constant expressions
createShader @ bundle.js:19534(anonymous function) @ bundle.js:19097ShaderPlugin.createAOShader @ bundle.js:42043ShaderPlugin.ginit @ bundle.js:41966EventEmitter.emit @ bundle.js:88941initGLNow @ bundle.js:33223EventEmitter.emit @ bundle.js:88916initGameShell @ bundle.js:34207(anonymous function) @ bundle.js:33470(anonymous function) @ bundle.js:34091

with vmv on Chrome 47.0.2526.106 on OS X 10.11.2 (this used to work), relevant glsl:

mat4 translate(float x, float y, float z) {
  return mat4(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0);
}
mat4 shift = translate(-1.0, -1.0, -1.0); // error here
void main() {
…
  gl_Position = projection * view * model * shift * vec4(position, 1.0);

seems apparent to me this global variable is a constant expression, but not to the compiler; should probably move it into main()

deathcap added a commit to voxel/voxel-engine-stackgl that referenced this issue Dec 30, 2015
voxel/voxel-mesher#11 cwise: Arrays do not all have the same shape
voxel/voxel-shader#10 Broken dependency: glslify (esprima-six unpublished)
voxel/voxel-shader#11 gl-shader: Error compling vertex shader: ERROR: 0:18: '=' : global variable initializers must be constant expressions

Note that semver would have pulled in the voxel-mesher fix (^0.14.0 matches 0.14.3), but
since these fixes are all very important (either cannot run on modern browsers or build
in development environment, due to unpublished dependency), making the requirements explicit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant