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

uniform1fv failed #260

Open
vvshuai opened this issue May 18, 2023 · 2 comments
Open

uniform1fv failed #260

vvshuai opened this issue May 18, 2023 · 2 comments

Comments

@vvshuai
Copy link

vvshuai commented May 18, 2023

gl.shaderSource(
    xxxShader,
    `
    ....
    uniform float h[6];
    ....
    `
);
....
gl.uniform1fv(
        gl.getUniformLocation(xxxProgram, 'h'),
        new Float32Array([
            1.0,2.0,3.0,4.0,5.0,6.0
        ])
    );

When I am using headless-gl,
I'm trying to pass an array with variable 'h' into the fragment shader, but the rendering result is not working.
But if I write the variable 'h' in the fragment shader, there is no problem.
The code is effective in the browser.

@army8735
Copy link

+1

@army8735
Copy link

https://github.com/stackgl/headless-gl/blob/master/src/javascript/webgl-rendering-context.js#L2661

It looks like the info variable returned null, causing the value obtained by the gl.getUniformLocation method to be also null.

Try this way: gl.getUniformLocation(xxxProgram, 'h[0]'), it also works well on WEBGL.

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