Problem with texturing

Hi,
I’m sure it’s quite simple but I made mistake somewhere here and I can’t find it.

Here’s my code:

import direct.directbase.DirectStart
from pandac.PandaModules import *

from direct.task import Task
from direct.interval.IntervalGlobal import *
import math

teapot = loader.loadModel('teapot.egg')
teapot.reparentTo(render)
teapot.setScale(0.5, 0.5, 0.5)
teapot.setZ(4)
tex = loader.loadTexture('maps/noise.rgb')
teapot.setTexture(tex)

smiley = loader.loadModel('smiley.egg')
smiley.reparentTo(render)
smiley.setTexture(tex, 1)


def SpinCameraTask(task):
    angleDegrees = task.time * 20.0
    angleRadians = angleDegrees * (math.pi / 180.0)
    base.camera.setPos(20 * math.sin(angleRadians), -20.0 * math.cos(angleRadians), 3)
    base.camera.setHpr(angleDegrees, 0, 0)
    return Task.cont

taskMgr.add(SpinCameraTask, "SpinCameraTask")

run()

And that’s my output:
http://img225.imageshack.us/img225/9521/outputj.jpg

Why teapot isn’t textured like the sphere below? Where’s my mistake?

hi, welcome to panda.
hm. just a wild guess. but i think the teapot has not UV-map by default. so, the texture itself would never be mapped onto it correctly. so it’s not your mistake.

Thank you! :smiley:

What should I do then?
I’ve read about some problems with TexGen and auto-shader. I experienced it by myself already: “Shader Generator does not support TexMatrix yet” or sth like that.
Is there a better solution that using TexGen?

Well, you could use a model that actually has UV’s on it (or create one that does). Most models do have UV’s; the teapot is an exception.

David

Thanks for advice.
And thanks for replies to both of you. I’m going back to work. :smiley:

For the record, the latest CVS version of Panda supports this - you can expect that to work in 1.7.0.

Great to hear that. :smiley:

ps. To the previous reply by drwr: your advice did it’s best. Works great. Thanks a lot.