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

standardized glsl variable naming #142

Merged
merged 2 commits into from
Oct 7, 2018
Merged

standardized glsl variable naming #142

merged 2 commits into from
Oct 7, 2018

Conversation

thegtproject
Copy link
Contributor

I wanted to get this done before going version 0.8

This PR is to standardize the GLSL variable naming we use. There is no one official standard however there are plenty of common defacto standards. I went with what I think is best overall:

Any variables going into the vertex shader are attributes; so any attribute variable should begin with a lowercase a. Example:

in vec2  aPosition;
in vec4  aColor;
in vec2  aTexCoords;
in float aIntensity;

Any variables being sent to the fragment shader from the vertex shader are varyings; so any varying variable should begin with a lowercase v. Example:

// Vertex Shader would use:
out vec4  vColor;
out vec2  vTexCoords;
out float vIntensity;

// Fragment Shader would use:
in vec4  vColor;
in vec2  vTexCoords;
in float vIntensity;

Any uniform variables being sent to either shader should begin with a lowercase u. Example:

uniform vec4      uColorMask;
uniform vec4      uTexBounds;
uniform sampler2D uTexture;

@faiface
Copy link
Owner

faiface commented Oct 7, 2018

Cool, while we're at it, could you also make the names of the arguments in the Canvas.SetUniform method lowercase?

@thegtproject
Copy link
Contributor Author

done

@faiface faiface merged commit 7492717 into faiface:master Oct 7, 2018
@thegtproject thegtproject deleted the glslstandardization branch October 7, 2018 19:09
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

Successfully merging this pull request may close these issues.

None yet

2 participants