]> git.mxchange.org Git - simgear.git/commitdiff
Restore compatibility with stable OSG (3.0.1)
authorThomas Geymayer <tomgey@gmail.com>
Sun, 30 Jun 2013 19:25:21 +0000 (21:25 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Sun, 30 Jun 2013 19:25:21 +0000 (21:25 +0200)
simgear/canvas/elements/CanvasText.cxx
simgear/scene/material/EffectGeode.cxx

index 031adba700a809c2f8d012dee3c3583d3450222f..1ed7be493c26a84cbfba09e6ee18b1623679e311 100644 (file)
@@ -20,7 +20,7 @@
 #include <simgear/canvas/Canvas.hxx>
 #include <simgear/canvas/CanvasSystemAdapter.hxx>
 #include <simgear/scene/util/parse_color.hxx>
-#include <simgear/structure/OSGVersion.hxx>
+#include <osg/Version>
 #include <osgText/Text>
 
 namespace simgear
@@ -175,7 +175,7 @@ namespace canvas
     if( !bb.valid() )
       return bb;
 
-#if SG_OSG_VERSION_LESS_THAN(3,1,0)
+#if OSG_VERSION_LESS_THAN(3,1,0)
     // TODO bounding box still doesn't seem always right (eg. with center
     //      horizontal alignment not completely accurate)
     bb._min.y() += _offset.y();
index 6119f107719cf60f73f058daa7f5d46ca962a024..c296763928ae90d712183ed06820e07d12f1691e 100644 (file)
@@ -22,6 +22,8 @@
 #include "Effect.hxx"
 #include "Technique.hxx"
 
+#include <osg/Version>
+
 #include <osgUtil/CullVisitor>
 #include <osgUtil/TangentSpaceGenerator>
 
@@ -80,15 +82,27 @@ void EffectGeode::runGenerators(osg::Geometry *geometry)
         int n = _effect->getGenerator(Effect::TANGENT);
         tsg->generate(geometry, 0);  // 0 is normal_unit, but I have no idea what that is!
         if (n != -1 && !geometry->getVertexAttribArray(n))
-          geometry->setVertexAttribArray(n, tsg->getTangentArray());
+#if OSG_MIN_VERSION_REQUIRED(3,1,8)
+          geometry->setVertexAttribArray(n, tsg->getTangentArray(), osg::Array::BIND_PER_VERTEX);
+#else
+          geometry->setVertexAttribData(n, osg::Geometry::ArrayData(tsg->getTangentArray(), osg::Geometry::BIND_PER_VERTEX,GL_FALSE));
+#endif
 
         n = _effect->getGenerator(Effect::BINORMAL);
         if (n != -1 && !geometry->getVertexAttribArray(n))
-          geometry->setVertexAttribArray(n, tsg->getBinormalArray());
+#if OSG_MIN_VERSION_REQUIRED(3,1,8)
+          geometry->setVertexAttribArray(n, tsg->getBinormalArray(), osg::Array::BIND_PER_VERTEX);
+#else
+          geometry->setVertexAttribData(n, osg::Geometry::ArrayData(tsg->getBinormalArray(), osg::Geometry::BIND_PER_VERTEX,GL_FALSE));
+#endif
 
         n = _effect->getGenerator(Effect::NORMAL);
         if (n != -1 && !geometry->getVertexAttribArray(n))
-          geometry->setVertexAttribArray(n, tsg->getNormalArray());
+#if OSG_MIN_VERSION_REQUIRED(3,1,8)
+          geometry->setVertexAttribArray(n, tsg->getNormalArray(), osg::Array::BIND_PER_VERTEX);
+#else
+          geometry->setVertexAttribData(n, osg::Geometry::ArrayData(tsg->getNormalArray(), osg::Geometry::BIND_PER_VERTEX,GL_FALSE));
+#endif
     }
 }