2D bitmap/texture hardware rotation?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
ddgFFco
Posts: 11
Joined: Tue Sep 20, 2005 5:35 pm

2D bitmap/texture hardware rotation?

Post by ddgFFco »

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.
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

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
Cogboy
Posts: 45
Joined: Wed Jan 19, 2005 3:45 pm

Post by Cogboy »

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.
ddgFFco
Posts: 11
Joined: Tue Sep 20, 2005 5:35 pm

Post by ddgFFco »

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: Select all

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
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

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).
ddgFFco
Posts: 11
Joined: Tue Sep 20, 2005 5:35 pm

Post by ddgFFco »

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.
fish
Posts: 25
Joined: Wed Feb 08, 2006 5:12 am

Post by fish »

AFAIK using SPRITE instead of TRIANGLE_FAN/STRIP always creates a screen aligned sprite, ie no rotation. I could be wrong though:p
Post Reply