Problem with RenderWindow::update in Iphone

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
edwinel
Gnoblar
Posts: 3
Joined: Wed Feb 22, 2012 10:30 pm

Problem with RenderWindow::update in Iphone

Post by edwinel »

hi everyone, i`m working in xcode 4 and iOS 5, i`m trying to implement a loading bar in OgreFramework.
I recopiled some information about this por example this topics... http://89.151.96.106/forums/viewtopic.php?p=191825 , http://www.ogre3d.org/forums/viewtopic.php?t=15040, http://www.ogre3d.org/forums/viewtopic.php?f=2&t=59647.
Finally i decide use the ExampleLoadingBar but the problem is when the bar is coming to load the resources after that should update/refresh the window but appear an error EXC_BAD_ACCESS. i have tried everything and nothing....
my code is this:
The star of root, SceneManager, viewport, RenderWindow, Camera, etc, the prerequisites of loading bar.

Code: Select all

//---------------------------START OF ROOT, SCENEMANAGER, VIEWPORT, RENDERWINDOW-----------------------------
	if(!m_pRoot->showConfigDialog())
		return false;
	m_pRenderWnd = m_pRoot->initialise(true, wndTitle);
    
    m_pSceneMgr = m_pRoot->createSceneManager("OctreeSceneManager","Corre");
	m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.7f, 0.7f, 0.7f));
    
    m_pCamera = m_pSceneMgr->createCamera("Camera");
    m_pCamera->setPosition(-55.9949,0.3584,5.3258);
    m_pCamera->setOrientation(Quaternion(-0.876693,-0.00446182,0.480971,-0.00749956 ));
    m_pCamera->lookAt(1.0,1.0,1.0);
    m_pCamera->setFOVy(Ogre::Radian(0.785398));
    m_pCamera->setProjectionType(PT_PERSPECTIVE);
    m_pCamera->setNearClipDistance(0.10000000149011612);
    m_pCamera->setFarClipDistance(30000000.0);
    
	m_pViewport = m_pRenderWnd->addViewport(m_pCamera);
	m_pViewport->setBackgroundColour(ColourValue(0.8f, 0.7f, 0.6f, 1.0f));
    
	m_pCamera->setAspectRatio(Real(m_pViewport->getActualWidth()) / Real(m_pViewport->getActualHeight()));
	
	m_pViewport->setCamera(m_pCamera);
    
	unsigned long hWnd = 0;
    OIS::ParamList paramList;
    m_pRenderWnd->getCustomAttribute("WINDOW", &hWnd);
    
	paramList.insert(OIS::ParamList::value_type("WINDOW", Ogre::StringConverter::toString(hWnd)));
    
	m_pInputMgr = OIS::InputManager::createInputSystem(paramList);
    
now the loading bar...

Code: Select all

Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
    Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("Essential");
    m_pTrayMgr = new OgreBites::SdkTrayManager("TrayMgr", m_pRenderWnd, m_pMouse, this);
    m_pTimer = OGRE_NEW Ogre::Timer();
	m_pTimer->reset();
  
    
    //----------------------------START BARRA FEA -------------------------------
    ExampleLoadingBar* barra; //= ExampleLoadingBar();   
    barra = new ExampleLoadingBar();
    barra->start(m_pRenderWnd);
    
    // Turn off rendering of everything except overlays
    m_pSceneMgr->clearSpecialCaseRenderQueues();
    m_pSceneMgr->addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
    m_pSceneMgr->setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
    
    // Initialise the rest of the resource groups, parse scripts etc
    ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    ResourceGroupManager::getSingleton().loadResourceGroup(
    ResourceGroupManager::getSingleton().getWorldResourceGroupName(),false, true);
    
    // Back to full rendering
    m_pSceneMgr->clearSpecialCaseRenderQueues();
    m_pSceneMgr->setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
     
    barra->finish();
    delete barra;
    
    //----------------------------END OF BARRA FEA ----------------------------------------
and now, the code where appear the ugly error xD

Code: Select all

void resourceGroupScriptingStarted(const String& groupName, size_t scriptCount)
	{
		assert(mNumGroupsInit > 0 && "You stated you were not going to init "
			"any groups, but you did! Divide by zero would follow...");
		// Lets assume script loading is 70%
		mProgressBarInc = mProgressBarMaxSize * mInitProportion / (Real)scriptCount;//es (Real)scriptCount
		mProgressBarInc /= mNumGroupsInit;
		mLoadingDescriptionElement->setCaption("Parsing scripts...");
        mWindow->update(); <------ Here appear EXC_BAD_ACCESS!!!!!!!!!!!
this is all i have. i hope you can help me, i have benn struggling with this about 2 weeks and is important to me.
certainly forgive me my bad english skill and thanks!!!!
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Problem with RenderWindow::update in Iphone

Post by masterfalcon »

What happens if you remove the window update? Without seeing a stack trace I'm guessing that it's probably an issue with your app trying to update the window while the OS is busy compositing and other fun stuff. In that case, your app can't access the resources at the same time. In theory, the update should be handled when you call renderOneFrame.
edwinel
Gnoblar
Posts: 3
Joined: Wed Feb 22, 2012 10:30 pm

Re: Problem with RenderWindow::update in Iphone

Post by edwinel »

yeah, thanks for the reply masterfalcon!!!!, now i can see my loading bar, but...can`t load the loading bar container, namely the "bar" can`t advance, always i see a green bar, this is i can see http://s3.subirimagenes.com:81/imagen/p ... ntalla.png, certainly to solve my code i put her in my setupDemoScene of DemoApp.cpp jejeje, i learned so much today but the problem with the loading bar don`t finish. what do you think is?