Tiling Textures?

Real sorry, I believe this is quite a simple thing, its just that I’m not too sure how the texture thing works…

I’m trying to get a tiling texture working, where i have this HUGE thing, and I want the texture to constantly repeat itself instead of stretching itself to the full size.

        self.model = loader.loadModel(MYDIR + '/box.egg')
        texCrate = loader.loadTexture(MYDIR + '/box.bmp')

This is the code.

Can someone tell me how I can make my textures tile?


Try this:

nodePath.setTexScale(TextureStage.getDefault(), 1, 1)

Replace 1, 1 with how often you want the texture to be repeated.

Wow… You’re fast.

And it works!

Thanks a bunch!


Sorry if this question is a bit off topic though…

How do you get the highest values in a number of values again? I kinda forgot the function for it…

For example…

Getting the 2 highest values in 3 values.

max() is a Python function that returns the highest value of a list of values. If you want the two highest values, you have to sort() the list, and then get the last two values in the list.


another way:
uv-map a small piece of your model and set the wrap mode to REPEAT. i usually do this in the egg file with the following line inside a texture section:

  <Scalar> wrap { REPEAT }

Ah… Thanks alot everyone, but actually…

How about when you scale the object?

I currently made a tiny system for my game which allows me to use crates, and extend it out to make the level fo the game simply. What it does is that it just finds the distance between the two, repositions a crate in the middle, and scales it out to that distance, to create a wall.

But the thing is, when I do that, the textures on it screw up, using my code.

Can someone give me tips as to how to fix this? The code that I currently have for that bit is:

        self.tex = loader.loadTexture(MYDIR + '/' + self.TYPE + '.jpg')
        if (self.type != "LockedDoor" and self.type != "Door" and self.type != "Board"):
            scaleList = [self.xScale,self.yScale,self.zScale]

setTexScale/Offset() have misleading names. They actually apply the value as it is, as if their names are setUvScale/Offset.
So, maybe you want to multiply by 2 instead.

Ah… I’ll give it a try. Thanks!