Problems with newest GUM revision ??

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

Problems with newest GUM revision ??

Post by sandberg »

Hi guys,

I've just updated the pspsdk, which updated a lot of the gu and gum files. But now I'm having problems with my code ? It seems like it translates before it rotates. So that my objects are flying around the screen ?

Have anybody else have had this problem ? Or could someone try and update the pspsdk and build their applications again.

EDIT : I just tried downgrading to revision 1164 and that works fine, so it is something which has been changed from that revision up to revision 1195.

I've added a simple example below, which just render a couple of cubes, which are all centered around the center (0,0,0).

Code: Select all

	sceGumMatrixMode(GU_PROJECTION);
	sceGumLoadIdentity();
	sceGumPerspective(75.0f,16.0f/9.0f,0.5f,1000.0f);

	sceGumMatrixMode(GU_VIEW);
	sceGumLoadIdentity();

	// setup matrices for cube
	for &#40;int count = 0 ; count < CUBE_COUNT ; count++&#41;
		&#123;
		/* Draw cube */
		sceGumMatrixMode&#40;GU_MODEL&#41;;
		sceGumLoadIdentity&#40;&#41;;
			&#123;
			ScePspFVector3 pos = &#123; -1*CUBE_COUNT/2+count, 0, -4.5f &#125;;
			ScePspFVector3 rot = &#123; 	val * 0.59f * &#40;GU_PI/180.0f&#41; / 2.0f,
						val * 0.78f * &#40;GU_PI/180.0f&#41; / 2.0f, 
						val * 1.12f * &#40;GU_PI/180.0f&#41; / 2.0f&#125;;
			sceGumRotateXYZ&#40;&rot&#41;;
			sceGumTranslate&#40;&pos&#41;;
			&#125;
		sceGumDrawArray&#40;GU_TRIANGLES, GU_COLOR_8888|GU_NORMAL_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_3D, 12*3, 0, &#58;&#58;vertices&#41;;
		&#125;

Br, Sandberg
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

I've tracked down multiple bugs within GUM in the last few days, which changed the way the GUM operates, and one of them was that the matrix-multiply which caused the operations to happen in reverse order. Look over what you're doing differently from how the samples operates. I've fixed the cube-sample to use the proper order now aswell.

Thinks of it as coordinate systems. When you do sceGumTranslate(...), you move into a new coordinate system. What you now do inside of that system is local, so sceGumRotateXYZ(...) would rotate around the point in space that your translate previously moved to.

If you do as in your example, you would first rotate the coordinate system, and then translate using the new transform, and it's not what you want. Reverse the order of the operations and it should be OK.
GE Dominator
sandberg
Posts: 90
Joined: Wed Oct 05, 2005 1:25 am
Location: Denmark

Post by sandberg »

Thanks chp,

I just update the repository to :HEAD, modified my code and it all work smooth now. You just saved my endless hours of debuggind :)
Br, Sandberg
Post Reply