33 #include <QApplication> 35 #include <QVBoxLayout> 36 #include <QPushButton> 38 #include <OgreCamera.h> 39 #include <OgreEntity.h> 40 #include <OgreRenderWindow.h> 41 #include <OgreSceneNode.h> 42 #include <OgreViewport.h> 46 int main(
int argc,
char** argv)
51 QApplication
app(argc, argv);
56 window->setWindowTitle(
"I hope this is not all black.");
58 QVBoxLayout* layout =
new QVBoxLayout;
59 layout->addWidget(window);
60 QPushButton* hide_button =
new QPushButton(
"hide");
61 layout->addWidget(hide_button);
62 QPushButton* show_button =
new QPushButton(
"show");
63 layout->addWidget(show_button);
66 container.setLayout(layout);
67 container.resize(900, 600);
71 Ogre::SceneManager* scene_manager = render_system->
root()->createSceneManager(Ogre::ST_GENERIC);
73 Ogre::Entity* thing = scene_manager->createEntity(
"thing",
"rviz_cone.mesh");
74 Ogre::SceneNode* node = scene_manager->getRootSceneNode()->createChildSceneNode();
75 node->attachObject(thing);
77 scene_manager->setAmbientLight(Ogre::ColourValue(.5, .5, .5));
78 Ogre::Light* light = scene_manager->createLight(
"light");
79 light->setPosition(20, 80, 50);
81 Ogre::Camera* camera = scene_manager->createCamera(
"SampleCam");
82 camera->setPosition(Ogre::Vector3(0, 0, 10));
83 camera->lookAt(Ogre::Vector3(0, 0, -300));
84 camera->setNearClipDistance(5);
86 Ogre::Viewport* viewport = window->
getRenderWindow()->addViewport(camera);
87 viewport->setBackgroundColour(Ogre::ColourValue(0, 0, 1.0));
89 camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()) /
90 Ogre::Real(viewport->getActualHeight()));
94 QObject::connect(&timer, SIGNAL(timeout()), window, SLOT(
update()));
99 window2.resize(400, 400);
100 window2.setWindowTitle(
"I hope this is also not all black.");
103 hide_button->connect(hide_button, SIGNAL(clicked()), &window2, SLOT(hide()));
104 show_button->connect(show_button, SIGNAL(clicked()), &window2, SLOT(show()));
106 Ogre::Camera* camera2 = scene_manager->createCamera(
"SampleCam2");
107 camera2->setPosition(Ogre::Vector3(0, 10, 0));
108 camera2->setFixedYawAxis(
false);
109 camera2->lookAt(Ogre::Vector3(0, 0, 0));
110 camera2->setNearClipDistance(5);
112 Ogre::Viewport* viewport2 = window2.
getRenderWindow()->addViewport(camera2);
113 viewport2->setBackgroundColour(Ogre::ColourValue(0, 1.0, 0));
115 camera2->setAspectRatio(Ogre::Real(viewport2->getActualWidth()) /
116 Ogre::Real(viewport2->getActualHeight()));
120 QObject::connect(&timer2, SIGNAL(timeout()), &window2, SLOT(
update()));
static RenderSystem * get()
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)