incorrect uniform resolution by AhmedMagedC · Pull Request #1082 · processing/processing4 · GitHub
Skip to content

incorrect uniform resolution - #1082

Open
AhmedMagedC wants to merge 1 commit into
processing:mainfrom
AhmedMagedC:shaders/bug-fix
Open

incorrect uniform resolution#1082
AhmedMagedC wants to merge 1 commit into
processing:mainfrom
AhmedMagedC:shaders/bug-fix

Conversation

@AhmedMagedC

Copy link
Copy Markdown
Contributor

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

@AhmedMagedC

Copy link
Copy Markdown
Contributor Author

@tychedelia

Copy link
Copy Markdown
Member

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

2 participants