Index: /OpenSceneGraph/trunk/src/osgPlugins/ive/ReadWrite.h
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ive/ReadWrite.h (revision 8817)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ive/ReadWrite.h (revision 9961)
@@ -88,4 +88,5 @@
 #define IVEFOG                          0x00001133
 #define IVELINESTIPPLE                  0x00001134
+#define IVEPOLYGONSTIPPLE               0x00001135
 
 // Drawables
Index: /OpenSceneGraph/trunk/src/osgPlugins/ive/DataOutputStream.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ive/DataOutputStream.cpp (revision 9475)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ive/DataOutputStream.cpp (revision 9961)
@@ -60,4 +60,5 @@
 #include "Fog.h"
 #include "Light.h"
+#include "PolygonStipple.h"
 
 #include "Group.h"
@@ -1090,4 +1091,8 @@
             ((ive::Light*)(attribute))->write(this);
         }
+        // This is a PolygonStipple
+        else if(dynamic_cast<const osg::PolygonStipple*>(attribute)){
+            ((ive::PolygonStipple*)(attribute))->write(this);
+        }
 
         else{
Index: /OpenSceneGraph/trunk/src/osgPlugins/ive/PolygonStipple.h
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ive/PolygonStipple.h (revision 9961)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ive/PolygonStipple.h (revision 9961)
@@ -0,0 +1,15 @@
+#ifndef IVE_POLYGONSTIPPLE
+#define IVE_POLYGONSTIPPLE 1
+
+#include <osg/PolygonStipple>
+#include "ReadWrite.h"
+
+namespace ive{
+class PolygonStipple : public osg::PolygonStipple, public ReadWrite {
+public:
+    void write(DataOutputStream* out);
+    void read(DataInputStream* in);
+};
+}
+
+#endif
Index: /OpenSceneGraph/trunk/src/osgPlugins/ive/DataInputStream.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ive/DataInputStream.cpp (revision 9527)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ive/DataInputStream.cpp (revision 9961)
@@ -57,4 +57,5 @@
 #include "Fog.h"
 #include "Light.h"
+#include "PolygonStipple.h"
 
 
@@ -1412,4 +1413,8 @@
         ((ive::Light*)(attribute))->read(this);
     }
+    else if(attributeID == IVEPOLYGONSTIPPLE){
+        attribute = new osg::PolygonStipple();
+        ((ive::PolygonStipple*)(attribute))->read(this);
+    }
     else{
         throw Exception("Unknown StateAttribute in StateSet::read()");
Index: /OpenSceneGraph/trunk/src/osgPlugins/ive/PolygonStipple.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ive/PolygonStipple.cpp (revision 9961)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ive/PolygonStipple.cpp (revision 9961)
@@ -0,0 +1,54 @@
+/**********************************************************************
+ *
+ *    FILE:           PolygonStipple.cpp
+ *
+ *    DESCRIPTION:    Read/Write osg::PolygonStipple in binary format to disk.
+ *
+ *    CREATED BY:     Copied from LineStipple
+ *                    and modified by Luc Frauciel
+ *
+ *    HISTORY:        Created 21.3.2009
+ *
+ *    Copyright 2008 VR-C
+ **********************************************************************/
+
+#include "Exception.h"
+#include "PolygonStipple.h"
+#include "Object.h"
+
+using namespace ive;
+
+void PolygonStipple::write(DataOutputStream* out){
+    // Write CullFace's identification.
+    out->writeInt(IVEPOLYGONSTIPPLE);
+    // If the osg class is inherited by any other class we should also write this to file.
+    osg::Object* obj = dynamic_cast<osg::Object*>(this);
+    if (obj) {
+        ((ive::Object*)(obj))->write(out);
+    }
+    else
+        throw Exception("PolygonStipple::write(): Could not cast this osg::PolygonStipple to an osg::Object.");
+    // Write PolygonStipple's properties.
+    out->writeUByteArray(new osg::UByteArray(128,const_cast<GLubyte*>(getMask())));
+}
+
+void PolygonStipple::read(DataInputStream* in){
+    // Peek on LineStipple's identification.
+    int id = in->peekInt();
+    if (id == IVEPOLYGONSTIPPLE) {
+        // Read PolygonStipple's identification.
+        id = in->readInt();
+        // If the osg class is inherited by any other class we should also read this from file.
+        osg::Object*  obj = dynamic_cast<osg::Object*>(this);
+        if (obj) {
+            ((ive::Object*)(obj))->read(in);
+        }
+        else
+            throw Exception("PolygonStipple::read(): Could not cast this osg::PolygonStipple to an osg::Object.");
+        // Read PolygonStipple's properties
+        setMask((GLubyte *)in->readUByteArray()->getDataPointer());
+    }
+    else{
+        throw Exception("PolygonStipple::read(): Expected PolygonStipple identification.");
+    }
+}
Index: /OpenSceneGraph/trunk/src/osgPlugins/ive/CMakeLists.txt
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ive/CMakeLists.txt (revision 9033)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ive/CMakeLists.txt (revision 9961)
@@ -79,4 +79,5 @@
     PolygonMode.cpp
     PolygonOffset.cpp
+    PolygonStipple.cpp
     PositionAttitudeTransform.cpp
     PrimitiveSet.cpp
@@ -195,4 +196,5 @@
     PolygonMode.h
     PolygonOffset.h
+    PolygonStipple.h
     PositionAttitudeTransform.h
     PrimitiveSet.h
