diff options
author | Sven Gothel <[email protected]> | 2008-08-21 14:51:51 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-08-21 14:51:51 +0000 |
commit | a971f95b23fd9f8287acdad1afc2eed75a531bc1 (patch) | |
tree | 5f9d5526acab5a7805b0a9b7963be9727217647c /src/classes/javax/media/opengl/GLArrayDataServer.java | |
parent | 40d62b2514a8800a9ae0303d67fecdab3d5baada (diff) |
Cleanup GLArrayData*, misc stuff
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1762 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/javax/media/opengl/GLArrayDataServer.java')
-rw-r--r-- | src/classes/javax/media/opengl/GLArrayDataServer.java | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/src/classes/javax/media/opengl/GLArrayDataServer.java b/src/classes/javax/media/opengl/GLArrayDataServer.java index 44d4a2ff7..032e0a6f1 100644 --- a/src/classes/javax/media/opengl/GLArrayDataServer.java +++ b/src/classes/javax/media/opengl/GLArrayDataServer.java @@ -4,6 +4,7 @@ package javax.media.opengl; import javax.media.opengl.*; import java.nio.*; import com.sun.opengl.impl.*; +import com.sun.opengl.impl.glsl.*; public class GLArrayDataServer extends GLArrayDataClient implements GLArrayData { @@ -37,7 +38,8 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayData GLProfile.isValidateArrayDataType(index, comps, dataType, false, true); GLArrayDataServer ads = new GLArrayDataServer(); - ads.init(name, index, comps, dataType, normalized, stride, buffer, 0, buffer.limit(), glBufferUsage, false); + GLArrayHandler glArrayHandler = new GLFixedArrayHandler(ads); + ads.init(name, index, comps, dataType, normalized, stride, buffer, 0, buffer.limit(), glBufferUsage, false, glArrayHandler); return ads; } @@ -59,7 +61,8 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayData GLProfile.isValidateArrayDataType(index, comps, dataType, false, true); GLArrayDataServer ads = new GLArrayDataServer(); - ads.init(name, index, comps, dataType, normalized, 0, null, 0, initialSize, glBufferUsage, false); + GLArrayHandler glArrayHandler = new GLFixedArrayHandler(ads); + ads.init(name, index, comps, dataType, normalized, 0, null, 0, initialSize, glBufferUsage, false, glArrayHandler); return ads; } @@ -82,7 +85,8 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayData GLProfile.isValidateArrayDataType(index, comps, dataType, false, true); GLArrayDataServer ads = new GLArrayDataServer(); - ads.init(name, index, comps, dataType, normalized, stride, null, bufferOffset, 0, -1, false); + GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); + ads.init(name, index, comps, dataType, normalized, stride, null, bufferOffset, 0, -1, false, glArrayHandler); ads.vboName = vboName; ads.bufferWritten = true; ads.sealed = true; @@ -99,15 +103,14 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayData int initialSize, int glBufferUsage) throws GLException { - GLProfile.isValidateArrayDataType(-1, comps, dataType, true, true); - Class[] types = new Class[]{ String.class, int.class, int.class, boolean.class, int.class, int.class }; - Object[] args = new Object[]{ name, new Integer(comps), new Integer(dataType), - new Boolean(normalized), new Integer(initialSize), new Integer(glBufferUsage) } ; - - if(GLProfile.isGL2ES2()) { - return (GLArrayDataServer) GLReflection.createInstance("com.sun.opengl.impl.glsl.GLSLArrayDataServer", types, args); + if(!GLProfile.isGL2ES2()) { + throw new GLException("GLArrayDataServer not supported for profile: "+GLProfile.getProfile()); } - throw new GLException("GLArrayDataServer not supported for profile: "+GLProfile.getProfile()); + + GLArrayDataServer ads = new GLArrayDataServer(); + GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); + ads.init(name, -1, comps, dataType, normalized, 0, null, 0, initialSize, glBufferUsage, true, glArrayHandler); + return ads; } /** @@ -120,15 +123,14 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayData int stride, Buffer buffer, int glBufferUsage) throws GLException { - GLProfile.isValidateArrayDataType(-1, comps, dataType, true, true); - Class[] types = new Class[]{ String.class, int.class, int.class, boolean.class, int.class, Buffer.class, int.class }; - Object[] args = new Object[]{ name, new Integer(comps), new Integer(dataType), - new Boolean(normalized), new Integer(stride), buffer, new Integer(glBufferUsage) } ; - - if(GLProfile.isGL2ES2()) { - return (GLArrayDataServer) GLReflection.createInstance("com.sun.opengl.impl.glsl.GLSLArrayDataServer", types, args); + if(!GLProfile.isGL2ES2()) { + throw new GLException("GLArrayDataServer not supported for profile: "+GLProfile.getProfile()); } - throw new GLException("GLArrayDataServer not supported for profile: "+GLProfile.getProfile()); + + GLArrayDataServer ads = new GLArrayDataServer(); + GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); + ads.init(name, -1, comps, dataType, normalized, stride, buffer, 0, buffer.limit(), glBufferUsage, true, glArrayHandler); + return ads; } // @@ -200,10 +202,11 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayData // protected void init(String name, int index, int comps, int dataType, boolean normalized, - int stride, Buffer data, long offset, int initialSize, int glBufferUsage, boolean isVertexAttribute) + int stride, Buffer data, long offset, int initialSize, int glBufferUsage, boolean isVertexAttribute, + GLArrayHandler glArrayHandler) throws GLException { - super.init(name, index, comps, dataType, normalized, stride, data, initialSize, isVertexAttribute); + super.init(name, index, comps, dataType, normalized, stride, data, initialSize, isVertexAttribute, glArrayHandler); vboUsage=true; |