[gazebo] Add upstream patch for ogre 1.9

rmattes rmattes at fedoraproject.org
Thu Jul 17 02:47:18 UTC 2014


commit 9cbb71ded603658e326ba3bd2e0b848a13b0352f
Author: Rich Mattes <richmattes at gmail.com>
Date:   Wed Jul 16 22:47:30 2014 -0400

    Add upstream patch for ogre 1.9

 gazebo-3.0.0-ogre19.patch |  202 +++++++++++++++++++++++++++++++++++++++++++++
 gazebo.spec               |    5 +
 2 files changed, 207 insertions(+), 0 deletions(-)
---
diff --git a/gazebo-3.0.0-ogre19.patch b/gazebo-3.0.0-ogre19.patch
new file mode 100644
index 0000000..ba17aa5
--- /dev/null
+++ b/gazebo-3.0.0-ogre19.patch
@@ -0,0 +1,202 @@
+# HG changeset patch
+# User Ian Chen <ichen at osrfoundation.org>
+# Date 1401470113 25200
+# Branch gazebo_3.1
+# Node ID eec4aa945cebb5c68858b3526875c41dd746aae7
+# Parent  839b2b92b357620f8cd7aa7854a07127f8775756
+# Parent  f4f20ee4a672ef19c1af9b99c7be6bfc434974d0
+Merged in issue_996_3.1 (pull request #1098)
+
+Fix gzclient startup crash with ogre 1.9
+
+diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake
+--- a/cmake/SearchForStuff.cmake
++++ b/cmake/SearchForStuff.cmake
+@@ -126,7 +126,7 @@
+   #################################################
+   # Find Simbody
+   set(SimTK_INSTALL_DIR ${SimTK_INSTALL_PREFIX})
+-  #list(APPEND CMAKE_MODULE_PATH ${SimTK_INSTALL_PREFIX}/share/cmake) 
++  #list(APPEND CMAKE_MODULE_PATH ${SimTK_INSTALL_PREFIX}/share/cmake)
+   find_package(Simbody)
+   if (SIMBODY_FOUND)
+     set (HAVE_SIMBODY TRUE)
+@@ -154,17 +154,17 @@
+   if (NOT tinyxml_FOUND)
+       find_path (tinyxml_INCLUDE_DIRS tinyxml.h ${tinyxml_INCLUDE_DIRS} ENV CPATH)
+       find_library(tinyxml_LIBRARIES NAMES tinyxml)
+-      set (tinyxml_FAIL False) 
++      set (tinyxml_FAIL False)
+       if (NOT tinyxml_INCLUDE_DIRS)
+         message (STATUS "Looking for tinyxml headers - not found")
+-        set (tinyxml_FAIL True) 
++        set (tinyxml_FAIL True)
+       endif()
+       if (NOT tinyxml_LIBRARIES)
+         message (STATUS "Looking for tinyxml library - not found")
+-        set (tinyxml_FAIL True) 
++        set (tinyxml_FAIL True)
+       endif()
+   endif()
+-        
++
+   if (tinyxml_FAIL)
+     message (STATUS "Looking for tinyxml.h - not found")
+     BUILD_ERROR("Missing: tinyxml")
+@@ -231,13 +231,10 @@
+   endif ()
+ 
+   pkg_check_modules(OGRE OGRE>=${MIN_OGRE_VERSION})
+-  # There are some runtime problems to solve with ogre-1.9. 
+-  # Please read gazebo issues: 994, 995, 996
+-  pkg_check_modules(MAX_VALID_OGRE OGRE<=1.8.9)
++  # There are some runtime problems to solve with ogre-1.9.
++  # Please read gazebo issues: 994, 995
+   if (NOT OGRE_FOUND)
+     BUILD_ERROR("Missing: Ogre3d version >=${MIN_OGRE_VERSION}(http://www.orge3d.org)")
+-  elseif (NOT MAX_VALID_OGRE_FOUND)
+-    BUILD_ERROR("Bad Ogre3d version: gazebo using ${OGRE_VERSION} ogre version has known bugs in runtime (issue #996). Please use 1.7 or 1.8 series")
+   else ()
+     set(ogre_ldflags ${ogre_ldflags} ${OGRE_LDFLAGS})
+     set(ogre_include_dirs ${ogre_include_dirs} ${OGRE_INCLUDE_DIRS})
+@@ -372,8 +369,8 @@
+ 
+   #################################################
+   # Find bullet
+-  # First and preferred option is to look for bullet standard pkgconfig, 
+-  # so check it first. if it is not present, check for the OSRF 
++  # First and preferred option is to look for bullet standard pkgconfig,
++  # so check it first. if it is not present, check for the OSRF
+   # custom bullet2.82.pc file
+   pkg_check_modules(BULLET bullet>=2.82)
+   if (NOT BULLET_FOUND)
+@@ -453,16 +450,16 @@
+ #find_path(QWT_INCLUDE_DIR NAMES qwt.h PATHS
+ #  /usr/include
+ #  /usr/local/include
+-#  "$ENV{LIB_DIR}/include" 
+-#  "$ENV{INCLUDE}" 
++#  "$ENV{LIB_DIR}/include"
++#  "$ENV{INCLUDE}"
+ #  PATH_SUFFIXES qwt-qt4 qwt qwt5
+ #  )
+ #
+-#find_library(QWT_LIBRARY NAMES qwt qwt6 qwt5 PATHS 
++#find_library(QWT_LIBRARY NAMES qwt qwt6 qwt5 PATHS
+ #  /usr/lib
+ #  /usr/local/lib
+-#  "$ENV{LIB_DIR}/lib" 
+-#  "$ENV{LIB}/lib" 
++#  "$ENV{LIB_DIR}/lib"
++#  "$ENV{LIB}/lib"
+ #  )
+ #
+ #if (QWT_INCLUDE_DIR AND QWT_LIBRARY)
+diff --git a/gazebo/rendering/Light.cc b/gazebo/rendering/Light.cc
+--- a/gazebo/rendering/Light.cc
++++ b/gazebo/rendering/Light.cc
+@@ -53,6 +53,9 @@
+   if (this->light)
+     this->scene->GetManager()->destroyLight(this->GetName());
+ 
++  this->scene->GetManager()->destroyEntity(
++      this->GetName() + "_selection_sphere");
++
+   this->visual->DeleteDynamicLine(this->line);
+   this->scene->RemoveVisual(this->visual);
+   this->visual.reset();
+@@ -276,11 +279,14 @@
+     // Make sure the unit_sphere has been inserted.
+     this->visual->InsertMesh("unit_sphere");
+ 
++    Ogre::Entity *ent =
++        visSceneNode->getCreator()->createEntity(this->GetName() +
++        "_selection_sphere", "unit_sphere");
++
++    ent->setMaterialName("Gazebo/White");
++
+     // Create the selection object.
+-    Ogre::MovableObject *obj = static_cast<Ogre::MovableObject*>
+-      (visSceneNode->getCreator()->createEntity(this->GetName() +
+-                                                "_selection_sphere",
+-                                                "unit_sphere"));
++    Ogre::MovableObject *obj = static_cast<Ogre::MovableObject*>(ent);
+ 
+     // Attach the selection object to the light visual
+     visSceneNode->attachObject(obj);
+diff --git a/gazebo/rendering/RenderEngine.cc b/gazebo/rendering/RenderEngine.cc
+--- a/gazebo/rendering/RenderEngine.cc
++++ b/gazebo/rendering/RenderEngine.cc
+@@ -66,6 +66,10 @@
+   this->logManager = NULL;
+   this->root = NULL;
+ 
++#if (OGRE_VERSION >= ((1 << 16) | (9 << 8) | 0))
++  this->overlaySystem = NULL;
++#endif
++
+   this->dummyDisplay = NULL;
+ 
+   this->initialized = false;
+@@ -116,10 +120,12 @@
+       gzthrow("Unable to create an Ogre rendering environment, no Root ");
+     }
+ 
+-#if OGRE_VERSION_MAJR > 1 || OGRE_VERSION_MINOR >= 9
+-    // Must be created after this->root, but before this->root is
+-    // initialized.
+-    this->overlaySystem = new Ogre::OverlaySystem();
++#if (OGRE_VERSION >= ((1 << 16) | (9 << 8) | 0))
++    // OgreOverlay is a component on its own in ogre 1.9 so must manually
++    // initialize it. Must be created after this->root, but before this->root
++    // is initialized.
++    if (!this->overlaySystem)
++      this->overlaySystem = new Ogre::OverlaySystem();
+ #endif
+ 
+     // Load all the plugins
+@@ -326,6 +332,11 @@
+     this->RemoveScene(this->scenes.front()->GetName());
+   }
+ 
++#if (OGRE_VERSION >= ((1 << 16) | (9 << 8) | 0))
++  delete this->overlaySystem;
++  this->overlaySystem = NULL;
++#endif
++
+   // TODO: this was causing a segfault. Need to debug, and put back in
+   if (this->root)
+   {
+@@ -768,7 +779,7 @@
+   return this->windowManager;
+ }
+ 
+-#if OGRE_VERSION_MAJR > 1 || OGRE_VERSION_MINOR >= 9
++#if (OGRE_VERSION >= ((1 << 16) | (9 << 8) | 0))
+ /////////////////////////////////////////////////
+ Ogre::OverlaySystem *RenderEngine::GetOverlaySystem() const
+ {
+diff --git a/gazebo/rendering/Visual.cc b/gazebo/rendering/Visual.cc
+--- a/gazebo/rendering/Visual.cc
++++ b/gazebo/rendering/Visual.cc
+@@ -776,7 +776,7 @@
+   this->InsertMesh(_meshName, _subMesh, _centerSubmesh);
+ 
+   obj = (Ogre::MovableObject*)
+-    (this->dataPtr->sceneNode->getCreator()->createEntity(objName, meshName));
++      (this->dataPtr->sceneNode->getCreator()->createEntity(objName, meshName));
+ 
+   this->AttachObject(obj);
+   return obj;
+@@ -2084,6 +2084,10 @@
+         rendering::Material::Update(material);
+         ogreSubMesh->setMaterialName(material->GetName());
+       }
++      else
++      {
++        ogreSubMesh->setMaterialName("Gazebo/White");
++      }
+ 
+       // Unlock
+       vBuf->unlock();
+
diff --git a/gazebo.spec b/gazebo.spec
index e424afa..d1236ef 100644
--- a/gazebo.spec
+++ b/gazebo.spec
@@ -24,6 +24,9 @@ Patch2:         %{name}-3.0.0-rpath.patch
 # Fix an exception that differs in behaviour because of boost differences
 # Not submitted upstream
 Patch3:         %{name}-2.2.2-connection.patch
+# Fix compatibility with ogre 1.9
+# Upstream pull request 1098
+Patch4:         %{name}-3.0.0-ogre19.patch
 
 BuildRequires:  PyOpenGL
 BuildRequires:  boost-devel
@@ -154,6 +157,8 @@ Development documentation for %{name}
 %patch1 -p0 -b .latex
 %patch2 -p0 -b .rpath
 %patch3 -p0 -b .connection
+%patch4 -p1 -b .ogre19
+
 # These are either unused, or replaced by system versions
 rm -rf deps/ann
 rm -rf deps/fcl


More information about the scm-commits mailing list