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

Fix fragment shader position references #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/frag-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ void main() {

Every fragment shader also receives a special input variable called `gl_FragCoord`. `gl_FragCoord` is a `vec4` which returns the coordinate of the fragment in device coordinates. Specifically:

* `gl_FragCoord.xy` is the coordinate of the fragment in units relative to the top-left of the buffer. The y-component is the row of the fragment, and the x-coordinate is the column.
* `gl_FragCoord.xy` is the coordinate of the fragment in units relative to the bottom-left of the buffer. The y-component is the row of the fragment, and the x-coordinate is the column.
* `gl_FragCoord.z` is the depth value of the fragment, in units between `[0,1]`, where `0` represents the closest possible z value and `1` represents the farthest possible z-value.
* `gl_FragCoord.w` is the reciprocal of the homogeneous part of the fragment's position in clip coordinates