Linedrawing with 3D transform ??

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
sandberg
Posts: 90
Joined: Wed Oct 05, 2005 1:25 am
Location: Denmark

Linedrawing with 3D transform ??

Post by sandberg »

Hi guys,

I'm working on some code, which I for developing wants to render using lines. But I can't get it to work. I've tried more or less anything but without any luck.

I'm able to render lines using 2D transforms, but using 3D transforms nothing shows up on the screen.

Does anybody here have a clue about why this doesn't work ? Isn't it possible to use 3D transforms for lines ?

I've tried to disable culling and the depthbuffer aswell but no changes there.

My coordinates lies in the range shown below

Code: Select all

P1 : x=-1.000000, y=1.000000, z=0.000000
P2 : x=1.000000, y=1.000000, z=0.000000
P1 : x=-0.999010, y=0.999010, z=0.000000
P2 : x=0.999010, y=0.999010, z=0.000000
My structure for my coordinates (passed to sceGumDrawArray) is shown below.

Code: Select all

	struct Vertex
	{
		float x,y,z;
	};
The code for rendering the lines are shown below.

Code: Select all

	sceGumMatrixMode(GU_MODEL);
	sceGumLoadIdentity();

	sceGuColor(0xFFFFFFFF);

	/* Render springs */
	for &#40;int i = 0 ; i < nsprings ; i++&#41;
		&#123;
		p1 = cube_spring&#91;i&#93;.from;
		p2 = cube_spring&#91;i&#93;.to;

		struct Vertex* l_vertices = &#40;struct Vertex*&#41;sceGuGetMemory&#40;2 * sizeof&#40;struct Vertex&#41;&#41;;

		l_vertices&#91;0&#93;.x = cube_vertex&#91;p1&#93;.p.x;
		l_vertices&#91;0&#93;.y = cube_vertex&#91;p1&#93;.p.y;
		l_vertices&#91;0&#93;.z = cube_vertex&#91;p1&#93;.p.z;

		l_vertices&#91;1&#93;.x = cube_vertex&#91;p2&#93;.p.x;
		l_vertices&#91;1&#93;.y = cube_vertex&#91;p2&#93;.p.y;
		l_vertices&#91;1&#93;.z = cube_vertex&#91;p2&#93;.p.z;

		sceGumDrawArray&#40;GU_LINES, GU_VERTEX_32BITF | GU_TRANSFORM_3D, 2, 0, l_vertices&#41;;
		&#125;

Br, Sandberg
Post Reply