summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-30 00:27:08 +0100
committerSven Gothel <[email protected]>2013-10-30 00:27:08 +0100
commit6f9cb656934fe9daa85e585ee2770210ceb43950 (patch)
tree642ecf339ac3a8e131e146a031ece504fe41723d /src/jogl/classes/com/jogamp/opengl
parent0943389a6d34622c112ed73ce3d2d2e25434ce59 (diff)
Bug 776 GLContext Sharing: Fix copy-ctor GLArrayDataClient: Create new instance of GLArrayHandler of same type; Simplify GLArrayHandler inheritance.
Refines commit 9f2a9df0a4b7093925c8854b37fba053469a4b35
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
index e281b14fd..f84342e88 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.util;
+import java.lang.reflect.Constructor;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
@@ -461,7 +462,17 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
this.bufferWritten = src.bufferWritten;
this.enableBufferAlways = src.enableBufferAlways;
this.initialElementCount = src.initialElementCount;
- this.glArrayHandler = src.glArrayHandler;
+ if( null != src.glArrayHandler ) {
+ final Class<? extends GLArrayHandler> clazz = src.glArrayHandler.getClass();
+ try {
+ final Constructor<? extends GLArrayHandler> ctor = clazz.getConstructor(GLArrayDataEditable.class);
+ this.glArrayHandler = ctor.newInstance(this);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not ctor "+clazz.getName()+"("+this.getClass().getName()+")", e);
+ }
+ } else {
+ this.glArrayHandler = null;
+ }
this.usesGLSL = src.usesGLSL;
this.shaderState = src.shaderState;
}