Skip to content

Documenting available attributes and uniforms on the Reference page #1017

Open
@JetStarBlues

Description

@JetStarBlues

Actual 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions