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() ) / Ogre::Real( viewport->getActualHeight() ));
93 QObject::connect( &timer, SIGNAL(timeout()), window, SLOT(
update()) );
98 window2.resize( 400, 400 );
99 window2.setWindowTitle(
"I hope this is also not all black." );
102 hide_button->connect( hide_button, SIGNAL( clicked() ), &window2, SLOT( hide() ));
103 show_button->connect( show_button, SIGNAL( clicked() ), &window2, SLOT( show() ));
105 Ogre::Camera* camera2 = scene_manager->createCamera(
"SampleCam2" );
106 camera2->setPosition( Ogre::Vector3( 0, 10, 0 ));
107 camera2->setFixedYawAxis(
false );
108 camera2->lookAt( Ogre::Vector3( 0, 0, 0 ));
109 camera2->setNearClipDistance( 5 );
111 Ogre::Viewport* viewport2 = window2.
getRenderWindow()->addViewport( camera2 );
112 viewport2->setBackgroundColour( Ogre::ColourValue( 0, 1.0, 0 ));
114 camera2->setAspectRatio( Ogre::Real( viewport2->getActualWidth() ) / Ogre::Real( viewport2->getActualHeight() ));
118 QObject::connect( &timer2, SIGNAL(timeout()), &window2, SLOT(
update()) );
static RenderSystem * get()
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)