Discuss the development of new homebrew software, tools and libraries.
Moderators: cheriff , TyRaNiD
su-27k
Posts: 12 Joined: Thu Nov 16, 2006 8:31 pm
Post
by su-27k » Fri Jan 05, 2007 3:48 am
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: Select all
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
hlide
Posts: 739 Joined: Sun Sep 10, 2006 2:31 am
Post
by hlide » Fri Jan 05, 2007 5:30 am
su-27k wrote: Hi...
Code: Select all
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)
su-27k
Posts: 12 Joined: Thu Nov 16, 2006 8:31 pm
Post
by su-27k » Fri Jan 05, 2007 7:09 pm
hlide wrote: su-27k wrote: Hi...
Code: Select all
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: Select all
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 -_-'''''
su-27k
Posts: 12 Joined: Thu Nov 16, 2006 8:31 pm
Post
by su-27k » Fri Jan 05, 2007 8:04 pm
Code: Select all
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
hlide
Posts: 739 Joined: Sun Sep 10, 2006 2:31 am
Post
by hlide » Fri Jan 05, 2007 10:26 pm
pVertex.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.
su-27k
Posts: 12 Joined: Thu Nov 16, 2006 8:31 pm
Post
by su-27k » Fri Jan 05, 2007 11:58 pm
hlide wrote: pVertex.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.
;)
hlide
Posts: 739 Joined: Sun Sep 10, 2006 2:31 am
Post
by hlide » Sat Jan 06, 2007 12:30 am
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 !
su-27k
Posts: 12 Joined: Thu Nov 16, 2006 8:31 pm
Post
by su-27k » Sat Jan 06, 2007 12:58 am
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 :)