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

Conversation

rileyjshaw
Copy link

Fragment Shaders: The Basics states that xy coordinates are relative to the top-left of the buffer. Really, they default to the bottom-left. From OpenGL:

By default, gl_FragCoord assumes a lower-left origin for window coordinates and assumes pixel centers are located at half-pixel centers. For example, the (x, y) location (0.5, 0.5) is returned for the lower-left-most pixel in a window. The origin of gl_FragCoord may be changed by redeclaring gl_FragCoord with the origin_upper_left identifier.

Fragment Shaders > The Basics states that `xy` coordinates are relative to the top-left of the buffer. Really, they default to the bottom-left. From [OpenGL](https://www.opengl.org/sdk/docs/man/html/gl_FragCoord.xhtml):

> By default, gl_FragCoord assumes a lower-left origin for window coordinates and assumes pixel centers are located at half-pixel centers. For example, the (x, y) location (0.5, 0.5) is returned for the lower-left-most pixel in a window. The origin of gl_FragCoord may be changed by redeclaring gl_FragCoord with the origin_upper_left identifier.
@rileyjshaw
Copy link
Author

Ping @mikolalysenko - have you seen this?

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.

1 participant