converting from space to screen coordinates

hi, i am trying to convert two points that are used to render a line from space to screen points like this:

		  Label.pStartScreen=cam.WorldToScreenPoint(Label.startPoint);		  Label.pEndScreen=cam.WorldToScreenPoint(Label.endPoint);

then i tried to render them like this:

  line.SetPosition(0,Label.pStartScreen); 
  line.SetPosition(1, Label.pEndScreen);

but nothing happens

if i do this

  line.SetPosition(0,Label.startPoint); 
  line.SetPosition(1, Label.endPoint);

the line renders correctly but these are initial 3d points, so the line is rendered in world space…

i am using this to render the line and rectangle that will hold the information about object line points to, so rectangle obviously needs screen space coords, these are converted the same way as above and the Rect appears where it should…so i dont know what is going on here? any ideas?

also i tried this:

 GL.Begin(GL.LINES); 
  GL.Color(Color(1,1,1,1));
  GL.Vertex3(Label.pStartScreen.x,Label.pStartScreen.y,Label.pStartScreen.z);
  GL.Vertex3(Label.pEndScreen.x,Label.pEndScreen.y,Label.pEndScreen.z); 
 GL.End();

and it doesnt render anything
when i use startPoint and endPoint, which are in world space, then it renders nice
3D line… i dont know what is happening, this should render in the screen space…

Assuming the ‘line’ variable refrences a LineRenderer component: a LineRenderer works in world space, not screen space. You can control whether the line’s points are relative to the game object the renderer is attached to, or absolute (i.e. relative to world origin) but either way, the coordinates are in world space. That’s why you see results when you leave out the conversion from world to screen space.

What you’ll need to do is figure out where you want the lines to appear in screen space, then convert back to world space again.

i gave up using line renderer, i am back using OpenGl calls, but useful info, thanks for sharing