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

Use __dirname in glsl paths? #12

Open
deathcap opened this issue Dec 30, 2015 · 2 comments
Open

Use __dirname in glsl paths? #12

deathcap opened this issue Dec 30, 2015 · 2 comments

Comments

@deathcap
Copy link
Member

https://github.com/stackgl/glslify#browserify-transform uses __dirname + for shader filename paths:

var src = glslify(__dirname + '/shader.glsl')

voxel-shader probably should to, instead of ./ relative:

    glslify('./lib/ao.vsh'),
    glslify('./lib/ao.fsh')
@deathcap
Copy link
Member Author

Strange, tried this:

+++ b/aoshader.js
@@ -141,8 +141,8 @@ ShaderPlugin.prototype.render = function() {

 ShaderPlugin.prototype.createAOShader = function() {
     return glShader(this.shell.gl ,
-    glslify('./lib/ao.vsh'),
-    glslify('./lib/ao.fsh')
+    glslify(__dirname + 'lib/ao.vsh'),
+    glslify(__dirname + 'lib/ao.fsh')
     )

but then beefy vmv inexplicably fails:

> [email protected] start voxel/voxelmetaverse
> beefy index.coffee:bundle.js --watchify --port 8080 -- --debug

beefy (v2.1.5) is listening on http://127.0.0.1:8080
200  293ms       778B  /
200  818ms     7.08KB  /logo-white.png
200  814ms    16.29KB  /crosshair4.png
buffer.js:237
    buf.copy(buffer, pos);
        ^

TypeError: buf.copy is not a function
  at Function.Buffer.concat (buffer.js:237:9)
  at Stream.end (voxel/voxelmetaverse/node_modules/beefy/lib/accumulate-error.js:25:26)
  at _end (voxel/voxelmetaverse/node_modules/beefy/node_modules/through/index.js:61:9)
  at Stream.stream.end (voxel/voxelmetaverse/node_modules/beefy/node_modules/through/index.js:70:5)
  at Stream.onend (stream.js:59:10)
  at emitNone (events.js:72:20)
  at Stream.emit (events.js:166:7)
  at drain (voxel/voxelmetaverse/node_modules/beefy/node_modules/through/index.js:33:23)
  at Stream.stream.queue.stream.push (voxel/voxelmetaverse/node_modules/beefy/node_modules/through/index.js:41:5)
  at Stream.end (voxel/voxelmetaverse/node_modules/beefy/node_modules/through/index.js:17:35)
  at _end (voxel/voxelmetaverse/node_modules/beefy/node_modules/through/index.js:61:9)
  at Stream.stream.end (voxel/voxelmetaverse/node_modules/beefy/node_modules/through/index.js:70:5)
  at voxel/voxelmetaverse/node_modules/beefy/lib/bundlers/watchify.js:79:39
  at nextTickCallbackWith0Args (node.js:433:9)
  at process._tickCallback (node.js:362:13)

@deathcap deathcap changed the title Use __dirname in glsl paths Use __dirname in glsl paths? Dec 30, 2015
@timoxley
Copy link
Member

@deathcap that bufcopy issue is a bug in the stream handling inside beefy (cc @chrisdickinson) because there's an error String coming out of the build, rather than a Buffer.

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

2 participants