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);
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 ----------------------------------------
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!!!!!!!!!!!
certainly forgive me my bad english skill and thanks!!!!