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 

taking out functions, casting failures

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



Joined: 13 Sep 2007
Posts: 19
Location: Gorizia, ITALY

PostPosted: Sun Sep 16, 2007 1:04 pm    Post subject: taking out functions, casting failures Reply with quote

why in my code, having:
Code:

void DrawScene( void )
{
    sceGuStart( GU_DIRECT, dList );                   
    sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);     
    sceGumMatrixMode(GU_MODEL);                               

      //----- shape 1
     sceGumLoadIdentity();                                     
     {   
   ScePspFVector3 move = { 0.0f,-0.05f, -3.1f };
   sceGumTranslate( &move ); 
        sceGumRotateZ( 0.00f );   
      }
       
       sceGuTexImage(...);
       sceGumDrawArray(...);

      //----- shape 2

     sceGumLoadIdentity();                                     
     {   
   ScePspFVector3 move = { 0.0f,-0.05f, -3.1f };
   sceGumTranslate( &move ); 
        sceGumRotateZ( 0.00f );   
      }
       
       sceGuTexImage(...);
       sceGumDrawArray(...);
       
      //----- shape 3

     sceGumLoadIdentity();                                     
     {   
   ScePspFVector3 move = { 0.0f,-0.05f, -3.1f };
   sceGumTranslate( &move ); 
        sceGumRotateZ( 0.00f );   
      }
       
       sceGuTexImage(...);
       sceGumDrawArray(...);
       
   sceGuFinish();
   sceGuSync(0,0);
           
}


and I decide this is not professional and I made a common function this way:

Code:

void DrawScene( void )
{
    sceGuStart( GU_DIRECT, dList );                   
    sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);     
    sceGumMatrixMode(GU_MODEL);   

    ruspa_draw(shape1,texture1,0); 
    ruspa_draw(shape2,texture2,0);
    ruspa_draw(shape3,texture3,0);

    sceGuFinish();
    sceGuSync(0,0);
}

void ruspa_draw(Vertex shape,Image* texture,float rotation){
   
    sceGumLoadIdentity();                                     
        sceGuTexFilter( GU_LINEAR, GU_LINEAR );
       
      sceGuTexFilter( GU_LINEAR, GU_LINEAR );      
 
        {
      ScePspFVector3 move = { -0.03f,0.0f, -3.0f };
      
      sceGumTranslate( &move );                       
               
                sceGumRotateZ( rotation);            
       }
       
       sceGuTexImage( 0, texture->textureWidth, texture->textureHeight, texture->textureWidth,texture->data );
       sceGumDrawArray( GU_TRIANGLES, GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,3*2, 0, shape);
   
   
}



this is not gonna compile? says me that cannot convert Vertex* to nonscalar "Vertex"... (tried also to specify the full "Vertex __attribute__((aligned(16)))" in the prototype, same result)
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Sun Sep 16, 2007 4:45 pm    Post subject: Reply with quote

Quote:
Code:
void ruspa_draw(Vertex shape, ...

Surely you want
Code:
void ruspa_draw(Vertex *shape, ...

plus you'll need a prototype somewhere.
Silly mistake, or are you trying to learn C on the PSP? :)

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
ruspa



Joined: 13 Sep 2007
Posts: 19
Location: Gorizia, ITALY

PostPosted: Mon Sep 17, 2007 3:13 am    Post subject: Reply with quote

of course I set the prototype, I was used to code in C++ but abandoned it for very long. Hmm... I thought that if that was a vector also its definition should have the asterisk while in the example code there are no asterisk and no &s. Better for me to have a review of these basics.
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