forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SCEGU_VERTEX_SHORT

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
su-27k



Joined: 16 Nov 2006
Posts: 12

PostPosted: Fri Jan 05, 2007 3:48 am    Post subject: SCEGU_VERTEX_SHORT Reply with quote

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
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Fri Jan 05, 2007 5:30 am    Post subject: Re: SCEGU_VERTEX_SHORT Reply with quote

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
View user's profile Send private message
su-27k



Joined: 16 Nov 2006
Posts: 12

PostPosted: Fri Jan 05, 2007 7:09 pm    Post subject: Re: SCEGU_VERTEX_SHORT Reply with quote

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
View user's profile Send private message
su-27k



Joined: 16 Nov 2006
Posts: 12

PostPosted: Fri Jan 05, 2007 8:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Fri Jan 05, 2007 10:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
su-27k



Joined: 16 Nov 2006
Posts: 12

PostPosted: Fri Jan 05, 2007 11:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Sat Jan 06, 2007 12:30 am    Post subject: Reply with quote

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
View user's profile Send private message
su-27k



Joined: 16 Nov 2006
Posts: 12

PostPosted: Sat Jan 06, 2007 12:58 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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