| View previous topic :: View next topic |
| Author |
Message |
sigutis
Joined: 21 Mar 2009 Posts: 7
|
Posted: Thu Mar 26, 2009 7:32 pm Post subject: sceGumRotateX problem |
|
|
Hello, I am trying to rotate an image like this
| Code: |
vertices[0].u = minx;
vertices[0].v = miny;
vertices[0].color = 0;
vertices[0].x = playerX;
vertices[0].y = playerY;
vertices[0].z = 0;
vertices[1].u = minx;
vertices[1].v = miny+maxy;
vertices[1].color = 0;
vertices[1].x = playerX;
vertices[1].y = playerY+maxy;
vertices[1].z = 0;
vertices[2].u = minx+maxx;
vertices[2].v = miny;
vertices[2].color = 0;
vertices[2].x = playerX+maxx;
vertices[2].y = playerY;
vertices[2].z = 0;
vertices[3].u = minx+maxx;
vertices[3].v = miny+maxy;
vertices[3].color = 0;
vertices[3].x = playerX+maxx;
vertices[3].y = playerY+maxy;
vertices[3].z = 0;
sceGumLoadIdentity();
sceGumRotateX(50.0f);
sceGuDrawArray(GU_TRIANGLE_STRIP,GU_TEXTURE_16BIT|GU_COLOR_8888|GU_VERTEX_16BIT|GU_TRANSFORM_2D,4,0,vertices);
|
However I can see only half of my image and it is not rotated whatsoever. I am missing anything here? |
|
| Back to top |
|
 |
Noware
Joined: 03 Jan 2009 Posts: 1
|
Posted: Fri Mar 27, 2009 4:20 am Post subject: |
|
|
update the angle
sceGumLoadIdentity();
static float angle = 0.0f;
angle+= 1.0f;
sceGumRotateX(angle);
Noware _________________ Reporter - What do you think of western civilization?
Gandhi - I think it would be a good idea! |
|
| Back to top |
|
 |
sigutis
Joined: 21 Mar 2009 Posts: 7
|
Posted: Fri Mar 27, 2009 6:30 am Post subject: |
|
|
| I figured I have to set GU_TRANSFORM_2D to GU_TRANSFORM_3D but now I can't see anything. The further the better.... |
|
| Back to top |
|
 |
Smong
Joined: 04 Sep 2007 Posts: 82
|
Posted: Fri Mar 27, 2009 7:38 am Post subject: |
|
|
You don't want to use GU_TEXTURE_16BIT and GU_VERTEX_16BIT in GU_TRANSFORM_3D mode unless you prescale your vertices. It would be a lot easier to use the 32BITF versions. _________________ (+[__]%) |
|
| Back to top |
|
 |
sigutis
Joined: 21 Mar 2009 Posts: 7
|
Posted: Fri Mar 27, 2009 4:21 pm Post subject: |
|
|
I see. Well, there's one thing bothering me about the 32BITF vertices. I am currently using a vertex struct size of 16 bytes in the 16BIT mode. If I was to use 32BITF logically I need a vertex structure of 32 byte size. And I have no idea what could I put in there to double the size.
| Code: |
struct Vertex
{
unsigned int u, v; //texture coordinates
unsigned int color; //color which I don't use
int x, y, z; //coords
long a,b; //useless variables to fit into the 32 byte range
};
|
I have no idea how else could I make a 32 byte vertex, do you? |
|
| Back to top |
|
 |
Smong
Joined: 04 Sep 2007 Posts: 82
|
Posted: Sat Mar 28, 2009 7:42 am Post subject: |
|
|
Have a look at samples/gu/common/geometry.h
For 32BITF you want something like:
| Code: | struct Vertex
{
float u, v;
float x, y, z;
}; |
You said you don't use the color so just take GU_COLOR_8888 out of the sceGuDrawArray call.
32BITF means 32 bit float, so that's just a float, not a double. It doesn't mean the vertex struct is 32 bytes, but it may coincidentally be that size. _________________ (+[__]%) |
|
| Back to top |
|
 |
sigutis
Joined: 21 Mar 2009 Posts: 7
|
Posted: Sun Mar 29, 2009 3:34 am Post subject: |
|
|
| Thanks for the help I really appreciate it. I have done some tweaking using the information you guys provided, but it seems that hardware rotation is just not for me. I switched to manually rotating those vertexes with some trigonometry. Take care. |
|
| Back to top |
|
 |
Smong
Joined: 04 Sep 2007 Posts: 82
|
Posted: Sun Mar 29, 2009 5:10 am Post subject: |
|
|
You could have a look at the ortho sample included in pspsdk. It draws a triangle and rotates it. _________________ (+[__]%) |
|
| Back to top |
|
 |
|