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 

[SOLVED] Textures don't show up with GU_TRANSFORM_3D

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



Joined: 12 Sep 2009
Posts: 79

PostPosted: Tue May 11, 2010 7:32 am    Post subject: [SOLVED] Textures don't show up with GU_TRANSFORM_3D Reply with quote

Thanks anyway, but it was an even stupider mistake than that. Tip: don't use unsigned ints interchangeably with signed ints. *sigh*


Whenever I try to draw using sceGumDrawArray with GU_TRANSFORM_3D, none of my textures are displayed, yet when I switch to _2D they are (but can't use the model/view matrices), and it seems the coordinates are okay because I can get textureless and wireframe models to work. I've gotten this to work in the past, but I can't remember how. It's probably just an option I forgot to enable, but can someone please give me a clue? :(

Here's one of the relevant snippets:
Code:
void Ship::Draw()
{
   pgeTextureActivate(ship);

   // *** This works fine, using GU_TRANSFORM_2D, but is not transformed properly.
   //pgeGfxDrawTextureEasy(ship, x, y, angle, 255);

   pgeVertTV *vert = (pgeVertTV*)pgeGfxGetVertexMemory(sizeof(pgeVertTV)*4);
   vert[0].u = 0;           vert[0].v = 0;
   vert[1].u = 0;           vert[1].v = ship->height;
   vert[2].u = ship->width; vert[2].v = ship->height;
   vert[3].u = ship->width; vert[3].v = 0;

   vert[0].x = -(ship->width>>1); vert[0].y = -(ship->height>>1); vert[0].z = 1;
   vert[1].x = -(ship->width>>1); vert[1].y =  (ship->height>>1); vert[1].z = 1;
   vert[2].x =  (ship->width>>1); vert[2].y =  (ship->height>>1); vert[2].z = -1;
   vert[3].x =  (ship->width>>1); vert[3].y = -(ship->height>>1); vert[3].z = -1;

   // *** This doesn't show up at all!
   sceGumMatrixMode(GU_MODEL);
   sceGumPushMatrix();
   ScePspFVector3 pos = { x, y, 0 };
   sceGumTranslate(&pos);
   sceGumRotateZ(angle);
   sceGumDrawArray(
                   GU_TRIANGLE_FAN, PGE_VERT_TV | GU_TRANSFORM_2D, 4, NULL, vert);
   sceGumPopMatrix();
}

_________________
PSP-2000 // CFW: 5.50 GEN-D2 ...and not upgrading until OFW supports homebrew!
(But I did downgrade to 1.50 with TimeMachine...)
"I want you to tell me how the machine makes you feel."
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