| View previous topic :: View next topic |
| Author |
Message |
ddgFFco
Joined: 20 Sep 2005 Posts: 11
|
Posted: Sat Mar 25, 2006 6:23 am Post subject: 2D bitmap/texture hardware rotation? |
|
|
| 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 |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Sat Mar 25, 2006 6:29 am Post subject: |
|
|
| 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 |
|
 |
Cogboy
Joined: 19 Jan 2005 Posts: 45
|
Posted: Sat Mar 25, 2006 6:33 am Post subject: |
|
|
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 |
|
 |
ddgFFco
Joined: 20 Sep 2005 Posts: 11
|
Posted: Sat Mar 25, 2006 8:09 am Post subject: |
|
|
| 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 |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Sat Mar 25, 2006 8:43 am Post subject: |
|
|
| 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 |
|
 |
ddgFFco
Joined: 20 Sep 2005 Posts: 11
|
Posted: Sat Mar 25, 2006 10:38 am Post subject: |
|
|
| 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 |
|
 |
fish
Joined: 08 Feb 2006 Posts: 25
|
Posted: Sat Mar 25, 2006 11:02 pm Post subject: |
|
|
| 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 |
|
 |
|