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

Modifying attributes #136

Open
luciedefraiteur opened this issue Nov 24, 2021 · 0 comments
Open

Modifying attributes #136

luciedefraiteur opened this issue Nov 24, 2021 · 0 comments

Comments

@luciedefraiteur
Copy link

luciedefraiteur commented Nov 24, 2021

Hey, i try to create a custom shader and a custom primitivestream, what i want is to add attributes and to modify size of POSITION, to be a vector2,

the problem is simply modifying the size of POSITION, it render the wrong ammount of triangles, attributes seems messed up,
steps:

  • in a clone of pbr.js file, i modified the vertex shader for the position to be vec2,
  • in a clone of primitivestream.js, i modified the primitive to not push the z value in pushVertex method, and i did modify attributes definition like so:
    let attribs = [
    new PrimitiveAttribute('POSITION', vertexBuffer, 2, GL.FLOAT, 32, 0),
    new PrimitiveAttribute('TEXCOORD_0', vertexBuffer, 2, GL.FLOAT, 32, 8),
    new PrimitiveAttribute('SCALE', vertexBuffer, 1, GL.FLOAT, 32, 16),
    ];

but it fails to render all the triangles i want to render, and i looked almost everywhere but i dont find why it doesnt work
and how to fix it, do you have any clue?

Also, do you think simply adding custom attributes here and in the shader will work? Or how to do it correctly?

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

1 participant