From 6f9cb656934fe9daa85e585ee2770210ceb43950 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 30 Oct 2013 00:27:08 +0100 Subject: Bug 776 GLContext Sharing: Fix copy-ctor GLArrayDataClient: Create new instance of GLArrayHandler of same type; Simplify GLArrayHandler inheritance. Refines commit 9f2a9df0a4b7093925c8854b37fba053469a4b35 --- .../classes/com/jogamp/opengl/util/GLArrayDataClient.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/com/jogamp/opengl/util') 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 clazz = src.glArrayHandler.getClass(); + try { + final Constructor 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; } -- cgit v1.2.3