Skip to content

incorrect uniform resolution #1082

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AhmedMagedC
Copy link

Resolves #1063

Changes

correctly set the uniform resolution to reflect the changes in pixelDensity

Why?

when pixelDensity is set to 2 either implicitly (starting from Processing 4.4.3 version) ,or when called when creating a sketch
the physical resolution (width and height) is doubled, but that isn't reflected on the uniform resolution (the rendering resolution)
so for example in conway.glsl this piece of code vec2 position = ( gl_FragCoord.xy / resolution.xy ); results in inconsistent position (wrong scaling) because uniform resolution still uses the logical resolution specificed in size() function

Tests
i tested all shaders examples, and everything seems fine except for two examples

  1. deform, mouseX and mouseY also isn't reflected the change of pixelDensity
    a simple solution is to multiple mouseX and mouseY by pixelDensity to reflect the correct position

  2. DemoProjection this one is missed up, but i think it's related to the code written in sketch not sure about that

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.

Some shader() examples behave unexpectedly at higher pixel densities
1 participant