Strange behavior of object and lamp during rotation

View previous topic View next topic Go down

Strange behavior of object and lamp during rotation

Post  meteors on Sat Nov 15, 2008 6:11 am

Greetings,

I love SIO2 by the way.

I have adapted Tutorial2, and have exported materials and also a lamp into the scene. Strangely, when the object is rotated in templateScreenTouchMove(), the model goes dark when rotated 180 degrees. It seems to be maybe a matrix problem.

Whats the best way to deal with this?


Thanks!! Kind regards,
-joshua
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Strange behavior of object and lamp during rotation

Post  sio2interactive on Sat Nov 15, 2008 4:04 pm

Please take a look at tutorial08 for how to use lighting in SIO2.
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Strange behavior of object and lamp during rotation

Post  meteors on Sun Nov 16, 2008 5:06 am

Hey :-)

If you replace the code in Tutorial02 with this:


// Enable GL_LIGTHING and setup the necessary
// state variables to render our objects with
// lights & materials applied.
sio2LampEnableLight();
{
sio2ResourceRender( sio2->_SIO2resource,
sio2->_SIO2window,
sio2->_SIO2camera );

SIO2object *_SIO2object = sio2ResourceGetObject( sio2->_SIO2resource,
"object/Sphere" );

_SIO2object->rot->z += 1.0f;
sio2ObjectBindMatrix( _SIO2object );

}
// Turn OFF the lights.
sio2LampResetLight();



You will see the problem I am talking about.

Thanks!!!!
-joshua
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Strange behavior of object and lamp during rotation

Post  sio2interactive on Sun Nov 16, 2008 3:18 pm

But there is no light exported in tutorial02... What you are seeing is default lighting value of GL when lighting is ON... make sure you export some lights...
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Strange behavior of object and lamp during rotation

Post  meteors on Sun Nov 16, 2008 3:22 pm

I did.

If you put this lamp in the scene you will see what I mean:

lamp( "lamp/Lamp")
{
pos( 4.076 1.005 5.904 )
dir( 0 0 -1 )
col( 1 1 1 )
nrg( 0.5 )
dst( 30.0 )
fov( 75 )
sblend( 0.15 )
att1( 0 )
att2( 1 )
}
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Strange behavior of object and lamp during rotation

Post  meteors on Sun Nov 16, 2008 5:21 pm

Ok, the answer to this problem is that I wasn't exporting normals =/


Thanks!!!
-joshua
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Strange behavior of object and lamp during rotation

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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