34 #include <QApplication>
36 #include <QVBoxLayout>
37 #include <QPushButton>
39 #include <OgreCamera.h>
40 #include <OgreEntity.h>
41 #include <OgreRenderWindow.h>
42 #include <OgreSceneNode.h>
43 #include <OgreViewport.h>
47 int main(
int argc,
char** argv)
52 QApplication
app(argc, argv);
57 window->setWindowTitle(
"I hope this is not all black.");
59 QVBoxLayout* layout =
new QVBoxLayout;
60 layout->addWidget(window);
61 QPushButton* hide_button =
new QPushButton(
"hide");
62 layout->addWidget(hide_button);
63 QPushButton* show_button =
new QPushButton(
"show");
64 layout->addWidget(show_button);
67 container.setLayout(layout);
68 container.resize(900, 600);
72 #if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0))
73 Ogre::SceneManager* scene_manager = render_system->
root()->createSceneManager(Ogre::ST_GENERIC);
75 Ogre::SceneManager* scene_manager = render_system->
root()->createSceneManager();
78 Ogre::Entity* thing = scene_manager->createEntity(
"thing",
"rviz_cone.mesh");
79 Ogre::SceneNode* node = scene_manager->getRootSceneNode()->createChildSceneNode();
80 node->attachObject(thing);
82 scene_manager->setAmbientLight(Ogre::ColourValue(.5, .5, .5));
83 Ogre::Light* light = scene_manager->createLight(
"light");
84 light->setPosition(20, 80, 50);
86 Ogre::Camera* camera = scene_manager->createCamera(
"SampleCam");
87 camera->setPosition(Ogre::Vector3(0, 0, 10));
88 camera->lookAt(Ogre::Vector3(0, 0, -300));
89 camera->setNearClipDistance(5);
91 Ogre::Viewport* viewport = window->
getRenderWindow()->addViewport(camera);
92 viewport->setBackgroundColour(Ogre::ColourValue(0, 0, 1.0));
94 camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()) /
95 Ogre::Real(viewport->getActualHeight()));
99 QObject::connect(&timer, SIGNAL(timeout()), window, SLOT(
update()));
104 window2.resize(400, 400);
105 window2.setWindowTitle(
"I hope this is also not all black.");
108 hide_button->connect(hide_button, SIGNAL(clicked()), &window2, SLOT(hide()));
109 show_button->connect(show_button, SIGNAL(clicked()), &window2, SLOT(show()));
111 Ogre::Camera* camera2 = scene_manager->createCamera(
"SampleCam2");
112 camera2->setPosition(Ogre::Vector3(0, 10, 0));
113 camera2->setFixedYawAxis(
false);
114 camera2->lookAt(Ogre::Vector3(0, 0, 0));
115 camera2->setNearClipDistance(5);
117 Ogre::Viewport* viewport2 = window2.
getRenderWindow()->addViewport(camera2);
118 viewport2->setBackgroundColour(Ogre::ColourValue(0, 1.0, 0));
120 camera2->setAspectRatio(Ogre::Real(viewport2->getActualWidth()) /
121 Ogre::Real(viewport2->getActualHeight()));
125 QObject::connect(&timer2, SIGNAL(timeout()), &window2, SLOT(
update()));