From 0b708395a18eb6a2ae5372ff414bc75830ce19b6 Mon Sep 17 00:00:00 2001 From: Michael Bien <mbien@fh-landshut.de> Date: Mon, 29 Mar 2010 15:38:31 +0200 Subject: modifications due to refactorings in gluegen and jogl. --- src/redbook/nbproject/build-impl.xml | 246 +++++++++++++++++--------- src/redbook/nbproject/genfiles.properties | 4 +- src/redbook/src/glredbook10/bezcurve.java | 6 +- src/redbook/src/glredbook10/bezmesh.java | 6 +- src/redbook/src/glredbook10/bezsurf.java | 6 +- src/redbook/src/glredbook10/checker.java | 2 +- src/redbook/src/glredbook10/checker2.java | 2 +- src/redbook/src/glredbook10/chess.java | 2 +- src/redbook/src/glredbook10/feedback.java | 2 +- src/redbook/src/glredbook10/font.java | 4 +- src/redbook/src/glredbook10/mipmap.java | 19 +- src/redbook/src/glredbook10/pickdepth.java | 2 +- src/redbook/src/glredbook10/pickline.java | 2 +- src/redbook/src/glredbook10/picksquare.java | 2 +- src/redbook/src/glredbook10/select.java | 2 +- src/redbook/src/glredbook10/stroke.java | 2 +- src/redbook/src/glredbook10/texgen.java | 5 +- src/redbook/src/glredbook10/texturesurf.java | 36 ++-- src/redbook/src/glredbook11/image.java | 4 +- src/redbook/src/glredbook11/texbind.java | 6 +- src/redbook/src/glredbook11/texgen.java | 8 +- src/redbook/src/glredbook11/texsub.java | 6 +- src/redbook/src/glredbook11/varray.java | 10 +- src/redbook/src/glredbook11/wrap.java | 4 +- src/redbook/src/glredbook12x/colormatrix.java | 4 +- src/redbook/src/glredbook12x/colortable.java | 6 +- src/redbook/src/glredbook12x/convolution.java | 14 +- src/redbook/src/glredbook12x/histogram.java | 6 +- src/redbook/src/glredbook12x/minmax.java | 6 +- src/redbook/src/glredbook12x/multitex.java | 6 +- src/redbook/src/glredbook12x/texture3d.java | 4 +- src/redbook/src/glredbook1314/combiner.java | 6 +- src/redbook/src/glredbook1314/cubemap.java | 12 +- src/redbook/src/glredbook1314/mvarray.java | 8 +- src/redbook/src/glredbook1314/shadowmap.java | 6 +- 35 files changed, 262 insertions(+), 204 deletions(-) (limited to 'src/redbook') diff --git a/src/redbook/nbproject/build-impl.xml b/src/redbook/nbproject/build-impl.xml index 71d5842..ecbb2fe 100644 --- a/src/redbook/nbproject/build-impl.xml +++ b/src/redbook/nbproject/build-impl.xml @@ -81,6 +81,7 @@ is divided into following sections: </target> <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init"> <available file="${manifest.file}" property="manifest.available"/> + <available file="${application.splash}" property="splashscreen.available"/> <condition property="main.class.available"> <and> <isset property="main.class"/> @@ -109,23 +110,40 @@ is divided into following sections: <isset property="do.mkdist"/> </and> </condition> - <condition property="manifest.available+mkdist.available"> + <condition property="manifest.available+main.class+mkdist.available+splashscreen.available"> <and> - <istrue value="${manifest.available}"/> - <isset property="do.mkdist"/> + <istrue value="${manifest.available+main.class+mkdist.available}"/> + <istrue value="${splashscreen.available}"/> </and> </condition> - <condition property="manifest.available-mkdist.available"> - <or> - <istrue value="${manifest.available}"/> - <isset property="do.mkdist"/> - </or> + <condition property="do.archive"> + <not> + <istrue value="${jar.archive.disabled}"/> + </not> </condition> - <condition property="manifest.available+main.class-mkdist.available"> - <or> + <condition property="do.archive+manifest.available"> + <and> + <isset property="manifest.available"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+manifest.available+main.class"> + <and> <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </or> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+manifest.available+main.class+mkdist.available"> + <and> + <istrue value="${manifest.available+main.class+mkdist.available}"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available"> + <and> + <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/> + <istrue value="${do.archive}"/> + </and> </condition> <condition property="have.tests"> <or> @@ -182,6 +200,8 @@ is divided into following sections: <length length="0" string="${endorsed.classpath}" when="greater"/> </condition> <property name="javac.fork" value="false"/> + <property name="jar.index" value="false"/> + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> </target> <target name="-post-init"> <!-- Empty placeholder for easier customization. --> @@ -208,11 +228,53 @@ is divided into following sections: </sequential> </macrodef> </target> - <target name="-init-macrodef-javac"> + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${build.classes.dir}" name="destdir"/> + <attribute default="${javac.classpath}" name="classpath"/> + <attribute default="${javac.processorpath}" name="processorpath"/> + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="${javac.debug}" name="debug"/> + <attribute default="${empty.dir}" name="sourcepath"/> + <attribute default="${empty.dir}" name="gensrcdir"/> + <element name="customize" optional="true"/> + <sequential> + <property location="${build.dir}/empty" name="empty.dir"/> + <mkdir dir="${empty.dir}"/> + <mkdir dir="@{apgeneratedsrcdir}"/> + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> + <src> + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> + <include name="*"/> + </dirset> + </src> + <classpath> + <path path="@{classpath}"/> + </classpath> + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.compilerargs}"/> + <compilerarg value="-processorpath"/> + <compilerarg path="@{processorpath}"/> + <compilerarg line="${ap.processors.internal}"/> + <compilerarg line="${annotation.processing.processor.options}"/> + <compilerarg value="-s"/> + <compilerarg path="@{apgeneratedsrcdir}"/> + <compilerarg line="${ap.proc.none.internal}"/> + <customize/> + </javac> + </sequential> + </macrodef> + </target> + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> <attribute default="${src.dir}" name="srcdir"/> <attribute default="${build.classes.dir}" name="destdir"/> <attribute default="${javac.classpath}" name="classpath"/> + <attribute default="${javac.processorpath}" name="processorpath"/> + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> <attribute default="${includes}" name="includes"/> <attribute default="${excludes}" name="excludes"/> <attribute default="${javac.debug}" name="debug"/> @@ -237,6 +299,8 @@ is divided into following sections: </javac> </sequential> </macrodef> + </target> + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> <attribute default="${src.dir}" name="srcdir"/> <attribute default="${build.classes.dir}" name="destdir"/> @@ -384,14 +448,65 @@ is divided into following sections: </sequential> </macrodef> </target> + <target name="-init-macrodef-copylibs"> + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> + <element name="customize" optional="true"/> + <sequential> + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> + <pathconvert property="run.classpath.without.build.classes.dir"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to=""/> + </pathconvert> + <pathconvert pathsep=" " property="jar.classpath"> + <path path="${run.classpath.without.build.classes.dir}"/> + <chainedmapper> + <flattenmapper/> + <globmapper from="*" to="lib/*"/> + </chainedmapper> + </pathconvert> + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> + <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> + <fileset dir="${build.classes.dir}"/> + <manifest> + <attribute name="Class-Path" value="${jar.classpath}"/> + <customize/> + </manifest> + </copylibs> + </sequential> + </macrodef> + </target> <target name="-init-presetdef-jar"> <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> - <jar compress="${jar.compress}" jarfile="${dist.jar}"> + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> <j2seproject1:fileset dir="${build.classes.dir}"/> </jar> </presetdef> </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/> + <target name="-init-ap-cmdline-properties"> + <property name="annotation.processing.enabled" value="true"/> + <property name="annotation.processing.processors.list" value=""/> + <property name="annotation.processing.processor.options" value=""/> + <property name="annotation.processing.run.all.processors" value="true"/> + <property name="javac.processorpath" value="${javac.classpath}"/> + <property name="javac.test.processorpath" value="${javac.test.classpath}"/> + <condition property="ap.supported.internal" value="true"> + <not> + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> + </not> + </condition> + </target> + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> + <isfalse value="${annotation.processing.run.all.processors}"/> + </condition> + <condition else="" property="ap.proc.none.internal" value="-proc:none"> + <isfalse value="${annotation.processing.enabled}"/> + </condition> + </target> + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> + <property name="ap.cmd.line.internal" value=""/> + </target> + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> <!-- =================== COMPILATION SECTION @@ -435,12 +550,18 @@ is divided into following sections: </pathconvert> <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> </target> - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile"> + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> <copy todir="${build.classes.dir}"> <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> </copy> </target> + <target if="has.persistence.xml" name="-copy-persistence-xml"> + <mkdir dir="${build.classes.dir}/META-INF"/> + <copy todir="${build.classes.dir}/META-INF"> + <fileset dir="${meta.inf.dir}" includes="persistence.xml"/> + </copy> + </target> <target name="-post-compile"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> @@ -473,13 +594,13 @@ is divided into following sections: <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available"> + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available"> <j2seproject1:jar/> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available"> + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class"> <j2seproject1:jar manifest="${manifest.file}"/> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> <j2seproject1:jar manifest="${manifest.file}"> <j2seproject1:manifest> <j2seproject1:attribute name="Main-Class" value="${main.class}"/> @@ -494,78 +615,35 @@ is divided into following sections: </pathconvert> <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries"> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <pathconvert property="run.classpath.without.build.classes.dir"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to=""/> - </pathconvert> - <pathconvert pathsep=" " property="jar.classpath"> - <path path="${run.classpath.without.build.classes.dir}"/> - <chainedmapper> - <flattenmapper/> - <globmapper from="*" to="lib/*"/> - </chainedmapper> - </pathconvert> - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> - <manifest> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen"> + <basename file="${application.splash}" property="splashscreen.basename"/> + <mkdir dir="${build.classes.dir}/META-INF"/> + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> + <j2seproject3:copylibs> + <customize> <attribute name="Main-Class" value="${main.class}"/> - <attribute name="Class-Path" value="${jar.classpath}"/> - </manifest> - </copylibs> + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> + </customize> + </j2seproject3:copylibs> <echo>To run this application from the command line without Ant, try:</echo> <property location="${dist.jar}" name="dist.jar.resolved"/> <echo>java -jar "${dist.jar.resolved}"</echo> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available"> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <pathconvert property="run.classpath.without.build.classes.dir"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to=""/> - </pathconvert> - <pathconvert pathsep=" " property="jar.classpath"> - <path path="${run.classpath.without.build.classes.dir}"/> - <chainedmapper> - <flattenmapper/> - <globmapper from="*" to="lib/*"/> - </chainedmapper> - </pathconvert> - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> - <manifest> - <attribute name="Class-Path" value="${jar.classpath}"/> - </manifest> - </copylibs> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available"> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <pathconvert property="run.classpath.without.build.classes.dir"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to=""/> - </pathconvert> - <pathconvert pathsep=" " property="jar.classpath"> - <path path="${run.classpath.without.build.classes.dir}"/> - <chainedmapper> - <flattenmapper/> - <globmapper from="*" to="lib/*"/> - </chainedmapper> - </pathconvert> - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> - <manifest> - <attribute name="Class-Path" value="${jar.classpath}"/> - </manifest> - </copylibs> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available"> + <j2seproject3:copylibs> + <customize> + <attribute name="Main-Class" value="${main.class}"/> + </customize> + </j2seproject3:copylibs> + <echo>To run this application from the command line without Ant, try:</echo> + <property location="${dist.jar}" name="dist.jar.resolved"/> + <echo>java -jar "${dist.jar.resolved}"</echo> </target> <target name="-post-jar"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar,jnlp" description="Build JAR." name="jar"/> + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-post-jar,jnlp" description="Build JAR." name="jar"/> <!-- ================= EXECUTION SECTION @@ -635,7 +713,7 @@ is divided into following sections: JAVADOC SECTION =============== --> - <target depends="init" name="-javadoc-build"> + <target depends="init" if="have.sources" name="-javadoc-build"> <mkdir dir="${dist.javadoc.dir}"/> <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> <classpath> @@ -669,7 +747,7 @@ is divided into following sections: <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> </target> <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> - <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> <copy todir="${build.test.classes.dir}"> <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> </copy> @@ -686,7 +764,7 @@ is divided into following sections: <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> - <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> <copy todir="${build.test.classes.dir}"> <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> </copy> diff --git a/src/redbook/nbproject/genfiles.properties b/src/redbook/nbproject/genfiles.properties index 7e724ad..11539ee 100644 --- a/src/redbook/nbproject/genfiles.properties +++ b/src/redbook/nbproject/genfiles.properties @@ -1,5 +1,5 @@ # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=f7c0fcba -nbproject/build-impl.xml.script.CRC32=d690f492 -nbproject/build-impl.xml.stylesheet.CRC32=576378a2@1.32.1.45 +nbproject/build-impl.xml.script.CRC32=a7700f85 +nbproject/build-impl.xml.stylesheet.CRC32=c75ce636@1.36.0.45 diff --git a/src/redbook/src/glredbook10/bezcurve.java b/src/redbook/src/glredbook10/bezcurve.java index 2399d4f..7e9e67e 100644 --- a/src/redbook/src/glredbook10/bezcurve.java +++ b/src/redbook/src/glredbook10/bezcurve.java @@ -7,7 +7,7 @@ import java.nio.FloatBuffer; import javax.media.opengl.*; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import javax.media.opengl.awt.GLJPanel; @@ -23,7 +23,7 @@ public class bezcurve// { -2.0f, 4.0f, 0.0f }, { 2.0f, -4.0f, 0.0f }, { 4.0f, 4.0f, 0.0f } }; private FloatBuffer ctrlpointBuf; - // = BufferUtil.newFloatBuffer(ctrlpoints[0].length * ctrlpoints.length); + // = GLBuffers.newDirectFloatBuffer(ctrlpoints[0].length * ctrlpoints.length); @Override protected GLJPanel createDrawable() { @@ -55,7 +55,7 @@ public class bezcurve// public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); // need to convert 2d array to buffer type - ctrlpointBuf = BufferUtil.newFloatBuffer(ctrlpoints[0].length + ctrlpointBuf = GLBuffers.newDirectFloatBuffer(ctrlpoints[0].length * ctrlpoints.length); for (int i = 0; i < ctrlpoints.length; i++) { ctrlpointBuf.put(ctrlpoints[i]); diff --git a/src/redbook/src/glredbook10/bezmesh.java b/src/redbook/src/glredbook10/bezmesh.java index 1dbc239..1dda4e0 100644 --- a/src/redbook/src/glredbook10/bezmesh.java +++ b/src/redbook/src/glredbook10/bezmesh.java @@ -6,7 +6,7 @@ import javax.swing.*; import java.nio.*; import javax.media.opengl.*; -import com.jogamp.opengl.util.*; +import com.jogamp.gluegen.runtime.Buffers; import javax.media.opengl.awt.GLJPanel; /** @@ -29,9 +29,7 @@ public class bezmesh// { { -1.5f, 1.5f, -2.0f }, { -0.5f, 1.5f, -2.0f }, { 0.5f, 1.5f, 0.0f }, { 1.5f, 1.5f, -1.0f } } }; // need float buffer instead of n-dimensional array above - private FloatBuffer ctrlpointsBuf = BufferUtil - .newFloatBuffer(ctrlpoints.length * ctrlpoints[0].length - * ctrlpoints[0][0].length); + private FloatBuffer ctrlpointsBuf = Buffers.newDirectFloatBuffer(ctrlpoints.length * ctrlpoints[0].length * ctrlpoints[0][0].length); {// SO copy 4x4x3 array above to float buffer for (int i = 0; i < ctrlpoints.length; i++) { // System.out.print(ctrlpoints.length+ " "); diff --git a/src/redbook/src/glredbook10/bezsurf.java b/src/redbook/src/glredbook10/bezsurf.java index 1503fd2..96faa8e 100644 --- a/src/redbook/src/glredbook10/bezsurf.java +++ b/src/redbook/src/glredbook10/bezsurf.java @@ -6,7 +6,7 @@ import javax.swing.*; import java.nio.*; import javax.media.opengl.*; -import com.jogamp.opengl.util.*; +import com.jogamp.gluegen.runtime.Buffers; import javax.media.opengl.awt.GLJPanel; /** @@ -29,9 +29,7 @@ public class bezsurf// { { -1.5f, 1.5f, -2.0f }, { -0.5f, 1.5f, -2.0f }, { 0.5f, 1.5f, 0.0f }, { 1.5f, 1.5f, -1.0f } } }; // need float buffer instead of n-dimensional array above - private FloatBuffer ctrlpointsBuf = BufferUtil - .newFloatBuffer(ctrlpoints.length * ctrlpoints[0].length - * ctrlpoints[0][0].length); + private FloatBuffer ctrlpointsBuf = Buffers.newDirectFloatBuffer(ctrlpoints.length * ctrlpoints[0].length * ctrlpoints[0][0].length); {// SO copy 4x4x3 array above to float buffer for (int i = 0; i < ctrlpoints.length; i++) { // System.out.print(ctrlpoints.length+ " "); diff --git a/src/redbook/src/glredbook10/checker.java b/src/redbook/src/glredbook10/checker.java index c92a6d1..5da7024 100644 --- a/src/redbook/src/glredbook10/checker.java +++ b/src/redbook/src/glredbook10/checker.java @@ -28,7 +28,7 @@ public class checker // // private byte checkImage[][][] = new // byte[checkImageWidth][checkImageHeight][color]; private ByteBuffer checkImageBuf = // - BufferUtil.newByteBuffer(checkImageHeight * checkImageWidth * color); + GLBuffers.newDirectByteBuffer(checkImageHeight * checkImageWidth * color); @Override protected GLJPanel createDrawable() { diff --git a/src/redbook/src/glredbook10/checker2.java b/src/redbook/src/glredbook10/checker2.java index 7c41110..20a3dd5 100644 --- a/src/redbook/src/glredbook10/checker2.java +++ b/src/redbook/src/glredbook10/checker2.java @@ -27,7 +27,7 @@ public class checker2// private static final int color = 3; private byte checkImage[][][] = new byte[checkImageWidth][checkImageHeight][color]; private ByteBuffer checkImageBuf = // - BufferUtil.newByteBuffer(checkImageHeight * checkImageWidth * color); + GLBuffers.newDirectByteBuffer(checkImageHeight * checkImageWidth * color); @Override protected GLJPanel createDrawable() { diff --git a/src/redbook/src/glredbook10/chess.java b/src/redbook/src/glredbook10/chess.java index fcbf4e9..beb9f7a 100644 --- a/src/redbook/src/glredbook10/chess.java +++ b/src/redbook/src/glredbook10/chess.java @@ -26,7 +26,7 @@ public class chess// private static final int color = 3; // private byte checkImage[][][] = new byte[checkImageWidth][checkImageHeight][color]; private ByteBuffer checkImageBuf = // - BufferUtil.newByteBuffer(checkImageHeight * checkImageWidth * color); + GLBuffers.newDirectByteBuffer(checkImageHeight * checkImageWidth * color); @Override protected GLJPanel createDrawable() { diff --git a/src/redbook/src/glredbook10/feedback.java b/src/redbook/src/glredbook10/feedback.java index 9f26aee..b824a55 100644 --- a/src/redbook/src/glredbook10/feedback.java +++ b/src/redbook/src/glredbook10/feedback.java @@ -56,7 +56,7 @@ public class feedback// GL2 gl = drawable.getGL().getGL2(); // float feedBuffer[] = new float[1024]; - FloatBuffer feedBuf = BufferUtil.newFloatBuffer(1024); + FloatBuffer feedBuf = GLBuffers.newDirectFloatBuffer(1024); int size; gl.glMatrixMode(GL2.GL_PROJECTION); diff --git a/src/redbook/src/glredbook10/font.java b/src/redbook/src/glredbook10/font.java index 8019bd4..accc262 100644 --- a/src/redbook/src/glredbook10/font.java +++ b/src/redbook/src/glredbook10/font.java @@ -108,7 +108,7 @@ public class font // } private void printString(GL2 gl, String s) { - ByteBuffer str = BufferUtil.newByteBuffer(s.length()); + ByteBuffer str = GLBuffers.newDirectByteBuffer(s.length()); str.put(s.getBytes()); str.rewind(); // @@ -359,7 +359,7 @@ public class font // { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, (byte) 0x8f, (byte) 0xf1, 0x60, 0x00, 0x00, 0x00 } }; private ByteBuffer rastersBuf = // - BufferUtil.newByteBuffer(rasters.length * rasters[0].length); + GLBuffers.newDirectByteBuffer(rasters.length * rasters[0].length); { for (int i = 0; i < rasters.length; i++) rastersBuf.put((byte[]) rasters[i]);// put each array into byte diff --git a/src/redbook/src/glredbook10/mipmap.java b/src/redbook/src/glredbook10/mipmap.java index b8bfe83..3533acd 100644 --- a/src/redbook/src/glredbook10/mipmap.java +++ b/src/redbook/src/glredbook10/mipmap.java @@ -5,6 +5,7 @@ import javax.swing.*; import java.nio.*; +import com.jogamp.gluegen.runtime.Buffers; import javax.media.opengl.*; import com.jogamp.opengl.util.*; import javax.media.opengl.awt.GLJPanel; @@ -29,18 +30,12 @@ public class mipmap// // private byte mipmapImage4[][][] = new byte[4][4][color]; // private byte mipmapImage2[][][] = new byte[2][2][color]; // private byte mipmapImage1[][][] = new byte[1][1][color]; - private ByteBuffer mipmapImage32Buf = BufferUtil - .newByteBuffer(32 * 32 * color); - private ByteBuffer mipmapImage16Buf = BufferUtil - .newByteBuffer(16 * 16 * color); - private ByteBuffer mipmapImage8Buf = BufferUtil - .newByteBuffer(8 * 8 * color); - private ByteBuffer mipmapImage4Buf = BufferUtil - .newByteBuffer(4 * 4 * color); - private ByteBuffer mipmapImage2Buf = BufferUtil - .newByteBuffer(2 * 2 * color); - private ByteBuffer mipmapImage1Buf = BufferUtil - .newByteBuffer(1 * 1 * color); + private ByteBuffer mipmapImage32Buf = Buffers.newDirectByteBuffer(32 * 32 * color); + private ByteBuffer mipmapImage16Buf = Buffers.newDirectByteBuffer(16 * 16 * color); + private ByteBuffer mipmapImage8Buf = Buffers.newDirectByteBuffer(8 * 8 * color); + private ByteBuffer mipmapImage4Buf = Buffers.newDirectByteBuffer(4 * 4 * color); + private ByteBuffer mipmapImage2Buf = Buffers.newDirectByteBuffer(2 * 2 * color); + private ByteBuffer mipmapImage1Buf = Buffers.newDirectByteBuffer(1 * 1 * color); @Override protected GLJPanel createDrawable() { diff --git a/src/redbook/src/glredbook10/pickdepth.java b/src/redbook/src/glredbook10/pickdepth.java index e7979a2..2426702 100644 --- a/src/redbook/src/glredbook10/pickdepth.java +++ b/src/redbook/src/glredbook10/pickdepth.java @@ -146,7 +146,7 @@ public class pickdepth// */ private void pickRects(GL2 gl) { int[] selectBuf = new int[BUFSIZE]; - IntBuffer selectBuffer = BufferUtil.newIntBuffer(BUFSIZE); + IntBuffer selectBuffer = GLBuffers.newDirectIntBuffer(BUFSIZE); int hits; int viewport[] = new int[4]; // int x, y; diff --git a/src/redbook/src/glredbook10/pickline.java b/src/redbook/src/glredbook10/pickline.java index 8d7eb4b..bb6b5c7 100644 --- a/src/redbook/src/glredbook10/pickline.java +++ b/src/redbook/src/glredbook10/pickline.java @@ -112,7 +112,7 @@ public class pickline// */ private void pickLine(GL2 gl) { int selectBuf[] = new int[BUFSIZE]; - IntBuffer selectBuffer = BufferUtil.newIntBuffer(BUFSIZE); + IntBuffer selectBuffer = GLBuffers.newDirectIntBuffer(BUFSIZE); int hits; int viewport[] = new int[4]; diff --git a/src/redbook/src/glredbook10/picksquare.java b/src/redbook/src/glredbook10/picksquare.java index 0087e79..2d9ff14 100644 --- a/src/redbook/src/glredbook10/picksquare.java +++ b/src/redbook/src/glredbook10/picksquare.java @@ -152,7 +152,7 @@ public class picksquare// // private void pickSquares(GL2 gl, int button, int state, int x, int y) private void pickSquares(GL2 gl) { int selectBuf[] = new int[BUFSIZE]; - IntBuffer selectBuffer = BufferUtil.newIntBuffer(BUFSIZE); + IntBuffer selectBuffer = GLBuffers.newDirectIntBuffer(BUFSIZE); int hits; int viewport[] = new int[4]; diff --git a/src/redbook/src/glredbook10/select.java b/src/redbook/src/glredbook10/select.java index 98609c2..8943228 100644 --- a/src/redbook/src/glredbook10/select.java +++ b/src/redbook/src/glredbook10/select.java @@ -196,7 +196,7 @@ public class select// private void selectObjects(GL2 gl) { int selectBuf[] = new int[BUFSIZE]; - IntBuffer selectBuffer = BufferUtil.newIntBuffer(BUFSIZE); + IntBuffer selectBuffer = GLBuffers.newDirectIntBuffer(BUFSIZE); int hits; gl.glSelectBuffer(BUFSIZE, selectBuffer); diff --git a/src/redbook/src/glredbook10/stroke.java b/src/redbook/src/glredbook10/stroke.java index f8b4791..081ba3d 100644 --- a/src/redbook/src/glredbook10/stroke.java +++ b/src/redbook/src/glredbook10/stroke.java @@ -210,7 +210,7 @@ public class stroke// // private void printStrokedString(char *s) private void printStrokedString(GL2 gl, String s) { int len = s.length(); - ByteBuffer str = BufferUtil.newByteBuffer(len); + ByteBuffer str = GLBuffers.newDirectByteBuffer(len); str.put(s.getBytes()); str.rewind(); gl.glCallLists(len, GL.GL_BYTE, str); diff --git a/src/redbook/src/glredbook10/texgen.java b/src/redbook/src/glredbook10/texgen.java index c94616a..821dae7 100644 --- a/src/redbook/src/glredbook10/texgen.java +++ b/src/redbook/src/glredbook10/texgen.java @@ -5,7 +5,7 @@ import javax.swing.*; import java.nio.*; -import com.jogamp.opengl.util.*; +import com.jogamp.gluegen.runtime.Buffers; import com.jogamp.opengl.util.gl2.GLUT; import javax.media.opengl.*; import javax.media.opengl.awt.GLJPanel; @@ -22,8 +22,7 @@ public class texgen// private static final int stripeImageWidth = 32; private byte stripeImage[] = new byte[3 * stripeImageWidth]; - private ByteBuffer stripeImageBuf = BufferUtil - .newByteBuffer(stripeImage.length); + private ByteBuffer stripeImageBuf = Buffers.newDirectByteBuffer(stripeImage.length); /* glTexGen stuff: */ private float sgenparams[] = { 1.0f, 1.0f, 1.0f, 0.0f }; diff --git a/src/redbook/src/glredbook10/texturesurf.java b/src/redbook/src/glredbook10/texturesurf.java index 34f561d..3c4d947 100644 --- a/src/redbook/src/glredbook10/texturesurf.java +++ b/src/redbook/src/glredbook10/texturesurf.java @@ -6,7 +6,7 @@ import java.awt.event.*; import java.nio.*; -import com.jogamp.opengl.util.*; +import com.jogamp.gluegen.runtime.Buffers; import javax.media.opengl.*; import javax.media.opengl.awt.GLJPanel; @@ -20,6 +20,7 @@ import javax.media.opengl.awt.GLJPanel; public class texturesurf// extends GLSkeleton<GLJPanel> implements GLEventListener, KeyListener { + // as from C version of file private static final float ctrlpoints[][][] = new float[][][] { { { -1.5f, -1.5f, 4.0f }, { -0.5f, -1.5f, 2.0f }, @@ -30,10 +31,10 @@ public class texturesurf// { 0.5f, 0.5f, 3.0f }, { 1.5f, 0.5f, 4.0f } }, { { -1.5f, 1.5f, -2.0f }, { -0.5f, 1.5f, -2.0f }, { 0.5f, 1.5f, 0.0f }, { 1.5f, 1.5f, -1.0f } } }; + // need float buffer instead of n-dimensional array above - private FloatBuffer ctrlpointsBuf = BufferUtil - .newFloatBuffer(ctrlpoints.length * ctrlpoints[0].length - * ctrlpoints[0][0].length); + private FloatBuffer ctrlpointsBuf = Buffers.newDirectFloatBuffer(ctrlpoints.length * ctrlpoints[0].length * ctrlpoints[0][0].length); + {// SO copy 4x4x3 array above to float buffer for (int i = 0; i < ctrlpoints.length; i++) // System.out.print(ctrlpoints.length+ " "); @@ -51,9 +52,7 @@ public class texturesurf// private float[][][] texpts = new float[][][] { { { 0.0f, 0.0f }, { 0.0f, 1.0f } }, { { 1.0f, 0.0f }, { 1.0f, 1.0f } } }; - private FloatBuffer texptsBuf = BufferUtil - // - .newFloatBuffer(texpts.length * texpts[0].length * texpts[1].length); + private FloatBuffer texptsBuf = Buffers.newDirectFloatBuffer(texpts.length * texpts[0].length * texpts[1].length); { for (int i = 0; i < texpts.length; i++) // System.out.print(ctrlpoints.length+ " "); @@ -72,7 +71,7 @@ public class texturesurf// private static final int imageWidth = 64; private static final int imageHeight = 64; private static byte image[] = new byte[3 * imageWidth * imageHeight]; - private static ByteBuffer imageBuf = BufferUtil.newByteBuffer(image.length); + private static ByteBuffer imageBuf = Buffers.newDirectByteBuffer(image.length); @Override protected GLJPanel createDrawable() { @@ -104,23 +103,17 @@ public class texturesurf// GL2 gl = drawable.getGL().getGL2(); // gl.glMap2f(GL2.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, ctrlpointsBuf); - gl.glMap2f(GL2.GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, - texptsBuf); + gl.glMap2f(GL2.GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, texptsBuf); gl.glEnable(GL2.GL_MAP2_TEXTURE_COORD_2); gl.glEnable(GL2.GL_MAP2_VERTEX_3); gl.glMapGrid2f(20, 0.0f, 1.0f, 20, 0.0f, 1.0f); makeImage(); gl.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_DECAL); - gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, - GL2.GL_REPEAT); - gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, - GL2.GL_REPEAT); - gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, - GL.GL_NEAREST); - gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, - GL.GL_NEAREST); - gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGB, imageWidth, - imageHeight, 0, GL2.GL_RGB, GL.GL_UNSIGNED_BYTE, imageBuf); + gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_REPEAT); + gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_REPEAT); + gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); + gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); + gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGB, imageWidth, imageHeight, 0, GL2.GL_RGB, GL.GL_UNSIGNED_BYTE, imageBuf); gl.glEnable(GL2.GL_TEXTURE_2D); gl.glEnable(GL.GL_DEPTH_TEST); gl.glShadeModel(GL2.GL_FLAT); @@ -153,8 +146,7 @@ public class texturesurf// gl.glRotatef(85.0f, 1.0f, 1.0f, 1.0f); } - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, - boolean deviceChanged) { + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { } private void makeImage() { diff --git a/src/redbook/src/glredbook11/image.java b/src/redbook/src/glredbook11/image.java index eea4d24..7c6d16b 100644 --- a/src/redbook/src/glredbook11/image.java +++ b/src/redbook/src/glredbook11/image.java @@ -22,7 +22,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import glredbook10.GLSkeleton; import javax.media.opengl.awt.GLJPanel; @@ -50,7 +50,7 @@ public class image // private static final int rgb = 3; // private byte checkImage[][][]; private ByteBuffer checkImageBuf = // - BufferUtil.newByteBuffer(checkImageHeight * checkImageWidth * rgb); + GLBuffers.newDirectByteBuffer(checkImageHeight * checkImageWidth * rgb); private static float zoomFactor = 1.0f; private static int height; diff --git a/src/redbook/src/glredbook11/texbind.java b/src/redbook/src/glredbook11/texbind.java index 7991f76..ba29968 100644 --- a/src/redbook/src/glredbook11/texbind.java +++ b/src/redbook/src/glredbook11/texbind.java @@ -9,7 +9,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import javax.media.opengl.awt.GLJPanel; import javax.media.opengl.glu.GLU; @@ -30,9 +30,9 @@ public class texbind // // private byte checkImage[][][]; // private byte otherImage[][][]; private ByteBuffer checkImageBuf = // - BufferUtil.newByteBuffer(checkImageWidth * checkImageHeight * rgba); + GLBuffers.newDirectByteBuffer(checkImageWidth * checkImageHeight * rgba); private ByteBuffer otherImageBuf = // - BufferUtil.newByteBuffer(checkImageWidth * checkImageHeight * rgba); + GLBuffers.newDirectByteBuffer(checkImageWidth * checkImageHeight * rgba); private int[] texName = new int[2]; @Override diff --git a/src/redbook/src/glredbook11/texgen.java b/src/redbook/src/glredbook11/texgen.java index 519d88f..353c843 100644 --- a/src/redbook/src/glredbook11/texgen.java +++ b/src/redbook/src/glredbook11/texgen.java @@ -6,9 +6,10 @@ import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.nio.ByteBuffer; -import javax.media.opengl.*;import javax.swing.JFrame; +import javax.media.opengl.*; +import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.gluegen.runtime.Buffers; import com.jogamp.opengl.util.gl2.GLUT; import javax.media.opengl.awt.GLJPanel; @@ -31,8 +32,7 @@ public class texgen// private GLUT glut; private static final int stripeImageWidth = 32; private byte stripeImage[] = new byte[3 * stripeImageWidth]; - private ByteBuffer stripeImageBuf = BufferUtil - .newByteBuffer(stripeImage.length); + private ByteBuffer stripeImageBuf = Buffers.newDirectByteBuffer(stripeImage.length); /* glTexGen stuff: */ // private float sgenparams[] = { 1.0f, 1.0f, 1.0f, 0.0f }; private int texName[] = new int[1]; diff --git a/src/redbook/src/glredbook11/texsub.java b/src/redbook/src/glredbook11/texsub.java index 32b7d7d..645745d 100644 --- a/src/redbook/src/glredbook11/texsub.java +++ b/src/redbook/src/glredbook11/texsub.java @@ -9,7 +9,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import javax.media.opengl.awt.GLJPanel; import javax.media.opengl.glu.GLU; @@ -35,9 +35,9 @@ public class texsub // private byte checkImage[][][]; // private byte otherImage[][][]; private ByteBuffer checkImageBuf = // - BufferUtil.newByteBuffer(checkImageWidth * checkImageHeight * rgba); + GLBuffers.newDirectByteBuffer(checkImageWidth * checkImageHeight * rgba); private ByteBuffer subImageBuf = // - BufferUtil.newByteBuffer(subImageWidth * subImageHeight * rgba); + GLBuffers.newDirectByteBuffer(subImageWidth * subImageHeight * rgba); private int[] texName = new int[2]; @Override diff --git a/src/redbook/src/glredbook11/varray.java b/src/redbook/src/glredbook11/varray.java index a40b994..d235296 100644 --- a/src/redbook/src/glredbook11/varray.java +++ b/src/redbook/src/glredbook11/varray.java @@ -12,7 +12,7 @@ import java.nio.IntBuffer; import javax.media.opengl.*; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import javax.media.opengl.awt.GLJPanel; import javax.media.opengl.glu.GLU; @@ -96,7 +96,7 @@ public class varray// } else if (derefMethod == DRAWELEMENTS) { int indices[] = new int[] { 0, 1, 3, 4 }; if (indicesBuf == null) { - indicesBuf = BufferUtil.newIntBuffer(indices.length); + indicesBuf = GLBuffers.newDirectIntBuffer(indices.length); indicesBuf.put(indices); } indicesBuf.rewind(); @@ -135,11 +135,11 @@ public class varray// 0.5f, 0.5f, 0.5f }; if (verticesBuf == null) {// IntBuffer tmpVerticesBuf - verticesBuf = BufferUtil.newIntBuffer(vertices.length); + verticesBuf = GLBuffers.newDirectIntBuffer(vertices.length); verticesBuf.put(vertices); } if (colorsBuf == null) { - colorsBuf = BufferUtil.newFloatBuffer(colors.length); + colorsBuf = GLBuffers.newDirectFloatBuffer(colors.length); colorsBuf.put(colors); } verticesBuf.rewind(); @@ -160,7 +160,7 @@ public class varray// 0.2f, 1.0f, 1.0f, 300.0f, 200.0f, 0.0f, 0.2f, 0.2f, 1.0f, 200.0f, 100.0f, 0.0f }; if (intertwinedBuf == null) { - intertwinedBuf = BufferUtil.newFloatBuffer(intertwined.length); + intertwinedBuf = GLBuffers.newDirectFloatBuffer(intertwined.length); intertwinedBuf.put(intertwined); } diff --git a/src/redbook/src/glredbook11/wrap.java b/src/redbook/src/glredbook11/wrap.java index 778db3a..47662a4 100644 --- a/src/redbook/src/glredbook11/wrap.java +++ b/src/redbook/src/glredbook11/wrap.java @@ -7,7 +7,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import glredbook10.GLSkeleton; import javax.media.opengl.awt.GLJPanel; @@ -34,7 +34,7 @@ public class wrap// private static final int rgba = 4; // private byte[][][] checkImage; private ByteBuffer checkImageBuf = // - BufferUtil.newByteBuffer(checkImageHeight * checkImageWidth * rgba); + GLBuffers.newDirectByteBuffer(checkImageHeight * checkImageWidth * rgba); private KeyEvent key; @Override diff --git a/src/redbook/src/glredbook12x/colormatrix.java b/src/redbook/src/glredbook12x/colormatrix.java index 7662915..9f4748f 100644 --- a/src/redbook/src/glredbook12x/colormatrix.java +++ b/src/redbook/src/glredbook12x/colormatrix.java @@ -11,7 +11,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import glredbook10.GLSkeleton; import javax.media.opengl.awt.GLJPanel; @@ -135,7 +135,7 @@ public class colormatrix// System.out.println("Creating buffer, width: " + dim.width + " height: " + dim.height); // byte[] buf = new byte[3 * dim.height * dim.width]; - bytes = BufferUtil.newByteBuffer(3 * dim.width * dim.height); + bytes = GLBuffers.newDirectByteBuffer(3 * dim.width * dim.height); for (int i = 0; i < bytes.capacity(); i++) { bytes.put(dis.readByte()); // int b = dis.readByte();// dis.read(); diff --git a/src/redbook/src/glredbook12x/colortable.java b/src/redbook/src/glredbook12x/colortable.java index 4f5fd5e..0564b26 100644 --- a/src/redbook/src/glredbook12x/colortable.java +++ b/src/redbook/src/glredbook12x/colortable.java @@ -12,7 +12,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;import javax.swing.JFrame; import javax.swing.SwingUtilities; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import glredbook10.GLSkeleton; import javax.media.opengl.awt.GLJPanel; @@ -74,7 +74,7 @@ public class colortable// } // byte colorTable[][] = new byte[256][3]; - ByteBuffer colorTableBuf = BufferUtil.newByteBuffer(256 * 3); + ByteBuffer colorTableBuf = GLBuffers.newDirectByteBuffer(256 * 3); gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); @@ -157,7 +157,7 @@ public class colortable// System.out.println("Creating buffer, width: " + dim.width + " height: " + dim.height); // byte[] buf = new byte[3 * dim.height * dim.width]; - bytes = BufferUtil.newByteBuffer(3 * dim.width * dim.height); + bytes = GLBuffers.newDirectByteBuffer(3 * dim.width * dim.height); for (int i = 0; i < bytes.capacity(); i++) { bytes.put(dis.readByte()); // int b = dis.readByte();// dis.read(); diff --git a/src/redbook/src/glredbook12x/convolution.java b/src/redbook/src/glredbook12x/convolution.java index 3f4fbdf..9e6d72e 100644 --- a/src/redbook/src/glredbook12x/convolution.java +++ b/src/redbook/src/glredbook12x/convolution.java @@ -14,7 +14,7 @@ import javax.media.opengl.*; import javax.swing.JFrame; import javax.swing.SwingUtilities; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import glredbook10.GLSkeleton; import javax.media.opengl.awt.GLJPanel; @@ -27,6 +27,7 @@ import javax.media.opengl.awt.GLJPanel; public class convolution// extends GLSkeleton<GLJPanel> implements GLEventListener, KeyListener { + private JFrame frame; private KeyEvent key; // @@ -41,12 +42,9 @@ public class convolution// private float laplacian[][] = { { -0.125f, -0.125f, -0.125f }, { -0.125f, 1.0f, -0.125f }, { -0.125f, -0.125f, -0.125f } }; - private FloatBuffer horizontalBuf = BufferUtil - .newFloatBuffer(horizontal.length * horizontal[0].length); - private FloatBuffer verticalBuf = BufferUtil.newFloatBuffer(vertical.length - * vertical[0].length); - private FloatBuffer laplacianBuf = BufferUtil - .newFloatBuffer(laplacian.length * laplacian[0].length); + private FloatBuffer horizontalBuf = GLBuffers.newDirectFloatBuffer(horizontal.length * horizontal[0].length); + private FloatBuffer verticalBuf = GLBuffers.newDirectFloatBuffer(vertical.length * vertical[0].length); + private FloatBuffer laplacianBuf = GLBuffers.newDirectFloatBuffer(laplacian.length * laplacian[0].length); { for (int i = 0; i < 3; i++) { horizontalBuf.put(horizontal[i]); @@ -190,7 +188,7 @@ public class convolution// System.out.println("Creating buffer, width: " + dim.width + " height: " + dim.height); // byte[] buf = new byte[3 * dim.height * dim.width]; - bytes = BufferUtil.newByteBuffer(3 * dim.width * dim.height); + bytes = GLBuffers.newDirectByteBuffer(3 * dim.width * dim.height); for (int i = 0; i < bytes.capacity(); i++) { bytes.put(dis.readByte()); // int b = dis.readByte();// dis.read(); diff --git a/src/redbook/src/glredbook12x/histogram.java b/src/redbook/src/glredbook12x/histogram.java index dd3bb62..2fabe52 100644 --- a/src/redbook/src/glredbook12x/histogram.java +++ b/src/redbook/src/glredbook12x/histogram.java @@ -14,7 +14,7 @@ import javax.media.opengl.*; import javax.swing.JFrame; import javax.swing.SwingUtilities; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import glredbook10.GLSkeleton; import javax.media.opengl.awt.GLJPanel; @@ -110,7 +110,7 @@ public class histogram // }// key sw // short values[][] = new short[HISTOGRAM_SIZE][3]; - ShortBuffer values = BufferUtil.newShortBuffer(HISTOGRAM_SIZE * 3); + ShortBuffer values = GLBuffers.newDirectShortBuffer(HISTOGRAM_SIZE * 3); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glRasterPos2i(1, 1); @@ -183,7 +183,7 @@ public class histogram // System.out.println("Creating buffer, width: " + dim.width + " height: " + dim.height); // byte[] buf = new byte[3 * dim.height * dim.width]; - bytes = BufferUtil.newByteBuffer(3 * dim.width * dim.height); + bytes = GLBuffers.newDirectByteBuffer(3 * dim.width * dim.height); for (int i = 0; i < bytes.capacity(); i++) { bytes.put(dis.readByte()); // int b = dis.readByte();// dis.read(); diff --git a/src/redbook/src/glredbook12x/minmax.java b/src/redbook/src/glredbook12x/minmax.java index c7e40b4..6f35328 100644 --- a/src/redbook/src/glredbook12x/minmax.java +++ b/src/redbook/src/glredbook12x/minmax.java @@ -12,7 +12,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;import javax.swing.JFrame; import javax.swing.SwingUtilities; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import glredbook10.GLSkeleton; import javax.media.opengl.awt.GLJPanel; @@ -90,7 +90,7 @@ public class minmax// gl.glClear(GL.GL_COLOR_BUFFER_BIT); // byte [] values=new byte[6]; - ByteBuffer values = BufferUtil.newByteBuffer(6); + ByteBuffer values = GLBuffers.newDirectByteBuffer(6); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glRasterPos2i(1, 1); @@ -141,7 +141,7 @@ public class minmax// System.out.println("Creating buffer, width: " + dim.width + " height: " + dim.height); - bytes = BufferUtil.newByteBuffer(3 * dim.width * dim.height); + bytes = GLBuffers.newDirectByteBuffer(3 * dim.width * dim.height); for (int i = 0; i < bytes.capacity(); i++) { bytes.put(dis.readByte()); diff --git a/src/redbook/src/glredbook12x/multitex.java b/src/redbook/src/glredbook12x/multitex.java index 3cda5f7..f243739 100644 --- a/src/redbook/src/glredbook12x/multitex.java +++ b/src/redbook/src/glredbook12x/multitex.java @@ -12,7 +12,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import javax.media.opengl.awt.GLJPanel; import javax.media.opengl.glu.GLU; @@ -27,8 +27,8 @@ public class multitex // private GLU glu; // private byte[][][] texels0 = new byte[32][32][4]; // private byte[][][] texels1 = new byte[16][16][4]; - private ByteBuffer texelsBuf0 = BufferUtil.newByteBuffer(32 * 32 * 4); - private ByteBuffer texelsBuf1 = BufferUtil.newByteBuffer(16 * 16 * 4); + private ByteBuffer texelsBuf0 = GLBuffers.newDirectByteBuffer(32 * 32 * 4); + private ByteBuffer texelsBuf1 = GLBuffers.newDirectByteBuffer(16 * 16 * 4); @Override protected GLJPanel createDrawable() { diff --git a/src/redbook/src/glredbook12x/texture3d.java b/src/redbook/src/glredbook12x/texture3d.java index 7258ec1..240ca0b 100644 --- a/src/redbook/src/glredbook12x/texture3d.java +++ b/src/redbook/src/glredbook12x/texture3d.java @@ -10,7 +10,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import glredbook10.GLSkeleton; import javax.media.opengl.awt.GLJPanel; @@ -32,7 +32,7 @@ public class texture3d // private static final int iDepth = 16; private static final int iRgb = 3; private ByteBuffer image - = BufferUtil.newByteBuffer(iRgb * iWidth * iHeight * iDepth); + = GLBuffers.newDirectByteBuffer(iRgb * iWidth * iHeight * iDepth); private int texName[] = new int[1]; @Override diff --git a/src/redbook/src/glredbook1314/combiner.java b/src/redbook/src/glredbook1314/combiner.java index fbab5de..bf34c23 100644 --- a/src/redbook/src/glredbook1314/combiner.java +++ b/src/redbook/src/glredbook1314/combiner.java @@ -7,7 +7,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import glredbook10.GLSkeleton; import javax.media.opengl.awt.GLJPanel; @@ -40,9 +40,9 @@ public class combiner// // private static byte[][][] image1 = new // byte[imageHeight][imageWidth][imageColor]; private static ByteBuffer imageBuf0 // - = BufferUtil.newByteBuffer(imageWidth * imageHeight * imageColor); + = GLBuffers.newDirectByteBuffer(imageWidth * imageHeight * imageColor); private static ByteBuffer imageBuf1 // - = BufferUtil.newByteBuffer(imageWidth * imageHeight * imageColor); + = GLBuffers.newDirectByteBuffer(imageWidth * imageHeight * imageColor); private static int texName[] = new int[4]; @Override diff --git a/src/redbook/src/glredbook1314/cubemap.java b/src/redbook/src/glredbook1314/cubemap.java index c116cf8..0b0c03a 100644 --- a/src/redbook/src/glredbook1314/cubemap.java +++ b/src/redbook/src/glredbook1314/cubemap.java @@ -36,17 +36,17 @@ public class cubemap// // private static byte image5[][][] = new byte[imageSize][imageSize][4]; // private static byte image6[][][] = new byte[imageSize][imageSize][4]; private static ByteBuffer imageBuf1 // - = BufferUtil.newByteBuffer(imageSize * imageSize * 4); + = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4); private static ByteBuffer imageBuf2 // - = BufferUtil.newByteBuffer(imageSize * imageSize * 4); + = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4); private static ByteBuffer imageBuf3 // - = BufferUtil.newByteBuffer(imageSize * imageSize * 4); + = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4); private static ByteBuffer imageBuf4 // - = BufferUtil.newByteBuffer(imageSize * imageSize * 4); + = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4); private static ByteBuffer imageBuf5 // - = BufferUtil.newByteBuffer(imageSize * imageSize * 4); + = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4); private static ByteBuffer imageBuf6 // - = BufferUtil.newByteBuffer(imageSize * imageSize * 4); + = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4); private static double ztrans = 0.0; diff --git a/src/redbook/src/glredbook1314/mvarray.java b/src/redbook/src/glredbook1314/mvarray.java index 405cfbf..0885d9e 100644 --- a/src/redbook/src/glredbook1314/mvarray.java +++ b/src/redbook/src/glredbook1314/mvarray.java @@ -10,7 +10,7 @@ import java.nio.IntBuffer; import javax.media.opengl.*; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import javax.media.opengl.awt.GLJPanel; import javax.media.opengl.glu.GLU; @@ -40,7 +40,7 @@ public class mvarray // 300, 250 }; private IntBuffer vertexBuf = // - BufferUtil.newIntBuffer(vertices.length); + GLBuffers.newDirectIntBuffer(vertices.length); private byte oneIndices[] = { 0, 1, 2, 3, 4, 5, 6 }; @@ -49,8 +49,8 @@ public class mvarray // private int count[] = { 7, 6 }; private ByteBuffer indices[] = {// - BufferUtil.newByteBuffer(oneIndices.length), - BufferUtil.newByteBuffer(twoIndices.length) }; + GLBuffers.newDirectByteBuffer(oneIndices.length), + GLBuffers.newDirectByteBuffer(twoIndices.length) }; // static GLvoid * indices[2] = {oneIndices, twoIndices}; { diff --git a/src/redbook/src/glredbook1314/shadowmap.java b/src/redbook/src/glredbook1314/shadowmap.java index 57da6e9..f20b9d2 100644 --- a/src/redbook/src/glredbook1314/shadowmap.java +++ b/src/redbook/src/glredbook1314/shadowmap.java @@ -8,7 +8,7 @@ import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; import javax.swing.JFrame; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import com.jogamp.opengl.util.FPSAnimator; @@ -232,7 +232,7 @@ public class shadowmap // if (shadowRender && textureOn) gl.glEnable(GL2.GL_TEXTURE_2D); } - FloatBuffer depthImageBuf = BufferUtil.newFloatBuffer(SHADOW_MAP_WIDTH * SHADOW_MAP_HEIGHT); + FloatBuffer depthImageBuf = GLBuffers.newDirectFloatBuffer(SHADOW_MAP_WIDTH * SHADOW_MAP_HEIGHT); private void generateShadowMap(GL2 gl) { int viewport[] = {0,0,0,0};//new int[4]; @@ -288,7 +288,7 @@ public class shadowmap // // demo.canvas.display();causes overflow! } } - FloatBuffer tmpMatbuf = BufferUtil.newFloatBuffer(16); + FloatBuffer tmpMatbuf = GLBuffers.newDirectFloatBuffer(16); private void generateTextureMatrix(GL2 gl) { // float tmpMatrix[] = new float[16]; -- cgit v1.2.3