I am attempting to setup a tiled/repeating background for my iPhone app.
The code "works" in that the background is repeating like it should be but I seem to have a black border around each repetition and I dont know why, the image is exactly 200x200. Here is a screenshot of how it looks along with the code:
if ((self=[super init])) {
CCSprite * bg = [CCSprite spriteWithFile:@"pattern11.jpg" rect:CGRectMake(0, 0, 1000, 520)];
[bg setPosition:ccp(0, 0)];
ccTexParams params = {GL_LINEAR,GL_LINEAR,GL_REPEAT,GL_REPEAT};
[bg.texture setTexParameters:¶ms];
[self addChild:bg z:0];
}
Textures should always be in power of two... like 16,32,64,128,256,512,1024.
Try resizing the image to 256x256 or 128x128.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With