本文整理汇总了C++中ogre::Root::initialise方法的典型用法代码示例。如果您正苦于以下问题:C++ Root::initialise方法的具体用法?C++ Root::initialise怎么用?C++ Root::initialise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Root
的用法示例。
在下文中一共展示了Root::initialise方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startEngine
Ogre::Root* OgreEngine::startEngine()
{
m_resources_cfg = "resources.cfg";
activateOgreContext();
Ogre::Root *ogreRoot = new Ogre::Root;
Ogre::RenderSystem *renderSystem = ogreRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
ogreRoot->setRenderSystem(renderSystem);
ogreRoot->initialise(false);
Ogre::NameValuePairList params;
params["externalGLControl"] = "true";
params["currentGLContext"] = "true";
//Finally create our window.
m_ogreWindow = ogreRoot->createRenderWindow("OgreWindow", 1, 1, false, ¶ms);
m_ogreWindow->setVisible(false);
m_ogreWindow->update(false);
doneOgreContext();
return ogreRoot;
}
示例2:
void
TestScene5::runOgre()
{
// initialize framework & open window
Ogre::Root* root = new Ogre::Root();
root->restoreConfig();
root->initialise(false);
auto window = root->createRenderWindow("Ogre RenderWindow", 800, 600, false);
auto sceneMgr = root->createSceneManager(Ogre::ST_GENERIC);
// adjust camera
auto cam1 = sceneMgr->createCamera("cam1");
auto camNode1 = sceneMgr->getRootSceneNode()->createChildSceneNode("camnode1");
cam1->setNearClipDistance(5);
camNode1->attachObject(cam1);
camNode1->setPosition(100, 100, 100);
camNode1->lookAt(Ogre::Vector3(-1, -1, -1), Ogre::Node::TS_LOCAL);
window->addViewport(cam1);
// load & integrate model
root->addResourceLocation("./resources/Ogre", "FileSystem");
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
auto model = sceneMgr->createEntity("model", "alexandria.mesh");
auto modelNode = sceneMgr->getRootSceneNode()->createChildSceneNode();
modelNode->attachObject(model);
// position model
modelNode->setPosition(-100, -100, -100);
// loop
runOgreLoop(root);
}
示例3: startup
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
if(!_root->showConfigDialog()){
return -1;
}
Ogre::RenderWindow* window = _root->initialise(true, "Ventana Ogre");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(500,100,500));
camera->lookAt(Ogre::Vector3(0,0,0));
camera->setNearClipDistance(5);
Ogre::Viewport* viewport = window->addViewport(camera);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()/viewport->getActualHeight()));
_listener = new FrameListenerProyectos(window,camera);
_root->addFrameListener(_listener);
loadResources();
createScene();
_root->startRendering();
return 0;
}
示例4: main
int main(int argc, char** argv)
{
try {
Ogre::Root *root = new Ogre::Root();
if(!root->restoreConfig() && !root->showConfigDialog())
return -1;
root->initialise(false);
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("./data", "FileSystem");
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Gtk::Main kit(argc, argv);
MainWindow window;
window.show();
while(!window.hasExited()) {
//root->renderOneFrame();
kit.iteration();
}
} catch( Ogre::Exception& e) {
std::cerr << "Caught unhandled Ogre exception: " << e.getFullDescription() << std::endl;
}
// delete root;
return 0;
}
示例5: main
int main(int argc, char* argv[]){
cout << "Test Ogre Program blaha" << endl;
//Relative to where its executed from, not binary location
Ogre::Root *mRoot = new Ogre::Root("configs/plugins.cfg","configs/config.cfg","logs/main.log");
if(!(mRoot->restoreConfig() || mRoot->showConfigDialog())){
delete mRoot;
return -1;
}
// setup resources
// Only add the minimally required resource locations to load up the Ogre head mesh
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/programs", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/programs/GLSL", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/scripts", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/textures", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/models", "FileSystem", "General");
//Create the window
Ogre::RenderWindow *mWindow = mRoot->initialise(true, "initial Render Window");
Ogre::SceneManager *sceneManager = mRoot->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera *camera = sceneManager->createCamera("PlayerCam");
camera->setPosition(Ogre::Vector3(0,0,80));
camera->lookAt(Ogre::Vector3(0,0,-300));
camera->setNearClipDistance(5);
Ogre::Viewport* vp = mWindow->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0,0));
camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Ogre::Entity* ogreHead = sceneManager->createEntity("Head","ogreHead.mesh");
Ogre::SceneNode* headNode = sceneManager->getRootSceneNode()->createChildSceneNode();
headNode->attachObject(ogreHead);
sceneManager->setAmbientLight(Ogre::ColourValue(0.5,0.5,0.5));
//Run the system
bool continueRunning = true;
while(continueRunning){
mRoot->renderOneFrame();
headNode->rotate(Ogre::Vector3(0,1,0),Ogre::Radian(0.005));
if(mWindow->isClosed()){
continueRunning = false;
}
}
delete mRoot;
}
示例6: configure
bool application::configure()
{
if ( root->showConfigDialog() )
{
wnd = root->initialise (true, "Render Window");
return true;
}
else return false;
}
示例7: init_render_sys
void init_render_sys()
{
m_root = new Ogre::Root();
m_root->setRenderSystem(m_root->getRenderSystemByName("OpenGL Rendering Subsystem"));
m_root->initialise(false);
m_frm = new wxFrame(0,-1,wxT(""));
NameValuePairList a;
a.insert(std::pair<String,String>("externalWindowHandle",StringConverter::toString( (size_t) m_frm->GetHandle() )));
RenderSystem *sys = m_root->getRenderSystem();
RenderWindow *m_ren = sys->_createRenderWindow(String("OgreRenderWindow_00"),1,1,false,&a);
MaterialManager::getSingleton().initialise();
m_frm->Show(false);
}
示例8: startup
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
if(!_root->showConfigDialog()){
return -1;
}
_window = _root->initialise(true,"Collision Object Exporter");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
loadResources();
createScene();
_root->startRendering();
return 0;
}
示例9: startup
//Funcion que inicializa la aplicacion
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
//Muestra la ventana inicial...
//if(!_root->showConfigDialog()){
// return -1;
//}
// Evitan cargar la ventana inicial...
Ogre::RenderSystem* _rs = _root->getRenderSystemByName("Direct3D9 Rendering Subsystem");
// or use "OpenGL Rendering Subsystem"
_root->setRenderSystem(_rs);
_rs->setConfigOption("Full Screen", "No");
_rs->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
_rs->setConfigOption("FSAA", "0");
_rs->setConfigOption("Floating-point mode", "Fastest");
_rs->setConfigOption("Use Multihead", "Auto");
_rs->setConfigOption("VSync", "No");
_rs->setConfigOption("VSync Interval", "1");
Ogre::RenderWindow* window = _root->initialise(true,"Ventana de Ogre3D");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
loadResources();
createScene();
createCamera(window);
_listener = new AppFrameListener(window,camera,_sceneManager);
_root->addFrameListener(_listener);
//_root->startRendering();
return 0;
}
示例10: InitOgreRenderSystem
void GraphicsManager::InitOgreRenderSystem()
{
if( !this->OgreBeenInitialized ) {
Ogre::Root* OgreCore = Ogre::Root::getSingletonPtr();
const Ogre::RenderSystemList& RSList = OgreCore->getAvailableRenderers();
if( RSList.size() == 1 ) {
//Ogre::RenderSystem* temp = OgreCore->getRenderSystemByName( this->GetRenderSystemName( this->RenderSystemTypes[0] ) );
OgreCore->setRenderSystem( RSList[0] );
}else{
//Ogre::RenderSystem* temp = OgreCore->getRenderSystemByName( this->GetRenderSystemName( this->CurrRenderSys ) );
OgreCore->setRenderSystem( OgreCore->getRenderSystemByName( this->GetRenderSystemName( this->CurrRenderSys ) ) );
}
OgreCore->initialise(false,"");
this->OgreBeenInitialized = true;
this->PrimaryGameWindow = new GameWindow("Primary",1,1,GameWindow::WF_Hidden);
}
}
示例11: M
void
TestScene12::runOgre()
{
// initialize framework & open window
Ogre::Root* root = new Ogre::Root();
root->restoreConfig();
root->initialise(false);
auto window = root->createRenderWindow("Ogre RenderWindow", 800, 600, false);
auto sceneMgr = root->createSceneManager(Ogre::ST_GENERIC);
// adjust camera
auto cam1 = sceneMgr->createCamera("cam1");
auto camNode1 = sceneMgr->getRootSceneNode()->createChildSceneNode("camnode1");
cam1->setNearClipDistance(5);
camNode1->attachObject(cam1);
camNode1->setPosition(Ogre::Vector3(100, 100, 100));
camNode1->lookAt(Ogre::Vector3(-1, -1, -1), Ogre::Node::TS_LOCAL);
window->addViewport(cam1);
// load & integrate model
root->addResourceLocation("./resources/Ogre", "FileSystem");
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Mesh_Cube M(1);
M.createMesh("cube");
Ogre::SceneNode* groups[ROWS];
std::list<Ogre::SceneNode*> nodes;
for (int i = 0; i < ROWS; i++)
{
groups[i] = sceneMgr->getRootSceneNode()->createChildSceneNode();
nodes.push_back(groups[i]);
}
for (int i = 0; i < ROWS * COLS; i++)
{
auto node = groups[i % ROWS]->createChildSceneNode();
node->attachObject(sceneMgr->createEntity(std::string("model") + boost::lexical_cast<std::string>(i), "cube"));
node->setPosition(
camNode1->getOrientation() * -Ogre::Vector3::UNIT_X * LEFT(i)
+ camNode1->getOrientation() * Ogre::Vector3::UNIT_Y * UP(i)
);
}
root->addFrameListener(new MoveObjectTask_Ogre12(nodes));
// loop
runOgreLoop(root);
}
示例12:
void
TestScene3::runOgre()
{
// initialize framework & open window
Ogre::Root* root = new Ogre::Root();
root->restoreConfig();
root->initialise(false);
auto window = root->createRenderWindow("Ogre RenderWindow", 800, 600, false);
auto sceneMgr = root->createSceneManager(Ogre::ST_GENERIC);
// adjust camera
auto cam1 = sceneMgr->createCamera("cam1");
auto camNode1 = sceneMgr->getRootSceneNode()->createChildSceneNode("camnode1");
cam1->setNearClipDistance(5);
camNode1->attachObject(cam1);
camNode1->setPosition(100, 100, 100);
camNode1->lookAt(Ogre::Vector3(-1, -1, -1), Ogre::Node::TS_LOCAL);
window->addViewport(cam1);
// loop
runOgreLoop(root);
}
示例13: startup
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
/*
if(!_root->showConfigDialog()){
return -1;
}
*/
Ogre::RenderSystem* _rs = _root->getRenderSystemByName("Direct3D9 Rendering Subsystem");
// or use "OpenGL Rendering Subsystem"
_root->setRenderSystem(_rs);
_rs->setConfigOption("Full Screen", "No");
_rs->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
_rs->setConfigOption("FSAA", "0");
_rs->setConfigOption("Floating-point mode", "Fastest");
_rs->setConfigOption("Use Multihead", "Auto");
_rs->setConfigOption("VSync", "No");
_rs->setConfigOption("VSync Interval", "1");
Ogre::RenderWindow* window = _root->initialise(true, "Ventana Ogre");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(0.0f,300.0f,-1000.0f));
camera->lookAt(Ogre::Vector3(0,0,0));
camera->setNearClipDistance(5);
Ogre::Viewport* viewport = window->addViewport(camera);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()/viewport->getActualHeight()));
_listener = new FrameListenerProyectos(window,camera);
_root->addFrameListener(_listener);
loadResources();
createScene();
_root->startRendering();
return 0;
}
示例14: run
/**
* Application main function:
* Initializes Ogre, creates a window, creates scenes, starts the rendering loop
*/
void run() {
// ----------------------- Create root object & window --------------------- //
// Initialize (~ glutInit)
mRoot = new Ogre::Root();
mRoot->restoreConfig(); // Read config from ogre.cfg
//if(!mRoot->showConfigDialog()) return; // Alternatively, you can show a dialog window here
// Create window (~ glutCreateWindow)
mWindow = mRoot->initialise(true, "Basic OGRE example");
// Register per-frame callbacks (~ glutIdleFunc)
mRoot->addFrameListener(this);
// Register keyboard and mouse callbacks (~ glutMouseFunc, glutKeyboardFunc, glutWindowFunc)
// This class already implements some logic, such as "quit on Escape".
// It is described in input_util.h, feel free to play with that implementation.
mEventListener = new SimpleMouseAndKeyboardListener(mWindow, mRoot, this);
// ----------- Create scene ----------------- //
// Each scene is represented by a "SceneManager" object, which
// combines a SceneGraph (set of objects with their model transforms)
// with a Camera (view-projection transform)
mScene = createTriangleScene(); // Very basic colored triangle
// This is like (~ glViewport), in that you could specify the region of the window to draw to.
// You can have several scenes rendered to different parts in the window.
Ogre::Viewport* vp = mWindow->addViewport(mScene->getCamera("MainCamera"));
// ~ glClearColor
vp->setBackgroundColour(Ogre::ColourValue(0, 0, 0));
// Enable control of a camera with mouse & keyboard using the utility class.
mEventListener->controlCamera(mScene->getCamera("MainCamera"));
// ------------------------ Configuration complete ----------------- //
// Enter the infinite rendering & event processing loop.
// ~ glutMainLoop()
mRoot->startRendering();
}
示例15: main
int main (int argc, char *argv[])
{
Ogre::Root* root = new Ogre::Root();
if (!root->showConfigDialog())
return -1;
root->initialise(false);
Gtk::Main kit(argc, argv);
OgreWindow oWindow;
oWindow.show();
while (!oWindow.hasExited())
{
kit.iteration();
// you could also call renderOneFrame() here instead.
}
delete root;
return 0;
}