![]() |
|
#1
|
|||
|
|||
|
texturing on-the-fly objects
I would like to apply a simple texture to an on-the-fly QUAD:
Code:
viz.startlayer(viz.QUADS)
viz.vertex(-.5,0,0)
viz.vertex(.5,0,0)
viz.vertex(.5,-DELTA,11)
viz.vertex(-.5,-DELTA,11)
plank = viz.endlayer()
plank.texture("wood.gif")
|
|
#2
|
|||
|
|||
|
Hi,
Two problems. First, for each vertex you need to define a texture coordinate. Second, you need to add the texture before you apply it to an object. Sample code: Code:
viz.startlayer(viz.QUADS)
#Lower left vertex
viz.texcoord(0,0)
viz.vertex(...)
#Upper left vertex
viz.texcoord(0,1)
viz.vertex(...)
#Upper right vertex
viz.texcoord(1,1)
viz.vertex(...)
#Lower right vertex
viz.texcoord(1,0)
viz.vertex(...)
plank = viz.endlayer()
plank.texture(viz.add('wood.gif'))
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|