WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   texturing on-the-fly objects (https://forum.worldviz.com/showthread.php?t=344)

vr_boyko 05-11-2005 04:38 PM

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")

doesn't do it ... am I doing something wrong?

farshizzo 05-11-2005 05:06 PM

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'))



All times are GMT -7. The time now is 04:35 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC