本文整理汇总了C++中ogre::RenderWindow::setAutoUpdated方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderWindow::setAutoUpdated方法的具体用法?C++ RenderWindow::setAutoUpdated怎么用?C++ RenderWindow::setAutoUpdated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::RenderWindow
的用法示例。
在下文中一共展示了RenderWindow::setAutoUpdated方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onInitialize
void OculusDisplay::onInitialize()
{
fullscreen_property_ = new rviz::BoolProperty( "Render to Oculus", false,
"If checked, will render fullscreen on your secondary screen. Otherwise, shows a window.",
this, SLOT(onFullScreenChanged()));
prediction_dt_property_ = new rviz::FloatProperty( "Motion prediction (ms)", 30.0,
"Time in ms to predict head motion. Decreases overall latency and motion sickness.",
this, SLOT(onPredictionDtChanged()) );
near_clip_property_ = new rviz::FloatProperty( "Near Clip Distance", 0.02,
"Minimum rendering distance for Oculus camera.",
this );
horizontal_property_ = new rviz::BoolProperty( "Fixed Horizon", true,
"If checked, will ignore the pitch component of the RViz camera.", this);
follow_cam_property_ = new rviz::BoolProperty( "Follow RViz Camera", true,
"If checked, will set the Oculus camera to the same position as the main view camera.",
this, SLOT( onFollowCamChanged() ) );
tf_frame_property_ = new rviz::TfFrameProperty( "Target Frame", "<Fixed Frame>",
"Tf frame that the Oculus camera should follow.", this, context_->getFrameManager(), true );
offset_property_ = new rviz::VectorProperty( "Offset", Ogre::Vector3(0,0,0),
"Additional offset of the Oculus camera from the followed RViz camera or target frame.", this );
pub_tf_property_ = new rviz::BoolProperty( "Publish tf", true,
"If checked, will publish the pose of the Oculus camera as a tf frame.",
this, SLOT( onPubTfChanged() ) );
pub_tf_frame_property_ = new rviz::StringProperty( "Tf Frame", "oculus",
"Name of the published tf frame.", this );
render_widget_ = new rviz::RenderWidget( rviz::RenderSystem::get() );
render_widget_->setVisible(false);
render_widget_->setWindowTitle( "Oculus View" );
render_widget_->setParent( context_->getWindowManager()->getParentWindow() );
render_widget_->setWindowFlags( Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint );
Ogre::RenderWindow *window = render_widget_->getRenderWindow();
window->setVisible(false);
window->setAutoUpdated(false);
window->addListener(this);
scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode();
}
示例2: makeRenderWindow
Ogre::RenderWindow* RenderSystem::makeRenderWindow( intptr_t window_id, unsigned int width, unsigned int height )
{
static int windowCounter = 0; // Every RenderWindow needs a unique name, oy.
Ogre::NameValuePairList params;
Ogre::RenderWindow *window = NULL;
std::stringstream window_handle_stream;
window_handle_stream << window_id;
#ifdef Q_OS_MAC
params["externalWindowHandle"] = window_handle_stream.str();
#else
params["parentWindowHandle"] = window_handle_stream.str();
#endif
params["externalGLControl"] = true;
// Set the macAPI for Ogre based on the Qt implementation
#ifdef QT_MAC_USE_COCOA
params["macAPI"] = "cocoa";
params["macAPICocoaUseNSView"] = "true";
#else
params["macAPI"] = "carbon";
#endif
std::ostringstream stream;
stream << "OgreWindow(" << windowCounter++ << ")";
// don't bother trying stereo if Ogre does not support it.
#if !OGRE_STEREO_ENABLE
force_no_stereo_ = true;
#endif
// attempt to create a stereo window
bool is_stereo = false;
if (!force_no_stereo_)
{
params["stereoMode"] = "Frame Sequential";
window = tryMakeRenderWindow( stream.str(), width, height, ¶ms, 100);
params.erase("stereoMode");
if (window)
{
#if OGRE_STEREO_ENABLE
is_stereo = window->isStereoEnabled();
#endif
if (!is_stereo)
{
// Created a non-stereo window. Discard it and try again (below)
// without the stereo parameter.
ogre_root_->detachRenderTarget(window);
window->destroy();
window = NULL;
stream << "x";
is_stereo = false;
}
}
}
if ( window == NULL )
{
window = tryMakeRenderWindow( stream.str(), width, height, ¶ms, 100);
}
if( window == NULL )
{
ROS_ERROR( "Unable to create the rendering window after 100 tries." );
assert(false);
}
if (window)
{
window->setActive(true);
//window->setVisible(true);
window->setAutoUpdated(false);
}
stereo_supported_ = is_stereo;
ROS_INFO_ONCE("Stereo is %s", stereo_supported_ ? "SUPPORTED" : "NOT SUPPORTED");
return window;
}
示例3: makeRenderWindow
Ogre::RenderWindow* RenderSystem::makeRenderWindow( intptr_t window_id, unsigned int width, unsigned int height )
{
static int windowCounter = 0; // Every RenderWindow needs a unique name, oy.
Ogre::NameValuePairList params;
Ogre::RenderWindow *window = NULL;
std::stringstream window_handle_stream;
window_handle_stream << window_id;
#ifdef Q_OS_MAC
params["externalWindowHandle"] = window_handle_stream.str();
#else
params["parentWindowHandle"] = window_handle_stream.str();
#endif
params["externalGLControl"] = true;
// Set the macAPI for Ogre based on the Qt implementation
#ifdef QT_MAC_USE_COCOA
params["macAPI"] = "cocoa";
params["macAPICocoaUseNSView"] = "true";
#else
params["macAPI"] = "carbon";
#endif
std::ostringstream stream;
stream << "OgreWindow(" << windowCounter++ << ")";
#ifdef Q_WS_X11
old_error_handler = XSetErrorHandler( &checkBadDrawable );
#endif
int attempts = 0;
while (window == NULL && (attempts++) < 100)
{
try
{
window = ogre_root_->createRenderWindow( stream.str(), width, height, false, ¶ms );
// If the driver bug happened, tell Ogre we are done with that
// window and then try again.
if( x_baddrawable_error )
{
ogre_root_->detachRenderTarget( window );
window = NULL;
x_baddrawable_error = false;
}
}
catch( std::exception ex )
{
std::cerr << "rviz::RenderSystem: error creating render window: "
<< ex.what() << std::endl;
window = NULL;
}
}
#ifdef Q_WS_X11
XSetErrorHandler( old_error_handler );
#endif
if( window == NULL )
{
ROS_ERROR( "Unable to create the rendering window after 100 tries." );
assert(false);
}
if( attempts > 1 )
{
ROS_INFO( "Created render window after %d attempts.", attempts );
}
if (window)
{
window->setActive(true);
//window->setVisible(true);
window->setAutoUpdated(false);
}
return window;
}
示例4: main
int main(int argc, char* argv[])
{
std::unique_ptr<ExecutionArgs> exArgs(new ExecutionArgs());
if (!processCommandLineArgs(argc, argv, *exArgs)) {
return -1;
} else if (exArgs->helpPrompt) {
std::cout << "Usage: sts [--help] || [--config]" << std::endl;
std::cout << "Options:" << std::endl;
std::cout << "\t --help - print this message;" << std::endl;
std::cout << "\t --config - show config dialog." << std::endl;
std::cout << std::endl;
return 0;
}
try {
Ogre::String lConfigFileName = "ogre.cfg";
Ogre::String lPluginsFileName = "plugins.cfg";
Ogre::String lLogFileName = "Ogre_STS.log";
std::unique_ptr<Ogre::Root> lRoot(new Ogre::Root(lPluginsFileName, lConfigFileName, lLogFileName));
if (exArgs->showConfigDialog) {
if (!lRoot->showConfigDialog()) {
return 0;
}
}
Ogre::String lWindowTitle = "STS";
Ogre::String lCustomCapacities = "";
/* Check for the valid ogre.cfg */
bool lCreateAWindowAutomatically = lRoot->restoreConfig();
if (!lCreateAWindowAutomatically) {
initSomeRenderSystem(lRoot);
}
Ogre::RenderWindow* lWindow = lRoot->initialise(lCreateAWindowAutomatically, lWindowTitle, lCustomCapacities);
if (!lWindow) {
/* ogre.cfg is not available - start with hardcoded parameters */
unsigned int lSizeX = 800;
unsigned int lSizeY = 600;
bool lFullscreen = false;
Ogre::NameValuePairList lParams;
lParams["FSAA"] = "0";
lParams["vsync"] = "true";
lWindow = lRoot->createRenderWindow(lWindowTitle, lSizeX, lSizeY, lFullscreen, &lParams);
}
/* Create a scene manager */
Ogre::SceneManager* lScene = lRoot->createSceneManager(Ogre::ST_GENERIC, "SceneManager");
Ogre::SceneNode* lRootSceneNode = lScene->getRootSceneNode();
/* Create camera */
Ogre::Camera* lCamera = lScene->createCamera("MyCamera");
/* Create viewport (camera <-> window) */
Ogre::Viewport* vp = lWindow->addViewport(lCamera);
vp->setAutoUpdated(true);
vp->setBackgroundColour(Ogre::ColourValue(1, 0, 1));
lCamera->setAspectRatio(float(vp->getActualWidth()) / vp->getActualHeight());
lCamera->setPosition(Ogre::Vector3(0, 100, -1));
lCamera->lookAt(Ogre::Vector3(0, 0, 0));
/* Set clipping*/
lCamera->setNearClipDistance(1.5f);
lCamera->setFarClipDistance(3000.0f);
/* Lighting */
Ogre::Light* lLight = lScene->createLight("MainLight");
lLight->setPosition(Ogre::Vector3(0, 100, 0));
/* Resource manager */
Ogre::String lRcGroupName = "Main group";
initResourceMainGroup(lRcGroupName);
/* Load model */
Ogre::Entity* lShipEntity = lScene->createEntity("airship.mesh");
lShipEntity->setCastShadows(false);
Ogre::SceneNode* lShipNode = lRootSceneNode->createChildSceneNode();
lShipNode->attachObject(lShipEntity);
lShipNode->setScale(Ogre::Vector3(3.15f, 3.15f, 3.15f));
/* Starship start point */
Ogre::Vector3 razorSP(0, -200, -100);
lShipNode->setPosition(razorSP);
/* Sprite billboard */
Ogre::SceneNode* lSpriteNode = lRootSceneNode->createChildSceneNode();
Ogre::BillboardSet* lBillboardSet = lScene->createBillboardSet();
lBillboardSet->setMaterialName("enemy_01", lRcGroupName);
lBillboardSet->setTextureStacksAndSlices(1, 4);
Ogre::Billboard* lSpriteBillboard = lBillboardSet->createBillboard(Ogre::Vector3(0, 0, 0));
lSpriteBillboard->setDimensions(48.0f / 2.0f, 58.0f / 2.0f);
lSpriteBillboard->setTexcoordIndex(1);
lSpriteNode->attachObject(lBillboardSet);
//.........这里部分代码省略.........