[iPhone] accidental lag

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
Falcco
Kobold
Posts: 37
Joined: Fri Feb 12, 2010 4:55 pm

[iPhone] accidental lag

Post by Falcco »

Hi all,

I tried simple demo based on Ogre for iphone. And I found problem with small accidental lag. I tried everything and I really didnt know what I have to do, so I tried to make whole app where is only 50 cubes (7 on screen in the moment) and one movable cube. This cube is moved by:

Code: Select all

	

update()
{
        if(m_fakeDir == 0 && m_CubeNode->getPosition().x < 400) {		
		m_CubeNode->translate(Ogre::Vector3(0.6f, 0.0f, 0.0f));
	} else {
		m_fakeDir = 1;
	}
	
	if(m_fakeDir == 1 && m_CubeNode->getPosition().x > 0) {
		m_CubeNode->translate(Ogre::Vector3(-0.6f, 0.0f, 0.0f));
	} else {
		m_fakeDir = 0;
	}
	
	
	m_Camera()->setPosition(Ogre::Vector3(m_CubeNode->getPosition().x + 0,
													m_CubeNode->getPosition().y + 60,
													m_CubeNode->getPosition().z + 43));
	
	m_Camera()->lookAt(m_pCubeNode->getPosition());
}

in init method entities and nodes are created:

Code: Select all


init()
{
	m_EntitiesCnt = 0;
	m_CubeEntity = OgreFramework::getSingletonPtr()->mSceneMgr->createEntity("Cube1234" + Ogre::StringConverter::toString(m_EntitiesCnt), "Cube.mesh");
	m_CubeNode = OgreFramework::getSingletonPtr()->mSceneMgr->getRootSceneNode()->createChildSceneNode("CubeNode1234" + Ogre::StringConverter::toString(m_EntitiesCnt));
	m_CubeNode->attachObject(m_CubeEntity);
	m_EntitiesCnt++;
	
	m_CubeNode->setPosition(Ogre::Vector3(0,0,-3));
	
	int posx = 0;
	int posz = 0;
	
	for(int i = 0; i < 50 ; i++) {

		Ogre::Entity* entity;
		Ogre::SceneNode* node;
		
		entity = OgreFramework::getSingletonPtr()->mSceneMgr->createEntity("Cube" + Ogre::StringConverter::toString(m_EntitiesCnt), "Cube.mesh");
		node = OgreFramework::getSingletonPtr()->mSceneMgr->getRootSceneNode()->createChildSceneNode("CubeNode" + Ogre::StringConverter::toString(m_EntitiesCnt));
		node->attachObject(entity);
		m_EntitiesCnt++;
		node->setPosition(Ogre::Vector3(posx, 0, posz));
		posx += 10;				  
	}

	m_fakeDir = 0;


App runs more than 40FPS but sometimes accidental lag appears.
Is there somebody who had this same problem or can somebody try that situation and tell me about result of this small test? Because I dont know if it is problem of my app or not.

thnx.

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: [iPhone] accidental lag

Post by masterfalcon »

What do you mean by "accidental lag"?

Falcco
Kobold
Posts: 37
Joined: Fri Feb 12, 2010 4:55 pm

Re: [iPhone] accidental lag

Post by Falcco »

There are situations when FPS come down from 40 to 30 with no reason. It is once or twice in a minute (of course only on device - i tried ipod and iphone 3gs and iphone 4 everywhere this same result)

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: [iPhone] accidental lag

Post by masterfalcon »

Have you tried running through Instruments to see what's going on when the spikes occur?

Falcco
Kobold
Posts: 37
Joined: Fri Feb 12, 2010 4:55 pm

Re: [iPhone] accidental lag

Post by Falcco »

I`m not able to make test with intruments because it is slower. But I tested it on iPod and it is happening only if the app is started on device (without xcode, without cable). App was started thru xcode (device on the cable) and everything was fine.

btw: is there some limit for SceneNode-s on the scene?

Post Reply