Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix render system #1101

Merged
merged 3 commits into from
May 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions src/rviz/ogre_helpers/render_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ int checkBadDrawable( Display* display, XErrorEvent* error )
#endif // Q_WS_X11

Ogre::RenderWindow* RenderSystem::makeRenderWindow(
unsigned long window_id,
WindowIDType window_id,
unsigned int width,
unsigned int height,
double pixel_ratio)
Expand All @@ -355,11 +355,8 @@ Ogre::RenderWindow* RenderSystem::makeRenderWindow(
Ogre::NameValuePairList params;
Ogre::RenderWindow *window = NULL;

#ifdef Q_OS_MAC
params["externalWindowHandle"] = Ogre::StringConverter::toString((unsigned long)window_id);
#else
params["parentWindowHandle"] = Ogre::StringConverter::toString((unsigned long)window_id);
#endif
params["externalWindowHandle"] = Ogre::StringConverter::toString(window_id);
params["parentWindowHandle"] = Ogre::StringConverter::toString(window_id);

params["externalGLControl"] = true;

Expand All @@ -369,11 +366,9 @@ Ogre::RenderWindow* RenderSystem::makeRenderWindow(
}

// 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";
#if defined(Q_OS_MAC)
parameters["macAPI"] = "cocoa";
parameters["macAPICocoaUseNSView"] = "true";
#endif
params["contentScalingFactor"] = std::to_string(pixel_ratio);

Expand Down
11 changes: 9 additions & 2 deletions src/rviz/ogre_helpers/render_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,17 @@ namespace rviz
class RenderSystem
{
public:

#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
typedef size_t WindowIDType;
#else
typedef unsigned long WindowIDType;
#endif

static RenderSystem* get();

Ogre::RenderWindow* makeRenderWindow(
unsigned long window_id,
WindowIDType window_id,
unsigned int width,
unsigned int height,
double pixel_ratio = 1.0);
Expand Down Expand Up @@ -96,7 +103,7 @@ class RenderSystem
static RenderSystem* instance_;

// ID for a dummy window of size 1x1, used to keep Ogre happy.
unsigned long dummy_window_id_;
WindowIDType dummy_window_id_;

Ogre::Root* ogre_root_;
Ogre::OverlaySystem* ogre_overlay_system_;
Expand Down
6 changes: 5 additions & 1 deletion src/rviz/ogre_helpers/render_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ RenderWidget::RenderWidget( RenderSystem* render_system, QWidget *parent )
this->setLayout(mainLayout);
#endif

WId win_id = this->renderFrame->winId();
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
rviz::RenderSystem::WindowIDType win_id = this->renderFrame->winId();
#else
rviz::RenderSystem::WindowIDType win_id = this->winId();
#endif
QApplication::flush();

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
Expand Down