I’ve experienced this problem before, but in that scenario it was because I had changed the textureWrapX and Y to “repeat” and then not set it back to “clampToEdge” after creating that object. Afaik that isn’t the case this time.
The object appears as expected in the sim and on Android devices, it’s only on iOS that I experience this problem.
I am trying to use some of Corona’s filter effects, to create an object which is kind of like a stained glass window. I want the cells to remain in place, but the colours behind to change. In principle it is working, and I have condensed the code down to this:
local \_W = display.contentWidth local \_H = display.contentHeight local bannerHeight = 256 local BASE\_TILES = \_W/180--90 local mainBG = display.newRect(\_W \* 0.5, \_H \* 0.5, \_W, \_H) mainBG:setFillColor( 0, 1, 0 ) local paint = { type = "image", filename = "tile02.png" } display.setDefault( "textureWrapX", "repeat" ) display.setDefault( "textureWrapY", "mirroredRepeat" ) local snapshot = display.newSnapshot(1025, bannerHeight) snapshot.x, snapshot.y = \_W \* 0.5, \_H \* 0.5 local banner\_bg = display.newRect(snapshot.group, 0, 0, \_W - bannerHeight, bannerHeight) banner\_bg.fill = paint banner\_bg.fill.x = 0 banner\_bg.fill.y = 0 display.setDefault( "textureWrapX", "clampToEdge" ) display.setDefault( "textureWrapY", "clampToEdge" ) local scaleFactorX = banner\_bg.height / banner\_bg.width local scaleFactorY = banner\_bg.width / banner\_bg.height banner\_bg.fill.scaleX = 0.05 \* scaleFactorX banner\_bg.fill.scaleY = 0.05 banner\_bg.fill.rotation = 0 snapshot.fill.effect = "filter.crystallize" snapshot.fill.effect.numTiles = BASE\_TILES snapshot.fill.scaleX = scaleFactorX local count = 0 local function updateGame(e) banner\_bg.fill.x = banner\_bg.fill.x + 0.001 banner\_bg.fill.y = banner\_bg.fill.y + 0.001 snapshot.fill.rotation = snapshot.fill.rotation - 0.011 snapshot:invalidate() count = count + 0.001 if count \>= 360 then count = count - 360 end snapshot.fill.effect.numTiles = BASE\_TILES + 0.3 \* math.sin(count) end Runtime:addEventListener("enterFrame", updateGame)
The image being used is 128*128, so it is a power of two texture. This line here is the problem:
local snapshot = display.newSnapshot(1025, bannerHeight)
If I make the width 1024, then the texture appears on iOS but with lots of ‘distortion’ for lack of a better word.
I’m not sure where the problem lies. Here is a folder with the project - it’s just this simple main.lua and the image that’s being used:
https://www.dropbox.com/sh/5m4er2hy9u0npn9/AABzyX77x8Y6r_kT4ipziNUTa?dl=0
If anyone has any suggestions they would be appreciated.
