[committed] JOGL states cannot be instantiated by the class CloneImportExport

Lots of render states cannot be instantiated when using CloneImportExport (JOGLRenderState, JOGLLightState, JOGLFogState, JOGLBlendState, JOGLVertexProgramState, JOGLFragmentProgramState, JOGLShaderObjectsState, JOGLStencilState) because they have no constructor with no parameter unlike their LWJGL equivalents. When you attempt to load a clone, you get an InstantiationException. Please find my fix below:


Index: /home/julien/workspace/jme/src/com/jme/renderer/jogl/JOGLRenderer.java
===================================================================
--- /home/julien/workspace/jme/src/com/jme/renderer/jogl/JOGLRenderer.java   (revision 4456)
+++ /home/julien/workspace/jme/src/com/jme/renderer/jogl/JOGLRenderer.java   (working copy)
@@ -200,6 +200,10 @@
 
         supportsFogCoords = capabilities.GL_EXT_fog_coord;
     }
+   
+    public JOGLContextCapabilities getContextCapabilities() {
+        return capabilities ;
+    }
 
     /**
      * Reinitialize the renderer with the given width/height. Also calls resize
Index: /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLBlendState.java
===================================================================
--- /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLBlendState.java   (revision 4456)
+++ /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLBlendState.java   (working copy)
@@ -37,6 +37,7 @@
 
 import com.jme.renderer.RenderContext;
 import com.jme.renderer.jogl.JOGLContextCapabilities;
+import com.jme.renderer.jogl.JOGLRenderer;
 import com.jme.scene.state.BlendState;
 import com.jme.scene.state.jogl.records.BlendStateRecord;
 import com.jme.system.DisplaySystem;
@@ -55,6 +56,12 @@
 
     private static boolean inited = false;
 
+   
+    public JOGLBlendState() {
+        this( ( ( JOGLRenderer ) DisplaySystem.getDisplaySystem()
+        .getRenderer()).getContextCapabilities() );
+    }
+   
     /**
      * Constructor instantiates a new <code>JOGLBlendState</code> object with
      * default values.
Index: /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLFogState.java
===================================================================
--- /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLFogState.java   (revision 4456)
+++ /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLFogState.java   (working copy)
@@ -38,6 +38,7 @@
 import com.jme.renderer.ColorRGBA;
 import com.jme.renderer.RenderContext;
 import com.jme.renderer.jogl.JOGLContextCapabilities;
+import com.jme.renderer.jogl.JOGLRenderer;
 import com.jme.scene.state.FogState;
 import com.jme.scene.state.jogl.records.FogStateRecord;
 import com.jme.system.DisplaySystem;
@@ -56,6 +57,12 @@
 
     private static boolean inited = false;
    
+   
+    public JOGLFogState() {
+        this( ( ( JOGLRenderer ) DisplaySystem.getDisplaySystem().
+        getRenderer()).getContextCapabilities() );
+    }
+   
     /**
      * Constructor instantiates a new <code>JOGLFogState</code> object with
      * default values.
Index: /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLFragmentProgramState.java
===================================================================
--- /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLFragmentProgramState.java   (revision 4456)
+++ /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLFragmentProgramState.java   (working copy)
@@ -45,6 +45,7 @@
 
 import com.jme.renderer.RenderContext;
 import com.jme.renderer.jogl.JOGLContextCapabilities;
+import com.jme.renderer.jogl.JOGLRenderer;
 import com.jme.scene.state.FragmentProgramState;
 import com.jme.scene.state.StateRecord;
 import com.jme.scene.state.jogl.records.FragmentProgramStateRecord;
@@ -68,6 +69,11 @@
     private JOGLContextCapabilities caps;
    
    
+    public JOGLFragmentProgramState() {
+        this( ( ( JOGLRenderer ) DisplaySystem.getDisplaySystem().
+        getRenderer()).getContextCapabilities() );
+    }
+   
     public JOGLFragmentProgramState(JOGLContextCapabilities caps) {
         this.caps = caps;
     }
Index: /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLLightState.java
===================================================================
--- /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLLightState.java   (revision 4456)
+++ /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLLightState.java   (working copy)
@@ -45,6 +45,7 @@
 import com.jme.renderer.AbstractCamera;
 import com.jme.renderer.RenderContext;
 import com.jme.renderer.jogl.JOGLContextCapabilities;
+import com.jme.renderer.jogl.JOGLRenderer;
 import com.jme.scene.Geometry;
 import com.jme.scene.Spatial;
 import com.jme.scene.Spatial.LightCombineMode;
@@ -69,6 +70,12 @@
 
     private JOGLContextCapabilities caps;
    
+   
+    public JOGLLightState() {
+        this( ( ( JOGLRenderer )DisplaySystem.getDisplaySystem().
+        getRenderer()).getContextCapabilities() );
+    }
+   
     /**
      * Constructor instantiates a new <code>JOGLLightState</code>.
      */
