forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problems with newest GUM revision ??

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Sat Oct 22, 2005 10:15 pm    Post subject: Problems with newest GUM revision ?? Reply with quote

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
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Sun Oct 23, 2005 1:53 am    Post subject: Reply with quote

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
View user's profile Send private message
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Sun Oct 23, 2005 3:19 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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