FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

md2 problem!

4 posters

Go down

md2 problem! Empty md2 problem!

Post  LuisLee Thu May 07, 2009 3:47 am

I will load md2 model,but it not work! why?
there is my code:
loading function:
SIO2stream *_SIO2stream1 = sio2StreamOpen( "woman.md2", 1 );
{
// Initialize the handle
_SIO2md2 = sio2Md2Init( "woman.md2" );
sio2Md2Load( _SIO2md2, _SIO2stream1 );
_SIO2md2->_SIO2transform->scl->x = 0.031f;
_SIO2md2->_SIO2transform->scl->y = 0.031f;
_SIO2md2->_SIO2transform->scl->z = 0.031f;
sio2TransformBindMatrix( _SIO2md2->_SIO2transform );
}
_SIO2stream1 = sio2StreamClose( _SIO2stream1 );

Render function:
sio2WindowEnterLandscape3D();
{
sio2Md2Render( _SIO2md2,
sio2->_SIO2window, 1 );
}
sio2WindowLeaveLandscape3D();

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  Francescu Thu May 07, 2009 8:17 am

In loading function, after sio2TransformBindMatrix()
sio2Md2Play( _SIO2md2, 1 );

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 9:14 am

Francescu wrote:In loading function, after sio2TransformBindMatrix()
sio2Md2Play( _SIO2md2, 1 );

Thank you! I am try,but fail. The breakpoint at sio2Md2Render() function.

glDrawArrays( GL_TRIANGLES, 0, _SIO2md2->_SIO2md2header.num_tris * 3 );



Neutral

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  Francescu Thu May 07, 2009 9:28 am

Try listing the MD2 frames in the console after loading such as:

unsigned int i = 0;

while( i != _SIO2md2->_SIO2md2header.num_frames )
{
printf("%d: %s\n", i, _SIO2md2->_SIO2md2frame[ i ].name );
++i;
}

Also, you might need to set some first action of your MD2 explicitly (am not sure at all of this but you should try) such as:

// Activate the action name
sio2Md2SetAction( _SIO2md2, actionName );

Are you building some actions manually like in tutorial14?

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 9:45 am

Francescu wrote:Try listing the MD2 frames in the console after loading such as:

unsigned int i = 0;

while( i != _SIO2md2->_SIO2md2header.num_frames )
{
printf("%d: %s\n", i, _SIO2md2->_SIO2md2frame[ i ].name );
++i;
}

Also, you might need to set some first action of your MD2 explicitly (am not sure at all of this but you should try) such as:

// Activate the action name
sio2Md2SetAction( _SIO2md2, actionName );

Are you building some actions manually like in tutorial14?

my md2 files have not actions, I just want to render the model only.Not animated。
I do not know how to do。

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 9:52 am

By the way, how to separate loading Models of texture? my model have not texture, don't use blender? Surprised

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  oioioi Thu May 07, 2009 11:01 am

Why would you use md2 if your model isn't animated? It makes no sense

oioioi

Posts : 136
Join date : 2008-12-02
Location : Norway

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 7:10 pm

oioioi wrote:Why would you use md2 if your model isn't animated? It makes no sense
yes!The tutorial14 want to use blender. I would like loading a separate model and texture 。How to do this? Smile

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  sio2interactive Thu May 07, 2009 7:28 pm

MD2 loading with SIO2 have nothing to do with blender...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 7:41 pm

sio2interactive wrote:MD2 loading with SIO2 have nothing to do with blender...

int the tutorial14 Scenes, there is a cylinder,which was coupled with a mapping。How it is going on? Shocked
It is used to calculate the collision, is it? But why it was added in this map?
Question

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  sio2interactive Thu May 07, 2009 8:18 pm

You have to understand that the collision bound and the model is 2 different things... The tutorial show you how to link a collision object to another model... so you won't have to do collision test with the detailed model.
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 8:37 pm

sio2interactive wrote:You have to understand that the collision bound and the model is 2 different things... The tutorial show you how to link a collision object to another model... so you won't have to do collision test with the detailed model.

