Skip to content

uniform1fv failed #260

Open
Open

Description

@vvshuai
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.

Activity

  1. army8735 commented on Jun 25, 2024

    @army8735

    +1

  2. army8735 commented on Jun 26, 2024

    @army8735

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions