void* Root::renderThreadFunc(void *p) { Root *pRoot = static_cast<Root*>(p); RenderWindow *pWindow = pRoot->mp_renderWindow; assert(pWindow != NULL); bool ret = pWindow->initWindow(); assert(ret == true); pRoot->m_windowMutex.lock(); pRoot->m_windowInitialised = true; pRoot->m_windowMutex.unlock(); pRoot->m_windowCondtion.notify(); while(true) { pRoot->m_renderQueueFullMutex.lock(); while(pRoot->m_renderQueueFull == false) pRoot->m_renderQueueFullCond.wait(); pRoot->m_renderQueueFull = false; pRoot->m_renderQueueFullMutex.unlock(); pRoot->m_renderingEmptyCond.notify(); /// 将涉及硬件相关操作在此初始化完毕 /// 开始初始化可能较为费时 /// 后面加入新资源时才会进行新的初始化 if(pRoot->mp_meshManager) { if(pRoot->mp_meshManager->_finalize() == false) break; } if(pRoot->mp_effectManager) { if(pRoot->mp_effectManager->_finalize() == false) break; } ClearBuffer(); for(SceneManagerIter it = pRoot->m_sceneManagerMap.begin(); it!=pRoot->m_sceneManagerMap.end(); ++it) { it->second->_render(); } pWindow->swapBuffer(); } return NULL; }