本文整理汇总了C++中ogre::RenderWindow::setActive方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderWindow::setActive方法的具体用法?C++ RenderWindow::setActive怎么用?C++ RenderWindow::setActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::RenderWindow
的用法示例。
在下文中一共展示了RenderWindow::setActive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createWindow
void OgreRenderer::createWindow(const std::string &title, const WindowSettings& settings)
{
assert(mRoot);
mRoot->initialise(false);
// create a hidden 1x1 background window to keep resources when recreating the secondary (real) window
NameValuePairList params_;
params_.insert(std::make_pair("title", title));
params_.insert(std::make_pair("FSAA", "0"));
params_.insert(std::make_pair("vsync", "false"));
params_.insert(std::make_pair("hidden", "true"));
Ogre::RenderWindow* hiddenWindow = mRoot->createRenderWindow("InactiveHidden", 1, 1, false, ¶ms_);
hiddenWindow->setActive(false);
NameValuePairList params;
params.insert(std::make_pair("title", title));
params.insert(std::make_pair("FSAA", settings.fsaa));
params.insert(std::make_pair("vsync", settings.vsync ? "true" : "false"));
mWindow = mRoot->createRenderWindow(title, settings.window_x, settings.window_y, settings.fullscreen, ¶ms);
// create the semi-transparent black background texture used by the GUI.
// has to be created in code with TU_DYNAMIC_WRITE_ONLY param
// so that it can be modified at runtime.
Ogre::TextureManager::getSingleton().createManual(
"transparent.png",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
1, 1,
0,
Ogre::PF_A8R8G8B8,
Ogre::TU_WRITE_ONLY);
}
示例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++ << ")";
#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;
}
示例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++ << ")";
// 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;
}