#1
|
|||
|
|||
2d Map with Lines between points, help!
Hello everybody!
I'm a beginner in Vizard and I'm currently trying to create a visualization using a map. Basically what I have is a 2d map and a set of points(from the map) I want to draw lines inbetween. The issue is that my points that I use for the lines are based on the texture coordinates of the map itself so that when I try to create vertices using these points they show up at the typical X, Y, Z coordinate system of Vizard instead of "on" the map. My vision for this is to have the map and then see the lines in front of the map. Currently I have the map and then the lines elsewhere in the world. Does anybody have any pointers / solutions for this? How would I solve this matter the best way? Is it possible? M12 |
#2
|
|||
|
|||
You can use on-the-fly objects to create the points and lines then add them to a texture quad that is displaying the map. Here is an example:
Code:
import viz viz.go() # Points in texture coordinate system POINTS = [ (0.1,0.2) , (0.9,0.2) , (0.5,0.8) ] # Lines in texture coordinate system LINES = [ [(0.1,0.2), (0.9,0.2)] , [(0.1,0.2), (0.5,0.8)] , [(0.5,0.8), (0.9,0.2)] ] # Load map texture texture = viz.addTexture('ball.jpg') # Create quad to display texture quad = viz.addTexQuad(texture=texture, pos=(0,1.5,3)) quad.zoffset(1,1) # Create points and lines viz.startLayer(viz.POINTS) viz.vertexColor(viz.YELLOW) viz.pointSize(3) for p in POINTS: viz.vertex(p[0]-0.5, p[1]-0.5, 0) viz.startLayer(viz.LINES) viz.vertexColor(viz.GREEN) for l1,l2 in LINES: viz.vertex(l1[0]-0.5, l1[1]-0.5, 0) viz.vertex(l2[0]-0.5, l2[1]-0.5, 0) # Add points/lines to quad viz.endLayer(parent=quad) |
#3
|
|||
|
|||
Hello Farshizzo,
Thank you for the example. Regarding loading a map onto a texture, is that only possible with TexQuads? I tried to do it with a quad I made in a Layer(QUADS) and could not wrap my texture onto it (it became white), but it worked fine with TexQuad. Here is what I tried: Code:
viz.startLayer(viz.QUADS) viz.vertex(0,0,0) viz.vertex(2048,0,0) viz.vertex(2048,0,2048) viz.vertex(0,0,2048) mapQuad = viz.endLayer() texture = viz.addTexture('1.png') mapQuad.texture = texture Do you know if that is possible? Are TexQuads customizable in that manner? Thank you, M12 |
#4
|
|||
|
|||
Hello again,
I've tried the following too: Code:
viz.startLayer(viz.QUADS) viz.vertex(0,0,0) viz.vertex(2048,0,0) viz.vertex(2048,0,2048) viz.vertex(0,0,2048) mapQuad = viz.endLayer() mapQuad.zoffset(1,1) mapQuad.texture(viz.add('1.png')) |
#5
|
|||
|
|||
Hey again,
Sorry for so many replies in a row. I realized that I had forgotten my texcoords in front of my vertices, I fixed it and now I can see the map image. Thanks! M12 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Create an arc between two points | hotshotiguana | Vizard | 5 | 03-22-2012 11:07 AM |
black lines with render to texture | Darkmax | Vizard | 5 | 03-07-2011 11:23 AM |
Why I need two points for viz.startlayer(viz.POINTS) | jincheker | Vizard | 1 | 01-28-2011 08:46 AM |
Draw Line between Points | Chrissy2009 | Vizard | 2 | 05-13-2009 04:42 AM |
Track Eye Gaze with Lines | enkeli | Vizard | 1 | 05-02-2006 02:06 PM |