Documenting available attributes and uniforms on the Reference page
See original GitHub issueActual Behaviour
There is currently no documentation on the attributes and uniforms that are available when writing shaders in p5. For example, the aPosition
attribute is used in all vertex shader examples, but there is no associated documentation on the Reference page. Similarly, there are a lot of useful attributes and uniforms (such as uProjectionMatrix
), which do not appear in any of the available examples. The only way to learn about them is to dig into the p5 source code.
Expected Behaviour
Ideally, a list of the available uniforms would be listed in the setUniform()
documentation page. Each listing would have a brief description of what the uniform does. (This would have the added bonus of giving the user a hint as to which uniform names are unavailable for use).
Similarly, a list of available attributes would be listed. If a setAttribute()
method existed in p5, its documentation page would be the ideal place to list them. However, they can be (together with the default uniforms for consistency) be listed in the p5.Shader
documentation page.
Since a lot of these default attributes and uniforms are used for the default shaders, not all are immediately relevant to outside use. Here is a list of the most useful I have been able to identify so far (source1, source2):
- Attributes
- aPosition
- aTexCoord
- aNormal
- aMaterialColor (aVertexColor might be a better name)
- Uniforms
- uProjectionMatrix
- uModelViewMatrix
- uViewMatrix
- uNormalMatrix
Ideally, additional examples (such as this one (live, src by aferriss ) would be added to demonstrate the usage of some of these attributes and uniforms.
Would you like to work on the issue?
Yes
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:22 (15 by maintainers)
Top GitHub Comments
Hi @aferriss
I will clean this PR up. There are a few outstanding questions, but I’ll compile a list at the end.
One thing I would love your opinion on is this PR (and related issue) that limits the scope of the default uniforms… this would greatly reduce the number of things we have to tell people they can’t use.
I will also create a single PR that updates all the shader examples. It will be a combination of the discussions (and draft PRs) here:
Two PRs in total. Or potentially one, since the order of the examples seems to be determined by the number prefix on the filename, and it would be ideal to place this documentation as the first entry (which would require a rename of all examples to place this as
00_
)@JetStarBlues I wanted to see if this was still in progress and where you ended up with documenting the uniforms. I’ve seen some other issues lately for people asking for documentation. Since this work was already done it might be worth putting up as a PR to review.
Thanks!