diff options
author | Sven Gothel <[email protected]> | 2008-07-25 16:26:27 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-07-25 16:26:27 +0000 |
commit | db40249b86a14c2178be8a2f61dc97f4ac1f1424 (patch) | |
tree | c570b317b13c11bf2e6b1c79d157aac24df32409 /src/classes/com/sun/opengl/impl/gl2es1/VBOBufferDrawGL2ES1.java | |
parent | 4ce0d2396726dcd285f753fcacd0acc4e2b60469 (diff) |
../jogl.log
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1735 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/impl/gl2es1/VBOBufferDrawGL2ES1.java')
-rw-r--r-- | src/classes/com/sun/opengl/impl/gl2es1/VBOBufferDrawGL2ES1.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/impl/gl2es1/VBOBufferDrawGL2ES1.java b/src/classes/com/sun/opengl/impl/gl2es1/VBOBufferDrawGL2ES1.java new file mode 100644 index 000000000..5897b9a79 --- /dev/null +++ b/src/classes/com/sun/opengl/impl/gl2es1/VBOBufferDrawGL2ES1.java @@ -0,0 +1,70 @@ + +package com.sun.opengl.impl.gl2es1; + +import javax.media.opengl.util.VBOBufferDraw; +import javax.media.opengl.*; +import java.nio.*; + +public class VBOBufferDrawGL2ES1 extends VBOBufferDraw { + + public VBOBufferDrawGL2ES1(int glArrayType, int glDataType, int glBufferUsage, int comps, int initialSize) { + init(glArrayType, glDataType, glBufferUsage, comps, initialSize); + setVBOUsage(false); + //System.err.println("new VBOBufferDrawGL2ES1: "+this); + } + + protected void enableBufferGLImpl(GL gl, boolean newData) { + if(!bufferEnabled && null!=buffer) { + gl.glEnableClientState(glArrayType); + if(vboUsage) { + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName); + if(newData) { + gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit() * getBufferCompSize(), buffer, glBufferUsage); + } + switch(glArrayType) { + case GL.GL_VERTEX_ARRAY: + gl.glVertexPointer(components, glDataType, 0, 0); + break; + case GL.GL_NORMAL_ARRAY: + gl.glNormalPointer(glDataType, 0, 0); + break; + case GL.GL_COLOR_ARRAY: + gl.glColorPointer(components, glDataType, 0, 0); + break; + case GL.GL_TEXTURE_COORD_ARRAY: + gl.glTexCoordPointer(components, glDataType, 0, 0); + break; + default: + throw new GLException("invalid glArrayType: "+glArrayType+":\n\t"+this); + } + } else { + switch(glArrayType) { + case GL.GL_VERTEX_ARRAY: + gl.glVertexPointer(components, glDataType, 0, buffer); + break; + case GL.GL_NORMAL_ARRAY: + gl.glNormalPointer(glDataType, 0, buffer); + break; + case GL.GL_COLOR_ARRAY: + gl.glColorPointer(components, glDataType, 0, buffer); + break; + case GL.GL_TEXTURE_COORD_ARRAY: + gl.glTexCoordPointer(components, glDataType, 0, buffer); + break; + default: + throw new GLException("invalid glArrayType: "+glArrayType+":\n\t"+this); + } + } + bufferEnabled = true; + } + } + + protected void disableBufferGLImpl(GL gl) { + if(bufferEnabled && null!=buffer) { + gl.glDisableClientState(glArrayType); + bufferEnabled = false; + } + } + +} + |