WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Why I need two points for viz.startlayer(viz.POINTS) (https://forum.worldviz.com/showthread.php?t=3395)

jincheker 01-28-2011 06:59 AM

Why I need two points for viz.startlayer(viz.POINTS)
 
Hi, I want to show the points as mouse moves, and I program like below:

Code:

def plotGraph(x,y):
        viz.startlayer(viz.POINTS)
        viz.pointsize(5)
#        viz.vertexcolor(viz.RED)
#        viz.vertex(0,0,0)
        viz.vertexcolor(viz.BLACK)
        viz.vertex(x,y,0)
        line = viz.endlayer(viz.SCREEN)
        print 'plot',x,y

def onMouseMove(e):
        plotGraph(e.x,e.y)

viz.go()
viz.clearcolor(viz.SKYBLUE)
viz.callback(viz.MOUSE_MOVE_EVENT,onMouseMove)

The problem is if i comment
Code:

viz.vertexcolor(viz.RED)
viz.vertex(0,0,0)

The code won't work, but if I uncomment them, then it works.
Can anyone tell me why? Is it because startlayer needs at lease two points?

Thank you

farshizzo 01-28-2011 08:46 AM

OpenSceneGraph will cull objects that appear very small on screen. Since you have one point, it is computed as infinitely small on screen and not rendered. You can disable viz.CULLING on the node to prevent this from happening:
Code:

line.disable(viz.CULLING)


All times are GMT -7. The time now is 05:59 PM.

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