#1
|
|||
|
|||
object on the fly--how to change color of particular vertex
With the following code, I created an object on-the-fly, a green polygon. Then I want to create a vertical transparent stripe, that is, set vertex 2 and 5 to be transparent. But the code doesn't work this way. Why? Thanks!
viz.startLayer(viz.POLYGON) viz.vertexColor(viz.GREEN) viz.vertex(0.0,0.0,0.0) viz.vertex(0.5,0.0,0.0) viz.vertex(0.6,0.0,0.0) viz.vertex(1.0,0.0,0.0) viz.vertex(1.0,1.0,0.0) viz.vertex(0.6,1.0,0.0) viz.vertex(0.5,1.0,0.0) viz.vertex(0.0,1.0,0.0) target=viz.endLayer() target.dynamic() target.setVertexColor(2,[0,0,1,0.2]) target.setVertexColor(5,[0,0,1,0.2]) |
#2
|
|||
|
|||
What I want to do is to vary transparency within an object. How to do that ?
|
#3
|
|||
|
|||
Many OpenGL drivers will internally break up POLYGON shapes into triangles. Try using QUADS instead.
Code:
viz.startLayer(viz.QUADS) viz.vertexColor(viz.GREEN) viz.vertex(0.0,0.0,0.0) viz.vertex(0.5,0.0,0.0) viz.vertex(0.5,1.0,0.0) viz.vertex(0.0,1.0,0.0) viz.vertex(0.5,0.0,0.0) viz.vertex(0.6,0.0,0.0) viz.vertex(0.6,1.0,0.0) viz.vertex(0.5,1.0,0.0) viz.vertex(0.6,0.0,0.0) viz.vertex(1.0,0.0,0.0) viz.vertex(1.0,1.0,0.0) viz.vertex(0.6,1.0,0.0) target=viz.endLayer() target.dynamic() target.setVertexColor(5,[0,0,1,0.2]) target.setVertexColor(6,[0,0,1,0.2]) target.setVertexColor(8,[0,0,1,0.2]) target.setVertexColor(11,[0,0,1,0.2]) |
Tags |
object on-the-fly, transparent, vertex |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can I change the text size of slider object? | jincheker | Vizard | 1 | 08-26-2011 12:20 PM |
Possible to change size of a vizshape.addBox object? | Renato Lima | Vizard | 1 | 10-18-2010 10:51 AM |
retrieve Object names | Geoffrey | Vizard | 11 | 12-11-2009 05:26 AM |
Randomly and Continuously Change Avatar's Face Texture | Karla | Vizard | 4 | 08-22-2008 01:14 PM |
get vertex with on the fly object | enkeli | Vizard | 9 | 05-25-2006 09:27 PM |