can't see lines

Apr 5, 2011 at 12:43 PM

When I draw my own geometry, I can't see any lines I draw. Faces work fine.

I add vertices and lines using FullDetailLevel.SetVertex() and FullDetailLevel.SetLine(), but the lines are not shown.

I read some issues on lightning in previous versions. Is this related?

Gr, Sander

Apr 8, 2011 at 9:58 AM
Edited Apr 8, 2011 at 10:12 AM

Maybe I should provide some code (see below). I am using Balder version 0.8.8.9. I have also used a self-compiled newer version (rev. 851), with the same problem.

What am I missing?

Gr, Sander

 

<Execution:Game Name="myBalderGameObject" Width="640" Height="480">
	<Execution:Game.Camera>
		<View:Camera Name="myCamera" Position="0,0,-20" />
	</Execution:Game.Camera>
	<Lighting:OmniLight Position="0,2,-10" Strength="1" Diffuse="White" Specular="White" />
	<Custom:MyGeometry x:Name="myGeometry" Color="Blue"/>
</Execution:Game>
public class MyGeometry : Balder.Objects.Geometries.Geometry
{
	public MyGeometry()
		: base()
	{
	}

	public override void Prepare(Balder.Display.Viewport viewport)
	{
		DrawLine();
	}

	public void DrawLine()
	{
		// drawing small boxes here
		FullDetailLevel.AllocateVertices(2);
		FullDetailLevel.SetVertex(0, new Vertex(0, 0, 0));
		FullDetailLevel.SetVertex(1, new Vertex(10, 0, 0));

		FullDetailLevel.AllocateLines(1);
		FullDetailLevel.SetLine(0, new Line(0, 1));

		GeometryHelper.CalculateNormals(FullDetailLevel);
	}
}


Apr 8, 2011 at 10:06 AM

Hi, Sanderl

Have you taken a look at this example : http://www.ingebrigtsen.info/post/2010/08/01/Balder-Tutorial-Creating-a-Mesh-programatically.aspx

Take a look at the Prepare override.

Stuart

Apr 8, 2011 at 10:14 AM
Edited Apr 8, 2011 at 12:02 PM

Hi StuartTrez,

Yes, I have. Actually, my original code does include the Prepare override (changed it in my example above).

I'm having the same problem with the example in your link.

Gr, Sander

Apr 8, 2011 at 10:50 AM

Hi sanderl,

I have just run through the code you have posted and it seems to be working fine ! If you want to send me over you full code I will take a look for you.

Stuart 

Apr 8, 2011 at 12:09 PM

Thanks for your helpfulness, StuartTrez. In my attempt to provide you my code, I found out that my simplified example did work!

The problem was that I had a second custom geometry class (containing a plane/face), which was located below the line geometry in my XAML, and was therefore drawn after the line was drawn, blocking my line (even though it was actually located behind the line in 3D space).

Gr, Sander

Apr 8, 2011 at 12:34 PM

np, Glad to help. I suggest you use the latest source and build Balder yourself (if you are not already)  as it has a lot of Culling and Clipping fixes in it.