From 45eac4e00b9b9dd935265c2ab25a61a2cf3cbf63 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Thu, 19 Mar 2009 06:39:36 +0000 Subject: Moved remaining portions of fixed function emulation out of core JOGL public and implementation packages and into com.sun.opengl.util.glsl.fixed.* and other subpackages of com.sun.opengl.util. Renamed javax.media.opengl.sub.GLObject to javax.media.opengl.GLBase. Moved interfaces in javax.media.opengl.sub.fixed to javax.media.opengl.fixedfunc and changed naming convention. Moved all classes in javax.media.opengl.util to com.sun.opengl.util. Moved com.sun.opengl.impl.packrect to com.sun.opengl.util.packrect. Renamed InternalBufferUtils to InternalBufferUtil to match naming convention and copied in needed routines for GLU and other classes. Fixed build breakage when specifying rootrel.build property; reintroduced build-temp directory. Updated demos. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1886 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../com/sun/opengl/util/GLFixedArrayHandler.java | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/jogl/classes/com/sun/opengl/util/GLFixedArrayHandler.java (limited to 'src/jogl/classes/com/sun/opengl/util/GLFixedArrayHandler.java') diff --git a/src/jogl/classes/com/sun/opengl/util/GLFixedArrayHandler.java b/src/jogl/classes/com/sun/opengl/util/GLFixedArrayHandler.java new file mode 100644 index 000000000..f1e2502be --- /dev/null +++ b/src/jogl/classes/com/sun/opengl/util/GLFixedArrayHandler.java @@ -0,0 +1,65 @@ + +package com.sun.opengl.util; + +import javax.media.opengl.*; +import javax.media.opengl.fixedfunc.*; +import com.sun.opengl.util.*; +import java.nio.*; + +public class GLFixedArrayHandler implements GLArrayHandler { + private GLArrayDataEditable ad; + + public GLFixedArrayHandler(GLArrayDataEditable ad) { + this.ad = ad; + } + + protected final void passArrayPointer(GLPointerFunc gl) { + switch(ad.getIndex()) { + case GLPointerFunc.GL_VERTEX_ARRAY: + gl.glVertexPointer(ad); + break; + case GLPointerFunc.GL_NORMAL_ARRAY: + gl.glNormalPointer(ad); + break; + case GLPointerFunc.GL_COLOR_ARRAY: + gl.glColorPointer(ad); + break; + case GLPointerFunc.GL_TEXTURE_COORD_ARRAY: + gl.glTexCoordPointer(ad); + break; + default: + throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad); + } + } + + public void enableBuffer(GL gl, boolean enable) { + GLPointerFunc glp = gl.getGL2ES1(); + if(enable) { + glp.glEnableClientState(ad.getIndex()); + + Buffer buffer = ad.getBuffer(); + + if(ad.isVBO()) { + // always bind and refresh the VBO mgr, + // in case more than one gl*Pointer objects are in use + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, ad.getVBOName()); + if(!ad.isBufferWritten()) { + if(null!=buffer) { + gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit() * ad.getComponentSize(), buffer, ad.getBufferUsage()); + } + ad.setBufferWritten(true); + } + passArrayPointer(glp); + } else if(null!=buffer) { + passArrayPointer(glp); + ad.setBufferWritten(true); + } + } else { + if(ad.isVBO()) { + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + } + glp.glDisableClientState(ad.getIndex()); + } + } +} + -- cgit v1.2.3