Texture a background

Good afternoon!
Please tell me! How can I make a 100x100 texture a background so that it repeats at both coordinates?

local bg = display.newRect( w_center, h_center, _W, _H );
bg.fill = { type = "image", filename = "images/bg/dasht.png" };

Now it is not repeated. I put this:

display.setDefault( "textureWrapX", "repeat")
display.setDefault( "textureWrapY", "mirroredRepeat")

Getting an error

There’s no way of guessing what error you are receiving or what causes it. You need to share that error message.

As for the texture wrap mode, you need to set that before you create a display object. Then, if you don’t want other objects that you create later to also repeat, you’ll need to reset the texture wrap modes afterwards.

1 Like

03:02:52.699 WARNING: The dimensions of the image (D:\CORONA_proj\Fingers Ball\images/bg/dasht.png) you provided for a repeating fill are not in a power-of-two. You might have some graphical issues on an actual device


display.setDefault( "textureWrapX", "repeat")
display.setDefault( "textureWrapY", "mirroredRepeat")
local bg = display.newRect( w_center, h_center, _W, _H );
bg.fill = { type = "image", filename = "images/bg/60.png" };
display.setDefault( "textureWrapX", "clampToEdge")
display.setDefault( "textureWrapY", "clampToEdge")

this also does not work, although the image is 60 * 60 pixels.
Background does not repeat

I’m pretty sure 60 is not a power of 2, try a 64x64 image