Yes! What you said is correct!I do not have the demo in the collision, I is clear.However, I would like to find out is: how to separate into md2 scene? it does not have animation.I improved my code,like this:
loading function:
SIO2stream *_SIO2stream1 = sio2StreamOpen( "woman.md2", 1 );
{
// Initialize the handle
_SIO2md2 = sio2Md2Init( "woman.md2" );
pMd2image= sio2ImageInit( "womantexture.png" );
_SIO2md2->_SIO2material=sio2MaterialInit( "womantexture.png" );
sio2Md2Load( _SIO2md2, _SIO2stream1 );
_SIO2md2->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ] = pMd2image;
_SIO2md2->_SIO2transform->scl->x = 0.031f;
_SIO2md2->_SIO2transform->scl->y = 0.031f;
_SIO2md2->_SIO2transform->scl->z = 0.031f;
sio2TransformBindMatrix( _SIO2md2->_SIO2transform );
}
_SIO2stream1 = sio2StreamClose( _SIO2stream1 );
Render function:
sio2WindowEnterLandscape3D();
{sio2Md2Render( _SIO2md2, sio2->_SIO2window, 1 );}
sio2WindowLeaveLandscape3D();

In the run-time errors!

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  sio2interactive Thu May 07, 2009 9:04 pm

Make sure that the PNG is not compressed by XCode, browse this forum for more info...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 9:11 pm

sio2interactive wrote:Make sure that the PNG is not compressed by XCode, browse this forum for more info...

that the PNG is not compressed by XCode,Texture size 256x256.Unable to work!

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 9:11 pm



Last edited by LuisLee on Thu May 07, 2009 9:26 pm; edited 1 time in total

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 9:12 pm

sio2interactive wrote:Make sure that the PNG is not compressed by XCode, browse this forum for more info...

that the PNG is not compressed by XCode,Texture size 256x256.Unable to work!

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  sio2interactive Thu May 07, 2009 9:32 pm

Im pretty sure that you are missing something... the one used in tutorial14 is also a PNG at 256x256... where GDB breaks?
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 9:44 pm

sio2interactive wrote:Im pretty sure that you are missing something... the one used in tutorial14 is also a PNG at 256x256... where GDB breaks?

Breakpoint in the sio2Md2Render() function,

at the

glDrawArrays( GL_TRIANGLES, 0, _SIO2md2->_SIO2md2header.num_tris * 3 );

Blender useless software, I set up scenes and sio2 not read any blender file, only to let the mixed 2d and 3d.
Smile

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  sio2interactive Thu May 07, 2009 9:55 pm

Blender useless software, I set up scenes and sio2 not read any blender file, only to let the mixed 2d and 3d.

>> Dude you can easily mix 2D and 3D with SIO2...

glDrawArrays( GL_TRIANGLES, 0, _SIO2md2->_SIO2md2header.num_tris * 3 );

>> Have you set the proper client states?
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Thu May 07, 2009 11:06 pm

sio2interactive wrote:Blender useless software, I set up scenes and sio2 not read any blender file, only to let the mixed 2d and 3d.

>> Dude you can easily mix 2D and 3D with SIO2...

glDrawArrays( GL_TRIANGLES, 0, _SIO2md2->_SIO2md2header.num_tris * 3 );

>> Have you set the proper client states?

sorry,I don't set the proper client states.I am not very clear what you mean。would you please say it in detail? Very Happy
but I use state like this:
sio2WindowEnterLandscape3D();
{ draw something; }
sio2WindowLeaveLandscape3D();
sio2WindowEnter2D( );
{
sio2WindowEnterLandscape2D( sio2->_SIO2window );
{
draw something;
}
sio2WindowLeaveLandscape2D( sio2->_SIO2window );

}
sio2WindowLeave2D();

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  LuisLee Fri May 08, 2009 2:08 am

ok,it work!Thank you very much! but want to change code. Smile

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

md2 problem! Empty Re: md2 problem!

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum