I am trying to apply a texture on some cylinders. The textures I use are flags from different countries (USA, FRANCE and GERMANY).
Here is what I do :
# create model
self.model = self.loadModel("cylinder")
# set parent
# set size
# set color
# set texture
if(self.countryName == "FRANCE"):
flag = loader.loadTexture("textures/france.png")
elif(self.countryName == "USA"):
flag = loader.loadTexture("textures/usa.png")
elif(self.countryName == "GERMANY"):
flag = loader.loadTexture("textures/germany.png")
first of all. textures should always have a sizw with a power of 2 simply because most graficcards demands it… means sizes like 64x512 or 128x265 or 32x32.
if the textures dont show up at all try to change your code to:
self.model.setTexture(flag, 1 )
notice the “,1” after the flag.
if you still cant see anything you should check the uv-coordinates of your cylinder.
for tests you could automatically generate those uv-coords to check if the rest is working. just try adding
Thanks to ThomasEgi it works. But the texture is repeated on the whole surface (quite logical when I take a look at the code). However I’m trying to magnify the texture so that it covers the whole cylinder. But I have no idea of how to do that. It tried the setMagFilter attribute, but it doesn’t do anything.
ynjh_jo > The problem with WMClamp is that it expands the border (not the border color, but the image border). what I want to do is have the whole texture magnified to the object size. But I couldn’t find anything in the doc about that.