Mercurial > love-experiments
diff src/scripts/graphics.lua @ 1118:06e20ce294cd
Fix #435 (for real this time). Unfixes #324.
Add a extern vec2 love_ScreenSize to the pixel effects that will
be (re)set upon PixelEffect::loadVolatile() and is used to flip
the fragment coordinate.
Unfixes #324 because canvases can have different dimensions than
the screen.
| author | vrld <vrld@vrld.org> |
|---|---|
| date | Sun, 05 Aug 2012 16:08:22 +0200 |
| parents | 526db808b1c9 |
| children | b3305085b712 |
line wrap: on
line diff
--- a/src/scripts/graphics.lua Sun Aug 05 16:03:37 2012 +0200 +++ b/src/scripts/graphics.lua Sun Aug 05 16:08:22 2012 +0200 @@ -1290,18 +1290,14 @@ #define Image sampler2D #define extern uniform #define Texel texture2D - layout(origin_upper_left) in vec4 gl_FragCoord; - uniform sampler2D _tex0_;]] + uniform sampler2D _tex0_; + uniform vec2 love_ScreenSize;]] local footer = [[void main() { // fix weird crashing issue in OSX when _tex0_ is unused within effect() float dummy = texture2D(_tex0_, vec2(.5)).r; - gl_FragColor = effect(gl_Color, _tex0_, gl_TexCoord[0].xy, gl_FragCoord.xy); + gl_FragColor = effect(gl_Color, _tex0_, gl_TexCoord[0].xy, love_ScreenSize - gl_FragCoord.xy); }]] - local function include(quoted_path) return (love.filesystem.read(quoted_path:sub(2,-2))) end - code = code:gsub("#include (%b'')", include) - code = code:gsub('#include (%b"")', include) - return table.concat{header, "\n", code, footer} end @@ -1318,7 +1314,7 @@ linenumber, what, message = l:match("^%w+: 0:(%d+):%s*(%w+)%([^%)]+%)%s*(.+)$") end if linenumber and what and message then - lines[#lines+1] = ("Line %d: %s: %s"):format(linenumber - 5, what, message) + lines[#lines+1] = ("Line %d: %s: %s"):format(linenumber - 7, what, message) end end -- did not match any known error messages
