Skip to content

Commit f792fce

Browse files
committed
The default BaseShader vertex shader will now set the fragCoord varying to be the viewport height minus the y inPosition. This will give the correct y axis in the fragment shader, causing 'inverted' shaders to display normally when using the default vertex code.
1 parent 48bf3d2 commit f792fce

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Updates
66

77
* `Zones` will now use the new `customHitArea` property introduced in 3.17 to avoid their hit areas from being resized if you specified your own custom hit area (thanks @rexrainbow)
8+
* The default `BaseShader` vertex shader will now set the `fragCoord` varying to be the viewport height minus the y inPosition. This will give the correct y axis in the fragment shader, causing 'inverted' shaders to display normally when using the default vertex code.
89

910
### Bug Fixes
1011

src/display/shader/BaseShader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ var BaseShader = new Class({
6868

6969
'void main () {',
7070
'gl_Position = uProjectionMatrix * uViewMatrix * vec4(inPosition, 1.0, 1.0);',
71-
'fragCoord = inPosition;',
71+
'fragCoord = vec2(inPosition.x, uViewMatrix[2][0] - inPosition.y);',
7272
'}'
7373
].join('\n');
7474
}

0 commit comments

Comments
 (0)