 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
sandberg
Joined: 05 Oct 2005 Posts: 90 Location: Denmark
|
Posted: Sat Oct 22, 2005 10:15 pm Post subject: Problems with newest GUM revision ?? |
|
|
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: |
sceGumMatrixMode(GU_PROJECTION);
sceGumLoadIdentity();
sceGumPerspective(75.0f,16.0f/9.0f,0.5f,1000.0f);
sceGumMatrixMode(GU_VIEW);
sceGumLoadIdentity();
// setup matrices for cube
for (int count = 0 ; count < CUBE_COUNT ; count++)
{
/* Draw cube */
sceGumMatrixMode(GU_MODEL);
sceGumLoadIdentity();
{
ScePspFVector3 pos = { -1*CUBE_COUNT/2+count, 0, -4.5f };
ScePspFVector3 rot = { val * 0.59f * (GU_PI/180.0f) / 2.0f,
val * 0.78f * (GU_PI/180.0f) / 2.0f,
val * 1.12f * (GU_PI/180.0f) / 2.0f};
sceGumRotateXYZ(&rot);
sceGumTranslate(&pos);
}
sceGumDrawArray(GU_TRIANGLES, GU_COLOR_8888|GU_NORMAL_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_3D, 12*3, 0, ::vertices);
}
|
_________________ Br, Sandberg |
|
| Back to top |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Sun Oct 23, 2005 1:53 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
sandberg
Joined: 05 Oct 2005 Posts: 90 Location: Denmark
|
Posted: Sun Oct 23, 2005 3:19 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|