Hello Michael,

On 04/13/2013 11:55 AM, Michael Raab wrote:
Sorry, should be available now.

thanks! Could you give the attached patch a try, it should avoid recreating the display lists if fields that do not belong to Geometry or MaterialDrawable are changed - i.e. if only the parents field changes no refresh is issued.

        Cheers,
                Carsten

Index: Source/System/NodeCores/Drawables/Geometry/OSGGeometry.cpp
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/System/NodeCores/Drawables/Geometry/OSGGeometry.cpp,v
retrieving revision 1.57
diff -u -p -r1.57 OSGGeometry.cpp
--- Source/System/NodeCores/Drawables/Geometry/OSGGeometry.cpp	14 Jun 2009 23:52:20 -0000	1.57
+++ Source/System/NodeCores/Drawables/Geometry/OSGGeometry.cpp	16 Apr 2013 17:33:52 -0000
@@ -1757,41 +1757,65 @@ void Geometry::changed(BitVector whichFi
     }
 
 #if 1
+    // fields relevant for this drawable
+    // Used below to avoid recreating the display list for a material change.
+    // This needs to use this mask otherwise adding e.g. a new parent Node
+    // would trigger a display list recompile.
+    const BitVector DrawableFieldsMask = MaterialFieldMask         |
+                                         TypesFieldMask            |
+                                         LengthsFieldMask          |
+                                         PositionsFieldMask        |
+                                         NormalsFieldMask          |
+                                         ColorsFieldMask           |
+                                         SecondaryColorsFieldMask  |
+                                         TexCoordsFieldMask        |
+                                         TexCoords1FieldMask       |
+                                         TexCoords2FieldMask       |
+                                         TexCoords3FieldMask       |
+                                         TexCoords4FieldMask       |
+                                         TexCoords5FieldMask       |
+                                         TexCoords6FieldMask       |
+                                         TexCoords7FieldMask       |
+                                         IndicesFieldMask          |
+                                         IndexMappingFieldMask     |
+                                         DlistCacheFieldMask;
 
-    if(Thread::getAspect() != _sfIgnoreGLForAspect.getValue())
+    if(whichField & DrawableFieldsMask)
     {
-    // invalidate the dlist cache
-        if(getDlistCache() || getVbo())
+        if(Thread::getAspect() != _sfIgnoreGLForAspect.getValue())
         {
-            if(getGLId() == 0)
+            // invalidate the dlist cache
+            if(getDlistCache() || getVbo())
             {
-                GeometryPtr tmpPtr(*this);
-                
-                beginEditCP(tmpPtr, Geometry::GLIdFieldMask);
-                
-                setGLId(
-                    Window::registerGLObject(
-                        osgTypedMethodVoidFunctor2ObjCPtrPtr<
-                                GeometryPtr,
-                                Window ,
-                                UInt32>(tmpPtr,
-                                        &Geometry::handleGL),
-                        2));
-
-                endEditCP(tmpPtr, Geometry::GLIdFieldMask);
+                if(getGLId() == 0)
+                {
+                    GeometryPtr tmpPtr(*this);
+                    beginEditCP(tmpPtr, Geometry::GLIdFieldMask);
+
+                    setGLId(
+                        Window::registerGLObject(
+                            osgTypedMethodVoidFunctor2ObjCPtrPtr<
+                                    GeometryPtr,
+                                    Window ,
+                                    UInt32>(tmpPtr,
+                                            &Geometry::handleGL),
+                            2));
+
+                    endEditCP(tmpPtr, Geometry::GLIdFieldMask);
+                }
+
+                // speed improvement don't recreate the display list
+                // for a material change.
+                if((whichField & DrawableFieldsMask) != MaterialFieldMask)
+                    Window::refreshGLObject(getGLId());
             }
+            else
+            {
+                if(getGLId() != 0)
+                    Window::destroyGLObject(getGLId(), 2);
 
-            // speed improvement don't recreate the display list
-            // for a material change.
-            if(whichField != MaterialFieldMask)
-                Window::refreshGLObject(getGLId());
-        }
-        else
-        {
-            if(getGLId() != 0)
-                Window::destroyGLObject(getGLId(), 2);
-            
-            setGLId(0);
+                setGLId(0);
+            }
         }
     }
 #endif
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to