diff options
author | Sven Gothel <[email protected]> | 2008-07-18 18:21:25 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-07-18 18:21:25 +0000 |
commit | de0eaef37caf13314114ab37cc53edc48610a7bf (patch) | |
tree | 82f23e6a3a93975312108ffd9f29e6ebc462ce3a | |
parent | 52a5e479db5e2ad41889d69fb470922f35438e3e (diff) |
Cleanup and partitioning of GLU
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1728 232f8b59-042b-4e1e-8c03-345bb8c30851
-rwxr-xr-x | etc/profile.jogl | 6 | ||||
-rw-r--r-- | make/build.xml | 52 | ||||
-rwxr-xr-x | make/glu-CustomJavaCode-base.java (renamed from make/glu-CustomJavaCode-gles1_if.java) | 134 | ||||
-rwxr-xr-x | make/glu-CustomJavaCode-gl2es1.java (renamed from make/glu-CustomJavaCode-gles1.java) | 90 | ||||
-rwxr-xr-x | make/glu-base.cfg (renamed from make/glu-es1_if.cfg) | 3 | ||||
-rwxr-xr-x | make/glu-gl2es1.cfg (renamed from make/glu-es1.cfg) | 10 | ||||
-rw-r--r-- | make/lstjars.sh | 4 | ||||
-rw-r--r-- | src/classes/com/sun/opengl/impl/GLReflection.java | 14 |
8 files changed, 243 insertions, 70 deletions
diff --git a/etc/profile.jogl b/etc/profile.jogl index 08cdc80fe..04ed840b5 100755 --- a/etc/profile.jogl +++ b/etc/profile.jogl @@ -22,17 +22,17 @@ JOGL_JAR_ALL="jogl.core.jar jogl.oswin.jar jogl.gles1.jar jogl.gles1.dbg.jar jog JOGL_LIB_ALL="libjogl_gl2.so libjogl_es1.so libjogl_es2.so libnewt.so libjogl_awt.so" JOGL_JAR_ES1_MIN="jogl.core.jar jogl.gles1.jar jogl.egl.jar newt.jar" -JOGL_JAR_ES1_MAX="jogl.core.jar jogl.oswin.jar jogl.gles1.jar jogl.gles1.dbg.jar jogl.egl.jar newt.jar jogl.util.jar $JOGL_AWT" +JOGL_JAR_ES1_MAX="jogl.core.jar jogl.oswin.jar jogl.gles1.jar jogl.gles1.dbg.jar jogl.egl.jar jogl.glu.tess.jar jogl.glu.gl2es1.jar newt.jar jogl.util.jar $JOGL_AWT" JOGL_LIB_ES1_MIN="libjogl_es1.so libnewt.so" JOGL_LIB_ES1_MAX="libjogl_es1.so libnewt.so libjogl_awt.so" JOGL_JAR_ES2_MIN="jogl.core.jar jogl.gles2.jar jogl.egl.jar newt.jar" -JOGL_JAR_ES2_MAX="jogl.core.jar jogl.oswin.jar jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar newt.jar jogl.util.jar $JOGL_AWT" +JOGL_JAR_ES2_MAX="jogl.core.jar jogl.oswin.jar jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.glu.tess.jar newt.jar jogl.util.jar $JOGL_AWT" JOGL_LIB_ES2_MIN="libjogl_es2.so libnewt.so" JOGL_LIB_ES2_MAX="libjogl_es2.so libnewt.so libjogl_awt.so" JOGL_JAR_GL2_MIN="jogl.core.jar jogl.oswin.jar jogl.gl2.jar newt.jar" -JOGL_JAR_GL2_MAX="jogl.core.jar jogl.oswin.jar jogl.gl2.jar jogl.gl2.dbg.jar jogl.util.jar jogl.util.gl2.jar newt.jar $JOGL_AWT" +JOGL_JAR_GL2_MAX="jogl.core.jar jogl.oswin.jar jogl.gl2.jar jogl.gl2.dbg.jar jogl.util.jar jogl.glu.tess.jar jogl.glu.gl2es1.jar jogl.glu.gl2.jar jogl.util.gl2.jar newt.jar $JOGL_AWT" JOGL_LIB_GL2_MIN="libjogl_gl2.so libnewt.so" JOGL_LIB_GL2_MAX="libjogl_gl2.so libnewt.so libjogl_awt.so" diff --git a/make/build.xml b/make/build.xml index 5b284e097..82a0dfe2b 100644 --- a/make/build.xml +++ b/make/build.xml @@ -62,7 +62,6 @@ jogl.noes2 jogl.nogl2 jogl.noAWT - jogl.noglugl2 - no glu gl2 impl. jogl.noutil - no com.sun.opengl.util.* jogl.nonewt jogl.noX11WindowsMacOsX, which implies: @@ -147,6 +146,12 @@ <property name="java.part.egl" value="com/sun/opengl/impl/egl/*"/> + <property name="java.part.glutess" + value="com/sun/opengl/impl/glu/tessellator/**"/> + + <property name="java.part.glugl2es1" + value="com/sun/opengl/impl/glu/GLUquadricImpl*, com/sun/opengl/impl/glu/mipmap/**"/> + <property name="java.part.glugl2" value="com/sun/opengl/impl/glu/gl2/**, com/sun/opengl/impl/glu/nurbs/**, com/sun/opengl/impl/glu/registry/**, javax/media/opengl/glu/gl2/**"/> @@ -208,16 +213,8 @@ </and> </condition> - <condition property="java.excludes.glugl2" - value="${java.part.glugl2}"> - <or> - <isset property="jogl.noglugl2"/> - <isset property="jogl.nogl2"/> - </or> - </condition> - <condition property="java.excludes.gl2" - value="${java.part.gl2}, ${java.part.gl2.dbg}, ${java.part.util.gl2}"> + value="${java.part.gl2}, ${java.part.gl2.dbg}, ${java.part.util.gl2}, ${java.part.glugl2}"> <isset property="jogl.nogl2"/> </condition> @@ -433,6 +430,9 @@ <property name="jogl.gles2.jar" value="${build}/jogl.gles2.jar" /> <property name="jogl.gles2.dbg.jar" value="${build}/jogl.gles2.dbg.jar" /> <property name="jogl.egl.jar" value="${build}/jogl.egl.jar" /> + <property name="jogl.glutess.jar" value="${build}/jogl.glu.tess.jar" /> + <property name="jogl.glugl2es1.jar" value="${build}/jogl.glu.gl2es1.jar" /> + <property name="jogl.glugl2.jar" value="${build}/jogl.glu.gl2.jar" /> <property name="jogl.gl2.jar" value="${build}/jogl.gl2.jar" /> <property name="jogl.gl2.dbg.jar" value="${build}/jogl.gl2.dbg.jar" /> <property name="jogl.awt.jar" value="${build}/jogl.awt.jar" /> @@ -653,20 +653,20 @@ </gluegen> </target> --> - <target name="java.generate.glu.If"> + <target name="java.generate.glu.base"> <echo message="Generating GLU class" /> <gluegen src="${stub.includes.common}/glu.c" - config="${config}/glu-es1_if.cfg" + config="${config}/glu-base.cfg" includeRefid="stub.includes.fileset.all.gl2" emitter="com.sun.gluegen.opengl.GLEmitter"> <classpath refid="gluegen.classpath" /> </gluegen> </target> - <target name="java.generate.glu.ES1" unless="jogl.noes1"> + <target name="java.generate.glu.GL2ES1"> <echo message="Generating GLU class" /> <gluegen src="${stub.includes.common}/glu.c" - config="${config}/glu-es1.cfg" + config="${config}/glu-gl2es1.cfg" includeRefid="stub.includes.fileset.all.gl2" emitter="com.sun.gluegen.opengl.GLEmitter"> <classpath refid="gluegen.classpath" /> @@ -821,9 +821,9 @@ <antcall target="java.generate.BufferUtil" inheritrefs="true" /> <!-- Generate GLU class --> - <antcall target="java.generate.glu.If" inheritrefs="true" /> - <antcall target="java.generate.glu.ES1" inheritrefs="true" /> - <antcall target="java.generate.glu.GL2" inheritrefs="true" /> + <antcall target="java.generate.glu.base" inheritrefs="true" /> + <antcall target="java.generate.glu.GL2ES1" inheritrefs="true" /> + <antcall target="java.generate.glu.GL2" inheritrefs="true" /> <!-- Inform the user that the generators have successfully created - the necessary Java files --> @@ -1490,7 +1490,7 @@ <jar manifest="tempversion" destfile="${jogl.core.jar}"> <fileset dir="${classes}" includes="javax/media/opengl/**, com/sun/gluegen/runtime/**, com/sun/opengl/**" - excludes="${java.excludes.fixme} ${java.part.egl}, ${java.part.gl2}, ${java.part.gl2.dbg}, ${java.part.es1}, ${java.part.es1.dbg}, ${java.part.es2}, ${java.part.es2.dbg}, ${java.part.awt}, ${java.part.glugl2}, ${java.part.util} ${java.part.util.awt} ${java.part.util.gl2}, ${java.part.oswin}, ${java.part.newt}, ${java.part.newt.awt}"/> + excludes="${java.excludes.fixme} ${java.part.egl}, ${java.part.gl2}, ${java.part.gl2.dbg}, ${java.part.es1}, ${java.part.es1.dbg}, ${java.part.es2}, ${java.part.es2.dbg}, ${java.part.awt}, ${java.part.glutess}, ${java.part.glugl2es1}, ${java.part.glugl2}, ${java.part.util} ${java.part.util.awt} ${java.part.util.gl2}, ${java.part.oswin}, ${java.part.newt}, ${java.part.newt.awt}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gles1.jar}"> <fileset dir="${classes}" @@ -1517,13 +1517,25 @@ </jar> <jar manifest="tempversion" destfile="${jogl.gl2.jar}"> <fileset dir="${classes}" - includes="${java.part.gl2} ${java.part.glugl2}" - excludes="${java.part.gl2.dbg}"/> + includes="${java.part.gl2}" + excludes="${java.part.gl2.dbg}, ${java.part.glugl2}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gl2.dbg.jar}"> <fileset dir="${classes}" includes="${java.part.gl2.dbg}"/> </jar> + <jar manifest="tempversion" destfile="${jogl.glutess.jar}"> + <fileset dir="${classes}" + includes="${java.part.glutess}"/> + </jar> + <jar manifest="tempversion" destfile="${jogl.glugl2es1.jar}"> + <fileset dir="${classes}" + includes="${java.part.glugl2es1}"/> + </jar> + <jar manifest="tempversion" destfile="${jogl.glugl2.jar}"> + <fileset dir="${classes}" + includes="${java.part.glugl2}"/> + </jar> <jar manifest="tempversion" destfile="${jogl.awt.jar}"> <fileset dir="${classes}" includes="${java.part.awt}" diff --git a/make/glu-CustomJavaCode-gles1_if.java b/make/glu-CustomJavaCode-base.java index b73fc965f..f7cb4b1b3 100755 --- a/make/glu-CustomJavaCode-gles1_if.java +++ b/make/glu-CustomJavaCode-base.java @@ -81,18 +81,23 @@ public static final GLU createGLU() throws GLException { } public static final GLU createGLU(String profile) throws GLUnsupportedException { - GLU glu = null; - String clazzName; - if(GLProfile.GL2.equals(profile)) { - clazzName="javax.media.opengl.glu.gl2.GLUgl2"; - } else if(GLProfile.GLES1.equals(profile)) { - clazzName="javax.media.opengl.glu.es1.GLUes1"; - } else if(GLProfile.GLES2.equals(profile)) { - clazzName="javax.media.opengl.glu.GLU"; - } else { - throw new GLUnsupportedException("GLU not supported for GL profile: "+profile); - } - return (GLU) GLReflection.createInstance(clazzName); + try { + if(GLProfile.GL2.equals(profile)) { + return (GLU) GLReflection.createInstance("javax.media.opengl.glu.gl2.GLUgl2"); + } + } catch (GLUnsupportedException e) { System.out.println(e); } + try { + if(GLProfile.GL2.equals(profile) || GLProfile.GLES1.equals(profile)) { + return (GLU) GLReflection.createInstance("javax.media.opengl.glu.gl2es1.GLUgl2es1"); + } + } catch (GLUnsupportedException e) { System.out.println(e); } + try { + if(GLProfile.GL2.equals(profile) || GLProfile.GLES2.equals(profile)) { + return (GLU) GLReflection.createInstance("javax.media.opengl.glu.gl2es2.GLUgl2es2"); + } + } catch (GLUnsupportedException e) { System.out.println(e); } + + return new GLU(); } public static final GL getCurrentGL() throws GLException { @@ -107,19 +112,35 @@ public static final GL getCurrentGL() throws GLException { // Tessellation routines // +protected static boolean availableGLUtessellatorImpl = false; +protected static boolean checkedGLUtessellatorImpl = false; + +protected static final void validateGLUtessellatorImpl() { + if(!checkedGLUtessellatorImpl) { + availableGLUtessellatorImpl = GLReflection.isClassAvailable("com.sun.opengl.impl.glu.tessellator.GLUtessellatorImpl"); + checkedGLUtessellatorImpl = true; + } + if(!availableGLUtessellatorImpl) { + throw new GLUnsupportedException("GLUtessellator not available (GLUtessellatorImpl)"); + } +} + /***************************************************************************** * <b>gluNewTess</b> creates and returns a new tessellation object. This * object must be referred to when calling tesselation methods. A return * value of null means that there was not enough memeory to allocate the * object. * + * Optional, throws GLUnsupportedException if not available in profile + * * @return A new tessellation object. * * @see #gluTessBeginPolygon gluTessBeginPolygon * @see #gluDeleteTess gluDeleteTess * @see #gluTessCallback gluTessCallback ****************************************************************************/ -public final GLUtessellator gluNewTess() { +public static final GLUtessellator gluNewTess() { + validateGLUtessellatorImpl(); return GLUtessellatorImpl.gluNewTess(); } @@ -127,6 +148,8 @@ public final GLUtessellator gluNewTess() { * <b>gluDeleteTess</b> destroys the indicated tessellation object (which was * created with {@link #gluNewTess gluNewTess}). * + * Optional, throws GLUnsupportedException if not available in profile + * * @param tessellator * Specifies the tessellation object to destroy. * @@ -134,7 +157,8 @@ public final GLUtessellator gluNewTess() { * @see #gluNewTess gluNewTess * @see #gluTessCallback gluTessCallback ****************************************************************************/ -public final void gluDeleteTess(GLUtessellator tessellator) { +public static final void gluDeleteTess(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluDeleteTess(); } @@ -145,6 +169,8 @@ public final void gluDeleteTess(GLUtessellator tessellator) { * interpreted and rendered. The legal value for <i>which</i> are as * follows:<P> * + * Optional, throws GLUnsupportedException if not available in profile + * * <b>GLU_TESS_WINDING_RULE</b> * <UL> * Determines which parts of the polygon are on the "interior". @@ -216,7 +242,8 @@ public final void gluDeleteTess(GLUtessellator tessellator) { * @see #gluGetTessProperty gluGetTessProperty * @see #gluNewTess gluNewTess ****************************************************************************/ -public final void gluTessProperty(GLUtessellator tessellator, int which, double value) { +public static final void gluTessProperty(GLUtessellator tessellator, int which, double value) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluTessProperty(which, value); } @@ -228,6 +255,8 @@ public final void gluTessProperty(GLUtessellator tessellator, int which, double * {@link #gluTessProperty gluTessProperty} reference * page for information about the properties and what they do. * + * Optional, throws GLUnsupportedException if not available in profile + * * @param tessellator * Specifies the tessellation object (created with * {@link #gluNewTess gluNewTess}). @@ -242,7 +271,8 @@ public final void gluTessProperty(GLUtessellator tessellator, int which, double * @see #gluNewTess gluNewTess * @see #gluTessProperty gluTessProperty ****************************************************************************/ -public final void gluGetTessProperty(GLUtessellator tessellator, int which, double[] value, int value_offset) { +public static final void gluGetTessProperty(GLUtessellator tessellator, int which, double[] value, int value_offset) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluGetTessProperty(which, value, value_offset); } @@ -268,6 +298,8 @@ public final void gluGetTessProperty(GLUtessellator tessellator, int which, doub * The supplied normal persists until it is changed by another call to * <b>gluTessNormal</b>. * + * Optional, throws GLUnsupportedException if not available in profile + * * @param tessellator * Specifies the tessellation object (created by * {@link #gluNewTess gluNewTess}). @@ -281,7 +313,8 @@ public final void gluGetTessProperty(GLUtessellator tessellator, int which, doub * @see #gluTessBeginPolygon gluTessBeginPolygon * @see #gluTessEndPolygon gluTessEndPolygon ****************************************************************************/ -public final void gluTessNormal(GLUtessellator tessellator, double x, double y, double z) { +public static final void gluTessNormal(GLUtessellator tessellator, double x, double y, double z) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluTessNormal(x, y, z); } @@ -292,6 +325,8 @@ public final void gluTessNormal(GLUtessellator tessellator, double x, double y, * is replaced. If <i>aCallback</i> is null, then the existing callback * becomes undefined.<P> * + * Optional, throws GLUnsupportedException if not available in profile + * * These callbacks are used by the tessellation object to describe how a * polygon specified by the user is broken into triangles. Note that there are * two versions of each callback: one with user-specified polygon data and one @@ -564,7 +599,8 @@ public final void gluTessNormal(GLUtessellator tessellator, double x, double y, * @see #gluTessProperty gluTessProperty * @see #gluTessNormal gluTessNormal ****************************************************************************/ -public final void gluTessCallback(GLUtessellator tessellator, int which, GLUtessellatorCallback aCallback) { +public static final void gluTessCallback(GLUtessellator tessellator, int which, GLUtessellatorCallback aCallback) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluTessCallback(which, aCallback); } @@ -577,6 +613,8 @@ public final void gluTessCallback(GLUtessellator tessellator, int which, GLUtess * {@link #gluTessBeginContour gluTessBeginContour} and * {@link #gluTessBeginContour gluTessEndContour}.<P> * + * Optional, throws GLUnsupportedException if not available in profile + * * <b>data</b> normally references to a structure containing the vertex * location, as well as other per-vertex attributes such as color and normal. * This reference is passed back to the user through the @@ -602,7 +640,8 @@ public final void gluTessCallback(GLUtessellator tessellator, int which, GLUtess * @see #gluTessNormal gluTessNormal * @see #gluTessEndPolygon gluTessEndPolygon ****************************************************************************/ -public final void gluTessVertex(GLUtessellator tessellator, double[] coords, int coords_offset, Object data) { +public static final void gluTessVertex(GLUtessellator tessellator, double[] coords, int coords_offset, Object data) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluTessVertex(coords, coords_offset, data); } @@ -624,6 +663,8 @@ public final void gluTessVertex(GLUtessellator tessellator, double[] coords, int * gluTessBeginContour}, and {@link #gluTessEndContour * gluTessEndContour} reference pages for more details.<P> * + * Optional, throws GLUnsupportedException if not available in profile + * * <b>data</b> is a reference to a user-defined data structure. If the * appropriate callback(s) are specified (see * {@link #gluTessCallback gluTessCallback}), then this @@ -650,7 +691,8 @@ public final void gluTessVertex(GLUtessellator tessellator, double[] coords, int * @see #gluTessNormal gluTessNormal * @see #gluTessEndPolygon gluTessEndPolygon ****************************************************************************/ -public final void gluTessBeginPolygon(GLUtessellator tessellator, Object data) { +public static final void gluTessBeginPolygon(GLUtessellator tessellator, Object data) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluTessBeginPolygon(data); } @@ -670,6 +712,8 @@ public final void gluTessBeginPolygon(GLUtessellator tessellator, Object data) { * {@link #gluTessBeginPolygon gluTessBeginPolygon} and * {@link #gluTessEndPolygon gluTessEndPolygon}. * + * Optional, throws GLUnsupportedException if not available in profile + * * @param tessellator * Specifies the tessellation object (created with * {@link #gluNewTess gluNewTess}). @@ -682,7 +726,8 @@ public final void gluTessBeginPolygon(GLUtessellator tessellator, Object data) { * @see #gluTessNormal gluTessNormal * @see #gluTessEndPolygon gluTessEndPolygon ****************************************************************************/ -public final void gluTessBeginContour(GLUtessellator tessellator) { +public static final void gluTessBeginContour(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluTessBeginContour(); } @@ -702,6 +747,8 @@ public final void gluTessBeginContour(GLUtessellator tessellator) { * gluTessBeginPolygon} and * {@link #gluTessEndPolygon gluTessEndPolygon}. * + * Optional, throws GLUnsupportedException if not available in profile + * * @param tessellator * Specifies the tessellation object (created with * {@link #gluNewTess gluNewTess}). @@ -714,7 +761,8 @@ public final void gluTessBeginContour(GLUtessellator tessellator) { * @see #gluTessNormal gluTessNormal * @see #gluTessEndPolygon gluTessEndPolygon ****************************************************************************/ -public final void gluTessEndContour(GLUtessellator tessellator) { +public static final void gluTessEndContour(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluTessEndContour(); } @@ -735,6 +783,8 @@ public final void gluTessEndContour(GLUtessellator tessellator) { * gluTessBeginContour} and {@link #gluTessEndContour * gluTessEndContour} reference pages for more details.<P> * + * Optional, throws GLUnsupportedException if not available in profile + * * Once <b>gluTessEndPolygon</b> is called, the polygon is tessellated, and * the resulting triangles are described through callbacks. See * {@link #gluTessCallback gluTessCallback} for @@ -752,7 +802,8 @@ public final void gluTessEndContour(GLUtessellator tessellator) { * @see #gluTessNormal gluTessNormal * @see #gluTessBeginPolygon gluTessBeginPolygon ****************************************************************************/ -public final void gluTessEndPolygon(GLUtessellator tessellator) { +public static final void gluTessEndPolygon(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluTessEndPolygon(); } @@ -769,7 +820,8 @@ public final void gluTessEndPolygon(GLUtessellator tessellator) { * definition. See the {@link #gluTessVertex gluTessVertex} and {@link * #gluNextContour gluNextContour} reference pages for more * details.<P> - + * + * Optional, throws GLUnsupportedException if not available in profile * * Once {@link #gluEndPolygon gluEndPolygon} is called, * the polygon is tessellated, and the resulting triangles are described @@ -787,7 +839,8 @@ public final void gluTessEndPolygon(GLUtessellator tessellator) { * @see #gluTessBeginPolygon gluTessBeginPolygon * @see #gluTessBeginContour gluTessBeginContour ****************************************************************************/ -public final void gluBeginPolygon(GLUtessellator tessellator) { +public static final void gluBeginPolygon(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluBeginPolygon(); } @@ -802,6 +855,8 @@ public final void gluBeginPolygon(GLUtessellator tessellator) { * describe the new contour. Repeat this process until all contours have been * described.<P> * + * Optional, throws GLUnsupportedException if not available in profile + * * The type parameter defines what type of contour follows. The following * values are valid. <P> * @@ -858,7 +913,8 @@ public final void gluBeginPolygon(GLUtessellator tessellator) { * @see #gluTessEndContour gluTessEndContour * @see #gluTessVertex gluTessVertex ****************************************************************************/ -public final void gluNextContour(GLUtessellator tessellator, int type) { +public static final void gluNextContour(GLUtessellator tessellator, int type) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluNextContour(type); } @@ -875,6 +931,8 @@ public final void gluNextContour(GLUtessellator tessellator, int type) { * gluTessVertex} and {@link #gluNextContour * gluNextContour} reference pages for more details.<P> * + * Optional, throws GLUnsupportedException if not available in profile + * * Once <b>gluEndPolygon</b> is called, the polygon is tessellated, and the * resulting triangles are described through callbacks. See * {@link #gluTessCallback gluTessCallback} for @@ -891,7 +949,8 @@ public final void gluNextContour(GLUtessellator tessellator, int type) { * @see #gluTessBeginPolygon gluTessBeginPolygon * @see #gluTessBeginContour gluTessBeginContour ****************************************************************************/ -public final void gluEndPolygon(GLUtessellator tessellator) { +public static final void gluEndPolygon(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; tess.gluEndPolygon(); } @@ -1194,39 +1253,60 @@ public void gluPickMatrix(double x, double y, double delX, double delY, IntBuffe throw new GLUnsupportedException("not implemented"); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public int gluScaleImage( int format, int widthin, int heightin, int typein, java.nio.Buffer datain, int widthout, int heightout, int typeout, java.nio.Buffer dataout ) { throw new GLUnsupportedException("not implemented"); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public int gluBuild1DMipmapLevels( int target, int internalFormat, int width, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data ) { throw new GLUnsupportedException("not implemented"); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public int gluBuild1DMipmaps( int target, int internalFormat, int width, int format, int type, java.nio.Buffer data ) { throw new GLUnsupportedException("not implemented"); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public int gluBuild2DMipmapLevels( int target, int internalFormat, int width, int height, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data ) { throw new GLUnsupportedException("not implemented"); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public int gluBuild2DMipmaps( int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data ) { throw new GLUnsupportedException("not implemented"); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public int gluBuild3DMipmapLevels( int target, int internalFormat, int width, int height, int depth, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data) { throw new GLUnsupportedException("not implemented"); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public int gluBuild3DMipmaps( int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data ) { throw new GLUnsupportedException("not implemented"); diff --git a/make/glu-CustomJavaCode-gles1.java b/make/glu-CustomJavaCode-gl2es1.java index 067ec2f2e..253af74b0 100755 --- a/make/glu-CustomJavaCode-gles1.java +++ b/make/glu-CustomJavaCode-gl2es1.java @@ -31,7 +31,7 @@ static { * simultaneously. */ -public GLUes1() +public GLUgl2es1() { this.project = new ProjectFloat(); } @@ -78,52 +78,79 @@ public String gluGetString(int name) { // Quadric functionality // -/** Interface to C language function: <br> <code> void gluCylinder(GLUquadric * quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks); </code> */ +protected static boolean availableGLUquadricImpl = false; +protected static boolean checkedGLUquadricImpl = false; + +/** + * Optional, throws GLUnsupportedException if not available in profile + */ +protected static final void validateGLUquadricImpl() { + if(!checkedGLUquadricImpl) { + availableGLUquadricImpl = GLReflection.isClassAvailable("com.sun.opengl.impl.glu.GLUquadricImpl"); + checkedGLUquadricImpl = true; + } + if(!availableGLUquadricImpl) { + throw new GLUnsupportedException("GLUquadric not available (GLUquadricImpl)"); + } +} + + +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluCylinder(GLUquadric * quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks); </code> */ public final void gluCylinder(GLUquadric quad, double base, double top, double height, int slices, int stacks) { + validateGLUquadricImpl(); ((GLUquadricImpl) quad).drawCylinder(getCurrentGL2ES1(), (float) base, (float) top, (float) height, slices, stacks); } -/** Interface to C language function: <br> <code> void gluDeleteQuadric(GLUquadric * quad); </code> */ +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluDeleteQuadric(GLUquadric * quad); </code> */ public final void gluDeleteQuadric(GLUquadric quad) { + validateGLUquadricImpl(); } -/** Interface to C language function: <br> <code> void gluDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); </code> */ +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); </code> */ public final void gluDisk(GLUquadric quad, double inner, double outer, int slices, int loops) { + validateGLUquadricImpl(); ((GLUquadricImpl) quad).drawDisk(getCurrentGL2ES1(), (float) inner, (float) outer, slices, loops); } -/** Interface to C language function: <br> <code> GLUquadric * gluNewQuadric(void); </code> */ +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> GLUquadric * gluNewQuadric(void); </code> */ public final GLUquadric gluNewQuadric() { + validateGLUquadricImpl(); return new GLUquadricImpl(); } -/** Interface to C language function: <br> <code> void gluPartialDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); </code> */ +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluPartialDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); </code> */ public final void gluPartialDisk(GLUquadric quad, double inner, double outer, int slices, int loops, double start, double sweep) { + validateGLUquadricImpl(); ((GLUquadricImpl) quad).drawPartialDisk(getCurrentGL2ES1(), (float) inner, (float) outer, slices, loops, (float) start, (float) sweep); } -/** Interface to C language function: <br> <code> void gluQuadricDrawStyle(GLUquadric * quad, GLenum draw); </code> */ +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricDrawStyle(GLUquadric * quad, GLenum draw); </code> */ public final void gluQuadricDrawStyle(GLUquadric quad, int draw) { + validateGLUquadricImpl(); ((GLUquadricImpl) quad).setDrawStyle(draw); } -/** Interface to C language function: <br> <code> void gluQuadricNormals(GLUquadric * quad, GLenum normal); </code> */ +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricNormals(GLUquadric * quad, GLenum normal); </code> */ public final void gluQuadricNormals(GLUquadric quad, int normal) { + validateGLUquadricImpl(); ((GLUquadricImpl) quad).setNormals(normal); } -/** Interface to C language function: <br> <code> void gluQuadricOrientation(GLUquadric * quad, GLenum orientation); </code> */ +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricOrientation(GLUquadric * quad, GLenum orientation); </code> */ public final void gluQuadricOrientation(GLUquadric quad, int orientation) { + validateGLUquadricImpl(); ((GLUquadricImpl) quad).setOrientation(orientation); } -/** Interface to C language function: <br> <code> void gluQuadricTexture(GLUquadric * quad, GLboolean texture); </code> */ +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricTexture(GLUquadric * quad, GLboolean texture); </code> */ public final void gluQuadricTexture(GLUquadric quad, boolean texture) { + validateGLUquadricImpl(); ((GLUquadricImpl) quad).setTextureFlag(texture); } -/** Interface to C language function: <br> <code> void gluSphere(GLUquadric * quad, GLdouble radius, GLint slices, GLint stacks); </code> */ +/** Option (throws GLUnsupportedException if not available in profile). <br> Interface to C language function: <br> <code> void gluSphere(GLUquadric * quad, GLdouble radius, GLint slices, GLint stacks); </code> */ public final void gluSphere(GLUquadric quad, double radius, int slices, int stacks) { + validateGLUquadricImpl(); ((GLUquadricImpl) quad).drawSphere(getCurrentGL2ES1(), (float) radius, slices, stacks); } @@ -239,6 +266,19 @@ public final void gluPickMatrix(double x, double y, double delX, double delY, In //---------------------------------------------------------------------- // Mipmap and image scaling functionality +protected static boolean availableMipmap = false; +protected static boolean checkedMipmap = false; + +protected static final void validateMipmap() { + if(!checkedMipmap) { + availableMipmap = GLReflection.isClassAvailable("com.sun.opengl.impl.glu.mipmap.Mipmap"); + checkedMipmap = true; + } + if(!availableMipmap) { + throw new GLUnsupportedException("Mipmap not available"); + } +} + private final java.nio.ByteBuffer copyToByteBuffer(java.nio.Buffer buf) { if (buf instanceof java.nio.ByteBuffer) { if (buf.position() == 0) { @@ -256,9 +296,13 @@ private final java.nio.ByteBuffer copyToByteBuffer(java.nio.Buffer buf) { } } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public final int gluScaleImage( int format, int widthin, int heightin, int typein, java.nio.Buffer datain, int widthout, int heightout, int typeout, java.nio.Buffer dataout ) { + validateMipmap(); java.nio.ByteBuffer in = null; java.nio.ByteBuffer out = null; in = copyToByteBuffer(datain); @@ -293,50 +337,74 @@ public final int gluScaleImage( int format, int widthin, int heightin, } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public final int gluBuild1DMipmapLevels( int target, int internalFormat, int width, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data ) { + validateMipmap(); java.nio.ByteBuffer buffer = copyToByteBuffer(data); return( Mipmap.gluBuild1DMipmapLevels( getCurrentGL2ES1(), target, internalFormat, width, format, type, userLevel, baseLevel, maxLevel, buffer ) ); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public final int gluBuild1DMipmaps( int target, int internalFormat, int width, int format, int type, java.nio.Buffer data ) { + validateMipmap(); java.nio.ByteBuffer buffer = copyToByteBuffer(data); return( Mipmap.gluBuild1DMipmaps( getCurrentGL2ES1(), target, internalFormat, width, format, type, buffer ) ); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public final int gluBuild2DMipmapLevels( int target, int internalFormat, int width, int height, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data ) { + validateMipmap(); // While the code below handles other data types, it doesn't handle non-ByteBuffers data = copyToByteBuffer(data); return( Mipmap.gluBuild2DMipmapLevels( getCurrentGL2ES1(), target, internalFormat, width, height, format, type, userLevel, baseLevel, maxLevel, data ) ); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public final int gluBuild2DMipmaps( int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data ) { + validateMipmap(); // While the code below handles other data types, it doesn't handle non-ByteBuffers data = copyToByteBuffer(data); return( Mipmap.gluBuild2DMipmaps( getCurrentGL2ES1(), target, internalFormat, width, height, format, type, data) ); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public final int gluBuild3DMipmapLevels( int target, int internalFormat, int width, int height, int depth, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data) { + validateMipmap(); java.nio.ByteBuffer buffer = copyToByteBuffer(data); return( Mipmap.gluBuild3DMipmapLevels( getCurrentGL2ES1(), target, internalFormat, width, height, depth, format, type, userLevel, baseLevel, maxLevel, buffer) ); } +/** + * Optional, throws GLUnsupportedException if not available in profile + */ public final int gluBuild3DMipmaps( int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data ) { + validateMipmap(); java.nio.ByteBuffer buffer = copyToByteBuffer(data); return( Mipmap.gluBuild3DMipmaps( getCurrentGL2ES1(), target, internalFormat, width, height, depth, format, type, buffer ) ); diff --git a/make/glu-es1_if.cfg b/make/glu-base.cfg index d6d0bc397..39a699eee 100755 --- a/make/glu-es1_if.cfg +++ b/make/glu-base.cfg @@ -6,7 +6,6 @@ NativeOutputDir ../build/gensrc/native/jogl Style ImplOnly ImplPackage javax.media.opengl.glu ImplJavaClass GLU -#AccessControl GLU PUBLIC_ABSTRACT AccessControl GLU PUBLIC Ignore gluBuild1DMipmapLevels @@ -18,7 +17,7 @@ Ignore gluBuild3DMipmaps Ignore gluScaleImage # Custom Java code for GLU class -IncludeAs CustomJavaCode GLU glu-CustomJavaCode-gles1_if.java +IncludeAs CustomJavaCode GLU glu-CustomJavaCode-base.java Include glu-common.cfg diff --git a/make/glu-es1.cfg b/make/glu-gl2es1.cfg index f5cc4d7ae..4a73f66c8 100755 --- a/make/glu-es1.cfg +++ b/make/glu-gl2es1.cfg @@ -1,12 +1,12 @@ # This .cfg file is used to generate the GLU implementation for OpenGL ES 1.0, # where it is pure Java. JavaOutputDir ../build/gensrc/classes -NativeOutputDir ../build/gensrc/native/jogl/es1 +NativeOutputDir ../build/gensrc/native/jogl/gl2es1 Style ImplOnly -ImplPackage javax.media.opengl.glu.es1 -ImplJavaClass GLUes1 -ParentClass GLUes1 GLU +ImplPackage javax.media.opengl.glu.gl2es1 +ImplJavaClass GLUgl2es1 +ParentClass GLUgl2es1 GLU Ignore gluBuild1DMipmapLevels Ignore gluBuild1DMipmaps @@ -17,7 +17,7 @@ Ignore gluBuild3DMipmaps Ignore gluScaleImage # Custom Java code for GLU class -IncludeAs CustomJavaCode GLUes1 glu-CustomJavaCode-gles1.java +IncludeAs CustomJavaCode GLUgl2es1 glu-CustomJavaCode-gl2es1.java Import javax.media.opengl.GLES1 Import com.sun.opengl.impl.glu.mipmap.Mipmap diff --git a/make/lstjars.sh b/make/lstjars.sh index c0ed063d8..264d782ac 100644 --- a/make/lstjars.sh +++ b/make/lstjars.sh @@ -65,6 +65,10 @@ echo JOGL GL2 OSWIN with AWT report jogl.core.jar jogl.oswin.jar jogl.gl2.jar jogl.awt.jar obj/tmp/libjogl_gl2.so.gz obj/tmp/libjogl_awt.so.gz echo +echo JOGL GLU +report jogl.glu.*jar +echo + echo JOGL EVERYTHING report jogl.all.jar echo diff --git a/src/classes/com/sun/opengl/impl/GLReflection.java b/src/classes/com/sun/opengl/impl/GLReflection.java index 5e55aba31..bbcb7c8ea 100644 --- a/src/classes/com/sun/opengl/impl/GLReflection.java +++ b/src/classes/com/sun/opengl/impl/GLReflection.java @@ -41,6 +41,16 @@ import javax.media.opengl.*; public final class GLReflection { + public static final boolean isClassAvailable(String clazzName) { + try { + Class clazz = Class.forName(clazzName); + if (null!=clazz) { + return true; + } + } catch (Exception e) { } + return false; + } + public static final Constructor getConstructor(String clazzName, Class[] cstrArgTypes) { Class factoryClass = null; Constructor factory = null; @@ -57,7 +67,7 @@ public final class GLReflection { } return factory; } catch (Exception e) { - throw new GLException(e); + throw new GLUnsupportedException(e); } } @@ -72,7 +82,7 @@ public final class GLReflection { factory = getConstructor(clazzName, cstrArgTypes); return factory.newInstance( cstrArgs ) ; } catch (Exception e) { - throw new GLException(e); + throw new GLUnsupportedException(e); } } |