
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
get-attributes-uniforms
Advanced tools
Get the uniforms and attributes from a GLSL shader string
The initial motivation for get-attributes-uniforms was to be used in the browser during runtime
when getting attribute and uniform locations from a shader
(i.e. calling getAttribLocation & getUniformLocation).
We want get-attributes-uniforms to be tiny since it intends to run in the browser,
so instead of depending on a powerful but large glsl AST parser we use the
native string functions.
In short.. we just chop out the uniform and attribute names based on our knowledge of the GLSL syntax.
This API does not use an AST and could very well be overlooking an edge case. If you run into one, feel super free to open an issue or open a PR with a test case.
$ npm install --save get-attributes-uniforms
Changes to the demo and src files will now live reload in your browser.
var getAttributesUniformss = require('get-attributes-uniforms')
var fragmentShader = `
precision mediump float;
attribute mat4 someAttrib;
uniform vec4 color;
void main () {
gl_FragColor = color;
}
`
var vertexShader = `
precision mediump float;
attribute vec2 position;
attribute vec4 foobar ;
void main () {
gl_Position = vec4(position, 0, 1);
}
`
console.log(getAttributesUniforms(fragmentShader))
// { attributes: {someAttrib: 'mat4'}, uniforms: {color: 'vec4' } }
console.log(getAttributesUniforms(vertexShader))
// { attributes: {position: 'vec2', foobar: 'vec4'}, uniforms: {} }
getAttributesUniforms(shaderString) -> ObjectType: String
A string representing a vertex or fragment shader.
var shaderString = `
precision mediump float;
attribute vec3 position;
void main() {
// ...
}
`
uniformMIT
FAQs
Get the attributes and uniforms from a GLSL shader string
We found that get-attributes-uniforms demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.