Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocos2d v3 repeat texture

I was wondering how I should repeat a texture in Cocos2d 3. I have a background and I want to “tile” it across the screen. I have found this which is using ccTexParams with GL_REPEAT but those have been made private in version 3 of cocos.

I have found another solution which can be found here it creates a loop and positions a new child node based on the size of the texture and the size you want. But is that performant? Because when you have a 1px wide background texture and want to repeat that on a iPad retina, you have more than 2000 child nodes.

What is the best way to repeat a texture.

like image 349
Matthijn Avatar asked Oct 21 '22 18:10

Matthijn


1 Answers

Well since there was no method for repeating without having a POT texture I made something of my own which takes care of it.

Might be useful for someone who has this same question. The code can be found here on Github.

like image 170
Matthijn Avatar answered Oct 30 '22 12:10

Matthijn