gre / gl-react

gl-react – React library to write and compose WebGL shaders

Home Page:https://gl-react-cookbook.surge.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use vertex shader attributes (other than _p)

jussikinnula opened this issue · comments

bug report

library version

npm ls gl-react gl-react-dom gl-react-native gl-react-expo
gl-react-shader-attributes-problem@0.0.1 /Users/jami/dev/gl-react-shader-attributes-problem
├── gl-react@3.15.0
└── gl-react-dom@3.15.0

Expected behavior

One should be able to use any vertex shader attributes.

Actual behavior

One can only use attribute _p. If trying to use any other attribute, the following will appear in console:

createSurface.js:496 TypeError: Cannot read property 'pointer' of undefined
    at Surface._makeShader (createSurface.js:541)
    at Surface._getShader (createSurface.js:549)
    at Node._getShader (Node.js:763)
    at Node._draw (Node.js:826)
    at Surface._draw (createSurface.js:590)
    at Surface._this.flush (createSurface.js:337)
    at Surface._this._handleLoad (createSurface.js:519)
    at Surface.<anonymous> (createSurface.js:374)
    at callCallback (react-dom.development.js:11194)
    at commitUpdateEffects (react-dom.development.js:11233)

Steps to reproduce the behavior

Test with the test application: https://github.com/jussikinnula/gl-react-shader-attributes-problem

On the test application, there's now also fixed-version branch - which uses a patched gl-react (a build made with the change on PR #198). You can also manually install the patched version with npm uninstall --save gl-react && npm install --save jussikinnula/gl-react.

Can this get merged? Ran into the same issue.

PR was merged, will shortly publish a new version