aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/javax/media/opengl/util/gl2es1
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2008-06-21 02:52:27 +0000
committerSven Gothel <[email protected]>2008-06-21 02:52:27 +0000
commit32f216838432d0a67ce78061aa8a09261e3c3716 (patch)
tree4407ecaa0b3e77cfac2e35978d770c8c888edf06 /src/classes/javax/media/opengl/util/gl2es1
parentc055a37c8e11be9fc7bb49fcdda5b01d3fa8be43 (diff)
*** empty log message ***
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1669 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/javax/media/opengl/util/gl2es1')
-rw-r--r--src/classes/javax/media/opengl/util/gl2es1/VBOBufferDrawGL2ES1.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/classes/javax/media/opengl/util/gl2es1/VBOBufferDrawGL2ES1.java b/src/classes/javax/media/opengl/util/gl2es1/VBOBufferDrawGL2ES1.java
new file mode 100644
index 000000000..fbca6b569
--- /dev/null
+++ b/src/classes/javax/media/opengl/util/gl2es1/VBOBufferDrawGL2ES1.java
@@ -0,0 +1,51 @@
+
+package javax.media.opengl.util.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);
+ }
+
+ protected void enableBufferGLImpl(GL _gl, boolean newData) {
+ GL2ES1 gl = _gl.getGL2ES1();
+ if(!bufferEnabled && null!=buffer) {
+ gl.glEnableClientState(glArrayType);
+ gl.glBindBuffer(GL2ES1.GL_ARRAY_BUFFER, vboName);
+ if(newData) {
+ gl.glBufferData(GL2ES1.GL_ARRAY_BUFFER, buffer.limit() * getBufferCompSize(), buffer, glBufferUsage);
+ }
+ switch(glArrayType) {
+ case GL2ES1.GL_VERTEX_ARRAY:
+ gl.glVertexPointer(components, glDataType, 0, 0);
+ break;
+ case GL2ES1.GL_NORMAL_ARRAY:
+ gl.glNormalPointer(components, glDataType, 0);
+ break;
+ case GL2ES1.GL_COLOR_ARRAY:
+ gl.glColorPointer(components, glDataType, 0, 0);
+ break;
+ case GL2ES1.GL_TEXTURE_COORD_ARRAY:
+ gl.glTexCoordPointer(components, glDataType, 0, 0);
+ break;
+ default:
+ throw new GLException("invalid glArrayType: "+glArrayType+":\n\t"+this);
+ }
+ bufferEnabled = true;
+ }
+ }
+
+ protected void disableBufferGLImpl(GL _gl) {
+ GL2ES1 gl = _gl.getGL2ES1();
+ if(bufferEnabled && null!=buffer) {
+ gl.glDisableClientState(glArrayType);
+ bufferEnabled = false;
+ }
+ }
+
+}
+