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 

2D bitmap/texture hardware rotation?

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



Joined: 20 Sep 2005
Posts: 11

PostPosted: Sat Mar 25, 2006 6:23 am    Post subject: 2D bitmap/texture hardware rotation? Reply with quote

Hey I have the GU set up for 2d sprites (will provide GU setup/rendering code if it’s needed) but can’t figure out how to have it rotate them. I did write a software implementation but it’s turning out to be far too slow, so is there anyway to have the GU do this? Can anyone point me in the right direction? Thanks.
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Sat Mar 25, 2006 6:29 am    Post subject: Reply with quote

Setup the MODEL VIEW matrix for rotating your vertices. If you don't know how to do this, use gum's sceGumRotateX/Y/Z functions
Back to top
View user's profile Send private message Visit poster's website
Cogboy



Joined: 19 Jan 2005
Posts: 45

PostPosted: Sat Mar 25, 2006 6:33 am    Post subject: Reply with quote

Another alternative is to use the oldschool library available here
Its powerfull and easy to use. Can deform, scale, rotate with or without bilinear filtering.
_________________
"the sony PSP was built by god, to determine who on earth had the best skills to defeat the armies of satan" - Saint Peter.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
ddgFFco



Joined: 20 Sep 2005
Posts: 11

PostPosted: Sat Mar 25, 2006 8:09 am    Post subject: Reply with quote

Raphael wrote:
Setup the MODEL VIEW matrix for rotating your vertices. If you don't know how to do this, use gum's sceGumRotateX/Y/Z functions


Could you provide an example? I had a look through the SDK samples and they seam to use something similar to this but it dose absolutely nothing in my app (the samples all use GU_TRANSFORM_3D instead of GU_TRANSFORM_2D as well)

Code:

sceGumMatrixMode(GU_MODEL);
sceGumRotateZ(1.5);


Tried X/Y as well.

Cogboy wrote:
Another alternative is to use the oldschool library available here
Its powerfull and easy to use. Can deform, scale, rotate with or without bilinear filtering.


No thanks, the actual lib doesn’t seam to be open source and I like to know exactly whets happening in my app :P
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Sat Mar 25, 2006 8:43 am    Post subject: Reply with quote

ddgFFco wrote:

Could you provide an example? I had a look through the SDK samples and they seam to use something similar to this but it dose absolutely nothing in my app (the samples all use GU_TRANSFORM_3D instead of GU_TRANSFORM_2D as well)

That's why it won't work. You need GU_TRANSFORM_3D so that the Modelview matrix is actually applied. You'd also have to use a orthogonal projection then if you want to stay in 2D (look in gum for the appropriate function to setup ortho view. I think there also was a thread anywhere here about it).
Back to top
View user's profile Send private message Visit poster's website
ddgFFco



Joined: 20 Sep 2005
Posts: 11

PostPosted: Sat Mar 25, 2006 10:38 am    Post subject: Reply with quote

Never mind I got this to work by switching to GU_TRIANGLE_FAN in sceGuDrawArray and providing four vertices instead of two, rotating them manually and setting the texture coordinates as appropriate. Thanks for your help though Raphael.
Back to top
View user's profile Send private message
fish



Joined: 08 Feb 2006
Posts: 25

PostPosted: Sat Mar 25, 2006 11:02 pm    Post subject: Reply with quote

AFAIK using SPRITE instead of TRIANGLE_FAN/STRIP always creates a screen aligned sprite, ie no rotation. I could be wrong though:p
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