 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
su-27k
Joined: 16 Nov 2006 Posts: 12
|
Posted: Fri Jan 05, 2007 3:48 am Post subject: SCEGU_VERTEX_SHORT |
|
|
Hi...
I've been doing basic procedure to draw primitive with short vertex,but after 2 days i don't know why it dosn't work
| Code: |
typedef struct
{
int n;
short x,y,z,pad;
} Vertex;
void Draw(){
if (mtx){PushMTx()}
Vertex pVertex[3];
pVertex[0].n=pVertex[1].n=pVertex[2].n=32756;
pVertex[0].y=pVertex[1].y=pVertex[2].y= 0;
pVertex[0].x=-3756;pVertex[0].z= 9527;
pVertex[1].x= 3756;pVertex[1].z= 9527;
pVertex[2].x=0; pVertex[2].z= 1000;
sceGuDrawArray(SCEGU_PRIM_TRIANGLES, SCEGU_NORMAL_BYTE|SCEGU_VERTEX_FLOAT ,3, NULL, pVertex);
if (mtx){
PopMtx();
}
} |
displaylist mode isn't in SCEGU_IMMEDIATE mode,so i havn't incoherency between DCACHE and memory.
if vertex type is FLOAT,the draw work good,so where i mistake?
thanke you and sorry for my english |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Fri Jan 05, 2007 5:30 am Post subject: Re: SCEGU_VERTEX_SHORT |
|
|
| su-27k wrote: | Hi...
| Code: |
sceGuDrawArray(SCEGU_PRIM_TRIANGLES, SCEGU_NORMAL_BYTE|SCEGU_VERTEX_FLOAT ,3, NULL, pVertex);
|
|
SCEGU_VERTEX_FLOAT is definately wrong !
something like SCEGU_VERTEX_SHORT would probably be better :o) |
|
| Back to top |
|
 |
su-27k
Joined: 16 Nov 2006 Posts: 12
|
Posted: Fri Jan 05, 2007 7:09 pm Post subject: Re: SCEGU_VERTEX_SHORT |
|
|
| hlide wrote: | | su-27k wrote: | Hi...
| Code: |
sceGuDrawArray(SCEGU_PRIM_TRIANGLES, SCEGU_NORMAL_BYTE|SCEGU_VERTEX_FLOAT ,3, NULL, pVertex);
|
|
SCEGU_VERTEX_FLOAT is definately wrong !
something like SCEGU_VERTEX_SHORT would probably be better :o) |
no asd :(
i have mistek to copy code.
my problem is
| Code: |
typedef struct
{
int n;
short x,y,z,pad;
} Vertex;
void Draw(){
if (mtx){PushMTx()}
Vertex pVertex[3];
pVertex[0].n=pVertex[1].n=pVertex[2].n=32756;
pVertex[0].y=pVertex[1].y=pVertex[2].y= 0;
pVertex[0].x=-3756;pVertex[0].z= 9527;
pVertex[1].x= 3756;pVertex[1].z= 9527;
pVertex[2].x=0; pVertex[2].z= 1000;
sceGuDrawArray(SCEGU_PRIM_TRIANGLES, SCEGU_NORMAL_BYTE|SCEGU_VERTEX_SHORT ,3, NULL, pVertex);
if (mtx){
PopMtx();
}
} |
this code don't work and i don't know where is the problem -_-''''' |
|
| Back to top |
|
 |
su-27k
Joined: 16 Nov 2006 Posts: 12
|
Posted: Fri Jan 05, 2007 8:04 pm Post subject: |
|
|
| Code: | typedef struct
{
byte nx,ny,nz;
byte pad;
short x,y,z;
} Vertex;
void Draw(){
if (mtx){PushMTx()}
Vertex pVertex[3];
pVertex[0].n=pVertex[1].n=pVertex[2].n=32756;
pVertex[0].y=pVertex[1].y=pVertex[2].y= 0;
pVertex[0].x=-3756;pVertex[0].z= 9527;
pVertex[1].x= 3756;pVertex[1].z= 9527;
pVertex[2].x=0; pVertex[2].z= 1000;
sceGuDrawArray(SCEGU_PRIM_TRIANGLES, SCEGU_NORMAL_BYTE|SCEGU_VERTEX_SHORT ,3, NULL, pVertex);
if (mtx){
PopMtx();
}
} |
i have changed some allinement but it dosen't work |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Fri Jan 05, 2007 10:26 pm Post subject: |
|
|
pVertex[i].n = 0x7FF4 !? (32756)
are you sure about this value ?
what are values of nx, ny and nz exactly ?
it looks something like [-12, 128, 0] or even worse [0, 0, 128] probably because of little endianness of allegrex.
your source code doesn't fit with your last type definition of Vertex, do you know ? you should be more precise. |
|
| Back to top |
|
 |
su-27k
Joined: 16 Nov 2006 Posts: 12
|
Posted: Fri Jan 05, 2007 11:58 pm Post subject: |
|
|
| hlide wrote: | pVertex[i].n = 0x7FF4 !? (32756)
are you sure about this value ?
what are values of nx, ny and nz exactly ?
it looks something like [-12, 128, 0] or even worse [0, 0, 128] probably because of little endianness of allegrex.
your source code doesn't fit with your last type definition of Vertex, do you know ? you should be more precise. |
i know that my code dosn't fit my last definition of Vertex sorry but the problem is another.
SCEGU_VERTEX_SHORT indicate model coordinate to 16 bit fixed point,3756 fixed point is little,it's eugual to less then 1.
;) |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Sat Jan 06, 2007 12:30 am Post subject: |
|
|
| i'm speaking about the normal vertex not the position vertex ! it doesn't fit your typedef Vertex. If you don't give the exact code, don't expect people to help you very much ! |
|
| Back to top |
|
 |
su-27k
Joined: 16 Nov 2006 Posts: 12
|
Posted: Sat Jan 06, 2007 12:58 am Post subject: |
|
|
| hlide wrote: | | i'm speaking about the normal vertex not the position vertex ! it doesn't fit your typedef Vertex. If you don't give the exact code, don't expect people to help you very much ! |
sorry and thanke you for help
next time i will be more careful
byezz :) |
|
| Back to top |
|
 |
|
|
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
|