 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
ruspa
Joined: 13 Sep 2007 Posts: 19 Location: Gorizia, ITALY
|
Posted: Sun Sep 16, 2007 1:04 pm Post subject: taking out functions, casting failures |
|
|
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 |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Sun Sep 16, 2007 4:45 pm Post subject: |
|
|
| 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 |
|
 |
ruspa
Joined: 13 Sep 2007 Posts: 19 Location: Gorizia, ITALY
|
Posted: Mon Sep 17, 2007 3:13 am Post subject: |
|
|
| 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 |
|
 |
|
|
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
|