create road with 2D texture

Hello, i have need help.

I want to create plane surface and apply road texture (png image), it’s possible with panda engine without use egg file ? how ?

thank’s for advance.

It’s not possible with this engine :open_mouth:

Sure it’s possible.
The easiest way is to use the CardMaker class:

from panda3d.core import *
from direct.showbase.ShowBase import ShowBase

class MyApp(ShowBase):

    def __init__(self):

        ShowBase.__init__(self)

        # setup the camera

        self.disableMouse()
        self.camera.setPos(0., -250., 130.)
        self.camera.setHpr(0., -30., 0.)

        # setup the lighting

        dir_light = DirectionalLight("dir_light")
        self.light = self.render.attachNewNode(dir_light)
        self.light.setColor((1., 1., 1., 1.))
        self.light.setHpr(45., -45., 0)
        self.render.setLight(self.light)

        # create the plane

        cm = CardMaker("plane")
        # set the size of the card (left, right, bottom, top - in XZ-plane)
        cm.setFrame(-100., 100., -100., 100.)
        self.plane = self.render.attachNewNode(cm.generate())
        # the card is created vertically in the XZ-plane, so it has to be rotated
        # to make it horizontal
        self.plane.setP(-90.)

        road_tex = self.loader.loadTexture("road_texture.png")
        self.plane.setTexture(road_tex)


app = MyApp()
app.run()

ok thank you very murch