Index: /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLShaderObjectsState.java
===================================================================
--- /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLShaderObjectsState.java   (revision 4456)
+++ /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLShaderObjectsState.java   (working copy)
@@ -42,6 +42,7 @@
 
 import com.jme.renderer.RenderContext;
 import com.jme.renderer.jogl.JOGLContextCapabilities;
+import com.jme.renderer.jogl.JOGLRenderer;
 import com.jme.scene.state.GLSLShaderObjectsState;
 import com.jme.scene.state.StateRecord;
 import com.jme.scene.state.jogl.records.ShaderObjectsStateRecord;
@@ -76,6 +77,12 @@
     private static int maxVertexAttribs;
 
     private static boolean inited = false;
+   
+   
+    public JOGLShaderObjectsState() {
+        this( ( ( JOGLRenderer ) DisplaySystem.getDisplaySystem().
+        getRenderer()).getContextCapabilities() );
+    }
 
     public JOGLShaderObjectsState(JOGLContextCapabilities caps) {
         super();
Index: /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLStencilState.java
===================================================================
--- /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLStencilState.java   (revision 4456)
+++ /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLStencilState.java   (working copy)
@@ -37,6 +37,7 @@
 
 import com.jme.renderer.RenderContext;
 import com.jme.renderer.jogl.JOGLContextCapabilities;
+import com.jme.renderer.jogl.JOGLRenderer;
 import com.jme.scene.state.StencilState;
 import com.jme.scene.state.jogl.records.StencilStateRecord;
 import com.jme.system.DisplaySystem;
@@ -50,8 +51,15 @@
  * @version $Id$
  */
 public class JOGLStencilState extends StencilState {
+   
     private static final long serialVersionUID = 2L;
 
+   
+    public JOGLStencilState() {
+        this( ( ( JOGLRenderer ) DisplaySystem.getDisplaySystem().
+        getRenderer()).getContextCapabilities() );
+    }
+   
     public JOGLStencilState(JOGLContextCapabilities caps) {
         twoSidedSupport = caps.GL_EXT_stencil_two_side;
         stencilWrapSupport = caps.GL_EXT_stencil_wrap;
Index: /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLTextureState.java
===================================================================
--- /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLTextureState.java   (revision 4456)
+++ /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLTextureState.java   (working copy)
@@ -61,6 +61,7 @@
 import com.jme.renderer.ColorRGBA;
 import com.jme.renderer.RenderContext;
 import com.jme.renderer.jogl.JOGLContextCapabilities;
+import com.jme.renderer.jogl.JOGLRenderer;
 import com.jme.scene.Spatial;
 import com.jme.scene.Spatial.TextureCombineMode;
 import com.jme.scene.state.RenderState;
@@ -94,6 +95,12 @@
     private static boolean inited = false;
     private JOGLContextCapabilities caps;
    
+   
+    public JOGLTextureState() {
+        this( ( ( JOGLRenderer ) DisplaySystem.getDisplaySystem().
+        getRenderer()).getContextCapabilities() );
+    }
+   
     /**
      * Constructor instantiates a new <code>JOGLTextureState</code> object.
      * The number of textures that can be combined is determined during
Index: /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLVertexProgramState.java
===================================================================
--- /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLVertexProgramState.java   (revision 4456)
+++ /home/julien/workspace/jme/src/com/jme/scene/state/jogl/JOGLVertexProgramState.java   (working copy)
@@ -45,6 +45,7 @@
 
 import com.jme.renderer.RenderContext;
 import com.jme.renderer.jogl.JOGLContextCapabilities;
+import com.jme.renderer.jogl.JOGLRenderer;
 import com.jme.scene.state.StateRecord;
 import com.jme.scene.state.VertexProgramState;
 import com.jme.scene.state.jogl.records.VertexProgramStateRecord;
@@ -69,6 +70,11 @@
 
     private JOGLContextCapabilities caps;
    
+    public JOGLVertexProgramState() {
+        this( ( ( JOGLRenderer ) DisplaySystem.getDisplaySystem().
+        getRenderer()).getContextCapabilities() );
+    }
+   
     public JOGLVertexProgramState(JOGLContextCapabilities caps) {
         this.caps = caps;
     }

Committed