diff options
author | Sven Gothel <[email protected]> | 2009-07-31 11:52:46 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-07-31 11:52:46 -0700 |
commit | 786b056afb90311a8c06a57fc24f242f8df713e1 (patch) | |
tree | 90c6ef96491209a08eabac62e3eb0602db79e34f | |
parent | 8b40dbcd98bbe0b7b9c0dfb321e3e1e4c1810dd5 (diff) |
Gluegen:
- Fix array element type name and const qualifier
JOGL:
- GL3: Set ArgumentIsString for GL3.1 methods
- JAR file creation: Add 'filesonly' option
- GLU: Static check of available impl., better fallback for GL2 without GLUgl2.
- WGL: (Performance + Java2D/GL FBO works again)
- Refactor WGL_ARB_pixel_format's HDC -> GLCapabilities: HDC2Caps
- Revert change where we always create a dummy drawable/context
for WGL selection (HDC2Caps).
In case of no multisampling, use PFD2Caps only.
- Update config using HDC2Caps (WGL_ARB_pixel_format)
after context creation, if not done already
-> updateCapabilitiesByWGL().
- profile.jogl: Add debug jars
15 files changed, 306 insertions, 211 deletions
diff --git a/etc/profile.jogl b/etc/profile.jogl index c1daef85d..24cac910f 100755 --- a/etc/profile.jogl +++ b/etc/profile.jogl @@ -30,25 +30,25 @@ JOGL_AWT="jogl.awt.jar jogl.util.awt.jar newt.awt.jar nativewindow.awt.jar" JOGL_CORE="nativewindow.core.jar nativewindow.x11.jar jogl.core.jar newt.core.jar newt.$OSS.jar newt.ogl.jar jogl.util.jar" -JOGL_JAR_ALL="$JOGL_CORE jogl.gles1.jar jogl.gles1.dbg.jar jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.gl2es12.$OSS.jar jogl.gl2es12.dbg.jar jogl.gl2.$OSS.jar jogl.gl2.dbg.jar jogl.util.gl2.jar jogl.glu.tess.jar jogl.glu.mipmap.jar jogl.glu.gl2.jar jogl.util.gl2.jar jogl.util.fixedfuncemu.jar $JOGL_AWT jogl.cg.jar" +JOGL_JAR_ALL="$JOGL_CORE jogl.gles1.jar jogl.gles1.dbg.jar jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.gl2es12.$OSS.jar jogl.gl2.$OSS.jar jogl.gl2.dbg.jar jogl.util.gl2.jar jogl.glu.tess.jar jogl.glu.mipmap.jar jogl.glu.gl2.jar jogl.util.gl2.jar jogl.util.fixedfuncemu.jar $JOGL_AWT jogl.cg.jar" JOGL_LIB_ALL="libjogl_gl2.so libjogl_es1.so libjogl_es2.so libnewt.so libjogl_awt.so" -JOGL_JAR_ES1_MIN="$JOGL_CORE jogl.gles1.jar jogl.egl.jar" +JOGL_JAR_ES1_MIN="$JOGL_CORE jogl.gles1.jar jogl.gles1.dbg.jar jogl.egl.jar" JOGL_JAR_ES1_MAX="$JOGL_CORE jogl.gles1.jar jogl.gles1.dbg.jar jogl.egl.jar jogl.glu.tess.jar jogl.glu.mipmap.jar $JOGL_AWT" JOGL_LIB_ES1_MIN="libjogl_es1.so libnewt.so" JOGL_LIB_ES1_MAX="libjogl_es1.so libnewt.so libjogl_awt.so libnativewindow_x11.so libnativewindow_awt.so" -JOGL_JAR_ES2_MIN="$JOGL_CORE jogl.gles2.jar jogl.egl.jar jogl.util.fixedfuncemu.jar" -JOGL_JAR_ES2_MAX="$JOGL_CORE jogl.gles2.jar jogl.egl.jar jogl.util.fixedfuncemu.jar jogl.glu.tess.jar $JOGL_AWT" +JOGL_JAR_ES2_MIN="$JOGL_CORE jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.util.fixedfuncemu.jar" +JOGL_JAR_ES2_MAX="$JOGL_CORE jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.util.fixedfuncemu.jar jogl.glu.tess.jar $JOGL_AWT" JOGL_LIB_ES2_MIN="libjogl_es2.so libnewt.so" JOGL_LIB_ES2_MAX="libjogl_es2.so libnewt.so libjogl_awt.so libnativewindow_x11.so libnativewindow_awt.so" -JOGL_JAR_GL2ES12_MIN="$JOGL_CORE jogl.gl2es12.$OSS.jar jogl.util.fixedfuncemu.jar" -JOGL_JAR_GL2ES12_MAX="$JOGL_CORE jogl.gl2es12.$OSS.jar jogl.util.fixedfuncemu.jar jogl.gl2es12.dbg.jar jogl.glu.tess.jar jogl.glu.mipmap.jar $JOGL_AWT" +JOGL_JAR_GL2ES12_MIN="$JOGL_CORE jogl.gl2es12.$OSS.jar jogl.gles1.dbg.jar jogl.gles2.dbg.jar jogl.util.fixedfuncemu.jar" +JOGL_JAR_GL2ES12_MAX="$JOGL_CORE jogl.gl2es12.$OSS.jar jogl.gles1.dbg.jar jogl.gles2.dbg.jar jogl.util.fixedfuncemu.jar jogl.gl2es12.dbg.jar jogl.glu.tess.jar jogl.glu.mipmap.jar $JOGL_AWT" JOGL_LIB_GL2ES12_MIN="libjogl_gl2es12.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" JOGL_LIB_GL2ES12_MAX="libjogl_gl2es12.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" -JOGL_JAR_GL2_MIN="$JOGL_CORE jogl.gl2.$OSS.jar" +JOGL_JAR_GL2_MIN="$JOGL_CORE jogl.gl2.$OSS.jar jogl.gl2.dbg.jar" JOGL_JAR_GL2_MAX="$JOGL_CORE jogl.gl2.$OSS.jar jogl.gl2.dbg.jar jogl.glu.tess.jar jogl.glu.mipmap.jar jogl.glu.gl2.jar jogl.util.gl2.jar $JOGL_AWT jogl.cg.jar" JOGL_LIB_GL2_MIN="libjogl_gl2.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" JOGL_LIB_GL2_MAX="libjogl_gl2.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 0f9a230a2..08f0d6ef2 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -1591,12 +1591,12 @@ <target name="c.build.jogl" depends="c.configure,c.build.jogl.prepare,c.build.jogl.gl2es12,c.build.jogl.gl2,c.build.jogl.es2,c.build.jogl.es1,c.build.jogl.cg"> <antcall target="c.manifest" inheritRefs="true" /> <!-- Create the Java Web Start jar file for the built native code --> - <jar destfile="${build}/jogl-natives-${os.and.arch}.jar"> + <jar destfile="${build}/jogl-natives-${os.and.arch}.jar" filesonly="true"> <fileset dir="${obj}"> <include name="*.${native.library.suffix}" /> </fileset> </jar> - <jar destfile="${build}/jogl-natives-${os.and.arch}-cdc.jar"> + <jar destfile="${build}/jogl-natives-${os.and.arch}-cdc.jar" filesonly="true"> <fileset dir="${obj}"> <include name="*_es1.${native.library.suffix-cdc}" /> <include name="*_es2.${native.library.suffix-cdc}" /> @@ -1660,24 +1660,24 @@ </target> <target name="build-cg-jar" depends="setup-manifestfile" if="jogl.cg"> - <jar manifest="${build}/tempversion" destfile="${jogl.cg.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.cg.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.nv-cg}"/> </jar> </target> <target name="build-jars-es-desktop" depends="setup-manifestfile" unless="setup.nodesktop"> - <jar manifest="${build}/tempversion" destfile="${jogl.gl2es12.x11.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gl2es12.x11.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.glx}, ${java.part.gl2es12}, ${java.part.openmax}" excludes="${java.part.glugl2}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.gl2es12.win.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gl2es12.win.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.wgl}, ${java.part.gl2es12}, ${java.part.openmax}" excludes="${java.part.glugl2}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.gl2es12.osx.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gl2es12.osx.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.cgl}, ${java.part.gl2es12}, ${java.part.openmax}" excludes="${java.part.glugl2}"/> @@ -1685,43 +1685,43 @@ </target> <target name="build-jars-es" depends="setup-manifestfile,build-jars-es-desktop"> - <jar manifest="${build}/tempversion" destfile="${jogl.egl.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.egl.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.egl}" excludes="${java.part.awt}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.gles1.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gles1.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.es1}" excludes="${java.part.es1.dbg}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.gles1.dbg.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gles1.dbg.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.es1.dbg}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.gles2.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gles2.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.es2}, ${java.part.openmax}" excludes="${java.part.es2.dbg}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.gles2.dbg.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gles2.dbg.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.es2.dbg}"/> </jar> </target> <target name="build-jars-es-desktop-cdc" depends="setup-manifestfile-cdc" unless="setup.nodesktop"> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gl2es12.x11.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gl2es12.x11.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.glx}, ${java.part.gl2es12}, ${java.part.openmax}" excludes="${java.part.glugl2}"/> </jar> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gl2es12.win.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gl2es12.win.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.wgl}, ${java.part.gl2es12}, ${java.part.openmax}" excludes="${java.part.glugl2}"/> </jar> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gl2es12.osx.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gl2es12.osx.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.cgl}, ${java.part.gl2es12}, ${java.part.openmax}" excludes="${java.part.glugl2}"/> @@ -1729,44 +1729,44 @@ </target> <target name="build-jars-es-cdc" depends="setup-manifestfile-cdc,build-jars-es-desktop-cdc" unless="setup.noCDC"> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.egl.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.egl.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.egl}" excludes="${java.part.awt}"/> </jar> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gles1.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gles1.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.es1}" excludes="${java.part.es1.dbg}"/> </jar> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gles1.dbg.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gles1.dbg.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.es1.dbg}"/> </jar> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gles2.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gles2.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.es2}, ${java.part.openmax}" excludes="${java.part.es2.dbg}"/> </jar> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gles2.dbg.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.gles2.dbg.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.es2.dbg}"/> </jar> </target> <target name="build-jars-awt" depends="setup-manifestfile" unless="setup.noAWT"> - <jar manifest="${build}/tempversion" destfile="${jogl.awt.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.awt.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.awt}" /> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.util.awt.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.util.awt.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.util.awt}"/> </jar> </target> <target name="build-jars-all" depends="setup-manifestfile" unless="setup.noall"> - <jar manifest="${build}/tempversion" destfile="${jogl.all.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.all.jar}" filesonly="true"> <fileset dir="${classes}"> <include name="javax/media/opengl/**" /> <include name="com/sun/gluegen/runtime/**" /> @@ -1780,7 +1780,7 @@ </jar> </target> <target name="build-jars-all-cdc" depends="setup-manifestfile"> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.all.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.all.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.core} ${java.part.egl} ${java.part.glutess} ${java.part.glumipmap} ${java.part.openmax} ${java.part.sdk} ${java.part.glx} ${java.part.cgl} ${java.part.gl2es12} ${java.part.wgl} ${java.part.es1} ${java.part.es1.dbg} ${java.part.es2} ${java.part.es2.dbg} ${java.part.util} ${java.part.util.glsl} ${java.part.util.fixedfuncemu}" excludes="${java.excludes.cdcfp}"/> @@ -1791,25 +1791,25 @@ <target name="build-jars-cdc" depends="setup-manifestfile-cdc, build-jars-es-cdc, build-jars-all-cdc" unless="setup.noCDC"> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.core.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.core.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.core}" excludes="${java.part.core.exclude}"/> </jar> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.glutess.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.glutess.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.glutess}"/> </jar> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.glumipmap.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.glumipmap.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.glumipmap}"/> </jar> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.util.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.util.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.util} ${java.part.util.glsl}" excludes="${java.part.util.awt} ${java.part.util.gl2} ${java.part.util.fixedfuncemu}"/> </jar> - <jar manifest="${build}/tempversion-cdc" destfile="${jogl.util.fixedfuncemu.cdc.jar}"> + <jar manifest="${build}/tempversion-cdc" destfile="${jogl.util.fixedfuncemu.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.util.fixedfuncemu}"/> <fileset dir="${src.java}" @@ -1818,30 +1818,30 @@ </target> <target name="build-jars-desktop-javase" depends="setup-manifestfile" unless="setup.nodesktop"> - <jar manifest="${build}/tempversion" destfile="${jogl.gl2.x11.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gl2.x11.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.glx}, ${java.part.gl2}, ${java.part.gl3}, ${java.part.openmax}" excludes="${java.part.gl2.dbg}, ${java.part.gl3.dbg}, ${java.part.glugl2}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.gl2.win.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gl2.win.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.wgl}, ${java.part.gl2}, $${java.part.gl3}, {java.part.openmax}" excludes="${java.part.gl2.dbg}, ${java.part.gl3.dbg}, ${java.part.glugl2}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.gl2.osx.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gl2.osx.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.cgl}, ${java.part.gl2}, $${java.part.gl3}, {java.part.openmax}" excludes="${java.part.gl2.dbg}, ${java.part.gl3.dbg}, ${java.part.glugl2}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.gl2.dbg.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.gl2.dbg.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.gl2.dbg} ${java.part.gl3.dbg}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.glugl2.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.glugl2.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.glugl2}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.util.gl2.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.util.gl2.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.util.gl2}" excludes="com/sun/opengl/**/awt/**"/> @@ -1849,29 +1849,29 @@ </target> <target name="build-jars-javase" depends="setup-manifestfile, build-jars-es, build-jars-awt, build-cg-jar, build-jars-all, build-jars-desktop-javase"> - <jar manifest="${build}/tempversion" destfile="${jogl.core.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.core.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.core}" excludes="${java.part.core.exclude}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.sdk.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.sdk.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.sdk}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.glutess.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.glutess.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.glutess}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.glumipmap.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.glumipmap.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.glumipmap}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.util.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.util.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.util} ${java.part.util.glsl}" excludes="${java.part.util.awt} ${java.part.util.gl2} ${java.part.util.fixedfuncemu}"/> </jar> - <jar manifest="${build}/tempversion" destfile="${jogl.util.fixedfuncemu.jar}"> + <jar manifest="${build}/tempversion" destfile="${jogl.util.fixedfuncemu.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.util.fixedfuncemu}"/> <fileset dir="${src.java}" diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml index 8a903eb0c..ce7081464 100644 --- a/make/build-nativewindow.xml +++ b/make/build-nativewindow.xml @@ -765,12 +765,12 @@ <antcall target="c.fixup.jawt.version.macosx" inheritrefs="true" /> <antcall target="c.manifest" inheritRefs="true" /> <!-- Create the Java Web Start jar file for the built native code --> - <jar destfile="${build}/nativewindow-natives-${os.and.arch}.jar"> + <jar destfile="${build}/nativewindow-natives-${os.and.arch}.jar" filesonly="true"> <fileset dir="${obj}"> <include name="*.${native.library.suffix}" /> </fileset> </jar> - <jar destfile="${build}/nativewindow-natives-${os.and.arch}-cdc.jar"> + <jar destfile="${build}/nativewindow-natives-${os.and.arch}-cdc.jar" filesonly="true"> <fileset dir="${obj}"> <include name="*_jvm.${native.library.suffix-cdc}" /> <include name="*_x11.${native.library.suffix-cdc}" /> @@ -830,7 +830,7 @@ <target name="build-jars-awt" depends="setup-manifestfile" unless="setup.noAWT"> - <jar manifest="tempversion" destfile="${nativewindow.awt.jar}"> + <jar manifest="tempversion" destfile="${nativewindow.awt.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.awt}" excludes="${java.excludes.awt}"/> @@ -838,20 +838,20 @@ </target> <target name="build-jars-x11" depends="setup-manifestfile"> - <jar manifest="tempversion" destfile="${nativewindow.x11.jar}"> + <jar manifest="tempversion" destfile="${nativewindow.x11.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.x11}" /> </jar> </target> <target name="build-jars-x11-cdc" depends="setup-manifestfile-cdc"> - <jar manifest="tempversion-cdc" destfile="${nativewindow.x11.cdc.jar}"> + <jar manifest="tempversion-cdc" destfile="${nativewindow.x11.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.x11}" /> </jar> </target> <target name="build-jars-all" depends="setup-manifestfile" unless="setup.noall"> - <jar manifest="tempversion" destfile="${nativewindow.all.jar}"> + <jar manifest="tempversion" destfile="${nativewindow.all.jar}" filesonly="true"> <fileset dir="${classes}"> <include name="javax/media/nativewindow/**" /> <include name="com/sun/nativewindow/**" /> @@ -861,7 +861,7 @@ </jar> </target> <target name="build-jars-all-cdc" depends="setup-manifestfile-cdc"> - <jar manifest="tempversion-cdc" destfile="${nativewindow.all.cdc.jar}"> + <jar manifest="tempversion-cdc" destfile="${nativewindow.all.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}"> <include name="javax/media/nativewindow/**" /> <include name="com/sun/nativewindow/**" /> @@ -871,7 +871,7 @@ </target> <target name="build-jars-javase" depends="setup-manifestfile,build-jars-awt,build-jars-x11,build-jars-all"> - <jar manifest="tempversion" destfile="${nativewindow.core.jar}"> + <jar manifest="tempversion" destfile="${nativewindow.core.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.core}" excludes="${java.part.awt} ${java.part.x11}"/> @@ -880,7 +880,7 @@ </target> <target name="build-jars-cdc" depends="setup-manifestfile-cdc,build-jars-x11-cdc,build-jars-all-cdc"> - <jar manifest="tempversion-cdc" destfile="${nativewindow.core.cdc.jar}"> + <jar manifest="tempversion-cdc" destfile="${nativewindow.core.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.core}" excludes="${java.part.awt} ${java.part.x11}"/> diff --git a/make/build-newt.xml b/make/build-newt.xml index acf78f09a..079d2e154 100644 --- a/make/build-newt.xml +++ b/make/build-newt.xml @@ -623,12 +623,12 @@ <target name="c.build.newt" depends="c.configure,c.build.newt.prepare,c.build.newt.natives"> <antcall target="c.manifest" inheritRefs="true" /> <!-- Create the Java Web Start jar file for the built native code --> - <jar destfile="${build}/newt-natives-${os.and.arch}.jar"> + <jar destfile="${build}/newt-natives-${os.and.arch}.jar" filesonly="true"> <fileset dir="${obj}"> <include name="*.${native.library.suffix}" /> </fileset> </jar> - <jar destfile="${build}/newt-natives-${os.and.arch}-cdc.jar"> + <jar destfile="${build}/newt-natives-${os.and.arch}-cdc.jar" filesonly="true"> <fileset dir="${obj}"> <include name="*.${native.library.suffix-cdc}" /> </fileset> @@ -686,73 +686,73 @@ </target> <target name="build-jars-awt" depends="setup-manifestfile" unless="setup.noAWT"> - <jar manifest="tempversion" destfile="${newt.awt.jar}"> + <jar manifest="tempversion" destfile="${newt.awt.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.awt}"/> </jar> </target> <target name="build-jars-opengl" depends="setup-manifestfile" unless="setup.noOpenGL"> - <jar manifest="tempversion" destfile="${newt.ogl.jar}"> + <jar manifest="tempversion" destfile="${newt.ogl.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.opengl}"/> </jar> - <jar manifest="tempversion" destfile="${newt.broadcomegl.jar}"> + <jar manifest="tempversion" destfile="${newt.broadcomegl.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.broadcomegl}"/> </jar> </target> <target name="build-jars-opengl-cdc" depends="setup-manifestfile-cdc" unless="setup.noOpenGL"> - <jar manifest="tempversion-cdc" destfile="${newt.ogl.cdc.jar}"> + <jar manifest="tempversion-cdc" destfile="${newt.ogl.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.opengl}"/> </jar> - <jar manifest="tempversion-cdc" destfile="${newt.broadcomegl.cdc.jar}"> + <jar manifest="tempversion-cdc" destfile="${newt.broadcomegl.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.broadcomegl}"/> </jar> </target> <target name="build-jars-desktop" depends="setup-manifestfile" unless="setup.nodesktop"> - <jar manifest="tempversion" destfile="${newt.x11.jar}"> + <jar manifest="tempversion" destfile="${newt.x11.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.x11}"/> </jar> - <jar manifest="tempversion" destfile="${newt.win.jar}"> + <jar manifest="tempversion" destfile="${newt.win.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.windows}"/> </jar> - <jar manifest="tempversion" destfile="${newt.osx.jar}"> + <jar manifest="tempversion" destfile="${newt.osx.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.macosx}"/> </jar> </target> <target name="build-jars-desktop-cdc" depends="setup-manifestfile-cdc" unless="setup.nodesktop"> - <jar manifest="tempversion-cdc" destfile="${newt.x11.cdc.jar}"> + <jar manifest="tempversion-cdc" destfile="${newt.x11.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.x11}"/> </jar> - <jar manifest="tempversion-cdc" destfile="${newt.win.cdc.jar}"> + <jar manifest="tempversion-cdc" destfile="${newt.win.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.windows}"/> </jar> - <jar manifest="tempversion-cdc" destfile="${newt.osx.cdc.jar}"> + <jar manifest="tempversion-cdc" destfile="${newt.osx.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.macosx}"/> </jar> </target> <target name="build-jars-all" depends="setup-manifestfile" unless="setup.noall"> - <jar manifest="tempversion" destfile="${newt.all.jar}"> + <jar manifest="tempversion" destfile="${newt.all.jar}" filesonly="true"> <fileset dir="${classes}" includes="com/sun/javafx/newt/**" /> </jar> </target> <target name="build-jars-all-cdc" depends="setup-manifestfile-cdc"> - <jar manifest="tempversion-cdc" destfile="${newt.all.cdc.jar}"> + <jar manifest="tempversion-cdc" destfile="${newt.all.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="com/sun/javafx/newt/**" excludes="${java.excludes.cdcfp}" /> @@ -760,7 +760,7 @@ </target> <target name="build-jars-javase" depends="setup-manifestfile,build-jars-awt,build-jars-opengl,build-jars-all,build-jars-desktop"> - <jar manifest="tempversion" destfile="${newt.core.jar}"> + <jar manifest="tempversion" destfile="${newt.core.jar}" filesonly="true"> <fileset dir="${classes}" includes="${java.part.core}"/> </jar> @@ -768,7 +768,7 @@ </target> <target name="build-jars-cdc" depends="setup-manifestfile-cdc,build-jars-opengl-cdc,build-jars-all-cdc,build-jars-desktop-cdc" unless="setup.noCDC"> - <jar manifest="tempversion-cdc" destfile="${newt.core.cdc.jar}"> + <jar manifest="tempversion-cdc" destfile="${newt.core.cdc.jar}" filesonly="true"> <fileset dir="${classes-cdc}" includes="${java.part.core}"/> </jar> diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg index 19e0eb8e4..a26c6a6b3 100644 --- a/make/config/jogl/gl-common.cfg +++ b/make/config/jogl/gl-common.cfg @@ -289,6 +289,14 @@ ReturnValueCapacity glXAllocateMemoryNV {0} # Pass arguments to ARB_vertex_program, ARB_fragment_program, # ARB_shader_objects, NV_vertex_program, NV_fragment_program, and # ARB_vertex_shader as Strings +ArgumentIsString glBindAttribLocation 2 +ArgumentIsString glBindAttribLocationARB 2 +ArgumentIsString glGetAttribLocation 1 +ArgumentIsString glGetAttribLocationARB 1 +ArgumentIsString glGetProgramNamedParameterfvNV 2 +ArgumentIsString glGetProgramNamedParameterdvNV 2 +ArgumentIsString glGetUniformLocation 1 +ArgumentIsString glGetUniformLocationARB 1 ArgumentIsString glLoadProgramNV 3 ArgumentIsString glProgramString 3 ArgumentIsString glProgramStringARB 3 @@ -296,16 +304,24 @@ ArgumentIsString glProgramNamedParameter4fNV 2 ArgumentIsString glProgramNamedParameter4dNV 2 ArgumentIsString glProgramNamedParameter4fvNV 2 ArgumentIsString glProgramNamedParameter4dvNV 2 -ArgumentIsString glGetProgramNamedParameterfvNV 2 -ArgumentIsString glGetProgramNamedParameterdvNV 2 ArgumentIsString glShaderSource 2 ArgumentIsString glShaderSourceARB 2 -ArgumentIsString glGetUniformLocation 1 -ArgumentIsString glGetUniformLocationARB 1 -ArgumentIsString glBindAttribLocation 2 -ArgumentIsString glBindAttribLocationARB 2 -ArgumentIsString glGetAttribLocation 1 -ArgumentIsString glGetAttribLocationARB 1 + +ArgumentIsString glBindFragDataLocation 2 +ArgumentIsString glGetFragDataLocation 1 +ArgumentIsString glGetUniformIndices 2 +ArgumentIsString glGetUniformBlockIndex 1 +ArgumentIsString glTransformFeedbackVaryings 2 + +# String output values: +# ArgumentIsString glGetActiveAttrib 6 +# ArgumentIsString glGetActiveUniformBlockName 4 +# ArgumentIsString glGetActiveUniformName 4 +# ArgumentIsString glGetActiveUniform 6 +# ArgumentIsString glGetProgramInfoLog 3 +# ArgumentIsString glGetShaderInfoLog 3 +# ArgumentIsString glGetShaderSource 3 +# ArgumentIsString glGetTransformFeedbackVarying 6 # # Directives for Vertex Buffer Object and Pixel Buffer Object checking diff --git a/make/config/jogl/glu-CustomJavaCode-base.java b/make/config/jogl/glu-CustomJavaCode-base.java index 6949cfb68..78c067606 100755 --- a/make/config/jogl/glu-CustomJavaCode-base.java +++ b/make/config/jogl/glu-CustomJavaCode-base.java @@ -76,8 +76,19 @@ public boolean isFunctionAvailable(String gluFunctionName) // Utility routines // -private static Class gl2Class; -private static Class gl2es1Class; +private static final Class gl2Class; +private static final Class gl2es1Class; + +static { + Class _gl2Class=null; + Class _gl2es1Class=null; + try { + _gl2Class = Class.forName("javax.media.opengl.glu.gl2.GLUgl2"); + _gl2es1Class = Class.forName("javax.media.opengl.glu.gl2es1.GLUgl2es1"); + } catch (Throwable t) {} + gl2Class = _gl2Class; + gl2es1Class = _gl2es1Class; +} /** * Instantiates a GLU implementation object in respect to the given GL profile @@ -94,32 +105,20 @@ public static final GLU createGLU() throws GLException { public static final GLU createGLU(GL gl) throws GLException { try { Class c = null; - if(gl.isGL2()) { - if (gl2Class == null) { - gl2Class = Class.forName("javax.media.opengl.glu.gl2.GLUgl2"); - } + if(gl.isGL2() && null!=gl2Class) { c = gl2Class; - } else if (gl.isGL2ES1()) { - if (gl2es1Class == null) { - gl2es1Class = Class.forName("javax.media.opengl.glu.gl2es1.GLUgl2es1"); - } + } else if(gl.isGL2ES1() && null!=gl2es1Class) { c = gl2es1Class; + /** There is no specialized ES 2 GLU at this time + } else if(gl.isGL2ES2() && null!=gl2es2Class) { + c = gl2es2Class; */ + } else { + c = GLU.class; } - if (c != null) { - return (GLU) c.newInstance(); - } + return (GLU) c.newInstance(); } catch (Exception e) { throw new GLException(e); } - // There is no specialized ES 2 GLU at this time - /* - try { - if(GLProfile.GL2ES12.equals(profile) || GLProfile.GL2.equals(profile) || GLProfile.GLES2.equals(profile)) { - return (GLU) NWReflection.createInstance("javax.media.opengl.glu.gl2es2.GLUgl2es2"); - } - } catch (GLException e) { e.printStackTrace(); } - */ - return new GLU(); } public GLU() diff --git a/make/make.jogl.all.win32.bat b/make/make.jogl.all.win32.bat index f4a52fa75..9ab77b051 100644 --- a/make/make.jogl.all.win32.bat +++ b/make/make.jogl.all.win32.bat @@ -9,4 +9,4 @@ REM -DuseOpenMAX=true REM -DuseKD=true
REM -Djogl.cg=1 -D-Dwindows.cg.lib=C:\Cg-2.2
-ant -Drootrel.build=build-win32 -Djogl.cg=1 -Dwindows.cg.lib=C:\Cg-2.2\lib > make.jogl.all.win32.log 2>&1
+ant -Dbuild.noarchives=true -Dc.compiler.debug=true -Drootrel.build=build-win32 -Djogl.cg=1 -Dwindows.cg.lib=C:\Cg-2.2\lib > make.jogl.all.win32.log 2>&1
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java index 15ccc0f96..81fc0b78b 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java @@ -140,10 +140,10 @@ public abstract class GLDrawableImpl implements GLDrawable { public String toString() { return getClass().getName()+"[realized "+getRealized()+ - ",\n\trequested "+getRequestedGLCapabilities()+ - ",\n\tchosen "+getChosenGLCapabilities()+ + ",\n\tfactory "+getFactory()+ ",\n\twindow "+getNativeWindow()+ - ",\n\tfactory "+getFactory()+"]"; + ",\n\trequested "+getRequestedGLCapabilities()+ + ",\n\tchosen "+getChosenGLCapabilities()+"]"; } protected GLDrawableFactory factory; diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java index b9fc80156..31e65fc8c 100755 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java @@ -51,7 +51,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { private boolean created = true; private GLContext lastContext; - private WindowsExternalWGLContext(Drawable drawable, long hglrc) { + private WindowsExternalWGLContext(Drawable drawable, long hglrc, WindowsWGLGraphicsConfiguration cfg) { super(drawable, null); this.hglrc = hglrc; if (DEBUG) { @@ -59,6 +59,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { } GLContextShareSet.contextCreated(this); setGLFunctionAvailability(false); + cfg.updateCapabilitiesByWGL(this); } protected static WindowsExternalWGLContext create(GLDrawableFactory factory, GLProfile glp) { @@ -76,12 +77,12 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { } AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(); - WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(glp, aScreen, hdc, pfdID, true, true); + WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(hdc, pfdID, glp, aScreen, true, true); NullWindow nw = new NullWindow(cfg); nw.setSurfaceHandle(hdc); - return new WindowsExternalWGLContext(new Drawable(factory, nw), hglrc); + return new WindowsExternalWGLContext(new Drawable(factory, nw), hglrc, cfg); } public int makeCurrent() throws GLException { diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java index 706675893..9b87afc38 100755 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java @@ -61,12 +61,12 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { } AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(); - WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(glp, aScreen, hdc, pfdID, true, true); + WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(hdc, pfdID, glp, aScreen, true, true); NullWindow nw = new NullWindow(cfg); nw.setSurfaceHandle(hdc); - // cfg.updateGraphicsConfiguration(factory, nw); + cfg.updateGraphicsConfiguration(factory, nw); return new WindowsExternalWGLDrawable(factory, nw); } diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java index f54e8f1a0..79dda9049 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -295,7 +295,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { if(newCaps.isOnscreen()) { throw new GLException("Error: Selected Onscreen Caps for PBuffer: "+newCaps); } - config.setCapsPFD(newCaps, pfd, pformats[whichFormat]); + config.setCapsPFD(newCaps, pfd, pformats[whichFormat], true); } else { PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor(); if (WGL.DescribePixelFormat(parentHdc, pformats[whichFormat], pfd.size(), pfd) == 0) { @@ -305,7 +305,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { if(newCaps.isOnscreen()) { throw new GLException("Error: Selected Onscreen Caps for PBuffer: "+newCaps); } - config.setCapsPFD(newCaps, pfd, pformats[whichFormat]); + config.setCapsPFD(newCaps, pfd, pformats[whichFormat], false); } } diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java index 92a563445..578279586 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java @@ -264,6 +264,11 @@ public class WindowsWGLContext extends GLContextImpl { if (created) { setGLFunctionAvailability(false); + + WindowsWGLGraphicsConfiguration config = + (WindowsWGLGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + config.updateCapabilitiesByWGL(this); + return CONTEXT_CURRENT_NEW; } return CONTEXT_CURRENT; diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 1a8d45465..844e72841 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -49,6 +49,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio private int pixelfmtID; private boolean isChosen = false; private GLCapabilitiesChooser chooser; + private boolean choosenByWGLPixelFormat=false; public WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen, GLCapabilities capsChosen, GLCapabilities capsRequested, PIXELFORMATDESCRIPTOR pixelfmt, int pixelfmtID, GLCapabilitiesChooser chooser) { @@ -58,17 +59,26 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio this.pixelfmtID = pixelfmtID; } - public static WindowsWGLGraphicsConfiguration create(GLProfile glp, AbstractGraphicsScreen screen, long hdc, int pfdID, boolean onscreen, boolean usePBuffer) { - PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(); - if (WGL.DescribePixelFormat(hdc, pfdID, pfd.size(), pfd) == 0) { - throw new GLException("Unable to describe pixel format " + pfdID); + public static WindowsWGLGraphicsConfiguration create(long hdc, int pfdID, + GLProfile glp, AbstractGraphicsScreen screen, boolean onscreen, boolean usePBuffer) + { + if(pfdID<=0) { + throw new GLException("Invalid pixelformat id "+pfdID); } if(null==glp) { glp = GLProfile.getDefault(); } + PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(); + if (WGL.DescribePixelFormat(hdc, pfdID, pfd.size(), pfd) == 0) { + throw new GLException("Unable to describe pixel format " + pfdID); + } + GLCapabilities caps = PFD2GLCapabilities(glp, pfd, onscreen, usePBuffer); + if(null==caps) { + throw new GLException("Couldn't choose Capabilities by: HDC 0x"+Long.toHexString(hdc)+", pfdID "+pfdID); + } WindowsWGLGraphicsConfiguration cfg = new WindowsWGLGraphicsConfiguration(screen, caps, caps, pfd, pfdID, new DefaultGLCapabilitiesChooser()); - cfg.setCapsPFD(caps, pfd, pfdID); + cfg.setCapsPFD(caps, pfd, pfdID, false); return cfg; } @@ -77,15 +87,40 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio return super.clone(); } + /** Update config - before having a valid context */ protected void updateGraphicsConfiguration(GLDrawableFactory factory, NativeWindow nativeWindow) { WindowsWGLGraphicsConfigurationFactory.updateGraphicsConfiguration(chooser, factory, nativeWindow); } - protected void setCapsPFD(GLCapabilities caps, PIXELFORMATDESCRIPTOR pfd, int pfdID) { - // FIXME: setScreen ( .. ) + + /** Update config - after having a valid and current context */ + protected void updateCapabilitiesByWGL(GLContextImpl context) { + if(choosenByWGLPixelFormat) return; // already done .. + + GLCapabilities capabilities = (GLCapabilities) getRequestedCapabilities(); + boolean onscreen = capabilities.isOnscreen(); + boolean usePBuffer = capabilities.isPBuffer(); + GLProfile glp = capabilities.getGLProfile(); + + WGLExt wglExt = (WGLExt) context.getPlatformGLExtensions(); + GLDrawable drawable = context.getGLDrawable(); + NativeWindow nativeWindow = drawable.getNativeWindow(); + long hdc = nativeWindow.getSurfaceHandle(); + + GLCapabilities[] caps = HDC2GLCapabilities(wglExt, hdc, getPixelFormatID(), glp, true, onscreen, usePBuffer); + if(null!=caps && null!=caps[0]) { + setCapsPFD(caps[0], getPixelFormat(), getPixelFormatID(), true); + } + } + + protected void setCapsPFD(GLCapabilities caps, PIXELFORMATDESCRIPTOR pfd, int pfdID, boolean choosenByWGLPixelFormat) { this.pixelfmt = pfd; this.pixelfmtID = pfdID; setChosenCapabilities(caps); - isChosen=true; + this.isChosen=true; + this.choosenByWGLPixelFormat=choosenByWGLPixelFormat; + if (DEBUG) { + System.err.println("*** setCapsPFD: WGL-Choosen "+choosenByWGLPixelFormat+", pfdID "+pfdID+", "+caps); + } } public boolean getCapabilitiesChosen() { @@ -94,6 +129,102 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio public PIXELFORMATDESCRIPTOR getPixelFormat() { return pixelfmt; } public int getPixelFormatID() { return pixelfmtID; } + public boolean isChoosenByWGL() { return choosenByWGLPixelFormat; } + + private static int haveWGLChoosePixelFormatARB = -1; + private static int haveWGLARBMultisample = -1; + + public static GLCapabilities[] HDC2GLCapabilities(WGLExt wglExt, long hdc, int pfdIDOnly, + GLProfile glp, boolean relaxed, boolean onscreen, boolean usePBuffer) { + + if(haveWGLChoosePixelFormatARB<0) { + haveWGLChoosePixelFormatARB = wglExt.isExtensionAvailable("WGL_ARB_pixel_format")?1:0; + } + if(haveWGLARBMultisample<0) { + haveWGLARBMultisample = wglExt.isExtensionAvailable("WGL_ARB_multisample")?1:0; + } + if (0==haveWGLChoosePixelFormatARB) { + return null; + } + + // Produce a list of GLCapabilities to give to the + // GLCapabilitiesChooser. + // Use wglGetPixelFormatAttribivARB instead of + // DescribePixelFormat to get higher-precision information + // about the pixel format (should make the GLCapabilities + // more precise as well...i.e., remove the + // "HardwareAccelerated" bit, which is basically + // meaningless, and put in whether it can render to a + // window, to a pbuffer, or to a pixmap) + GLCapabilities[] availableCaps = null; + int numFormats = 0; + int niattribs = 0; + int[] iattributes = new int [2*MAX_ATTRIBS]; + int[] iresults = new int [2*MAX_ATTRIBS]; + + iattributes[0] = WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB; + if (wglExt.wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, iattributes, 0, iresults, 0)) { + numFormats = iresults[0]; + + if (DEBUG) { + System.err.println("wglGetPixelFormatAttribivARB reported WGL_NUMBER_PIXEL_FORMATS = " + numFormats); + } + + if(pfdIDOnly>0 && pfdIDOnly>numFormats) { + throw new GLException("Invalid pixelformat ID " + pfdIDOnly + " (should be between 1 and " + numFormats + ")"); + } + + // Should we be filtering out the pixel formats which aren't + // applicable, as we are doing here? + // We don't have enough information in the GLCapabilities to + // represent those that aren't... + iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_WINDOW_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCELERATION_ARB; + iattributes[niattribs++] = WGLExt.WGL_SUPPORT_OPENGL_ARB; + iattributes[niattribs++] = WGLExt.WGL_DEPTH_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_STENCIL_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_DOUBLE_BUFFER_ARB; + iattributes[niattribs++] = WGLExt.WGL_STEREO_ARB; + iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE_ARB; + iattributes[niattribs++] = WGLExt.WGL_RED_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_GREEN_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_BLUE_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ALPHA_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_RED_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_GREEN_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_BLUE_BITS_ARB; + iattributes[niattribs++] = WGLExt.WGL_ACCUM_ALPHA_BITS_ARB; + if (1==haveWGLARBMultisample) { + iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB; + iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB; + } + + if(pfdIDOnly>0) { + availableCaps = new GLCapabilities[1]; + if (!wglExt.wglGetPixelFormatAttribivARB(hdc, pfdIDOnly, 0, niattribs, iattributes, 0, iresults, 0)) { + throw new GLException("Error getting pixel format attributes for pixel format " + pfdIDOnly + " of device context"); + } + availableCaps[0] = AttribList2GLCapabilities(glp, iattributes, niattribs, iresults, + relaxed, onscreen, usePBuffer); + } else { + availableCaps = new GLCapabilities[numFormats]; + for (int i = 0; i < numFormats; i++) { + if (!wglExt.wglGetPixelFormatAttribivARB(hdc, i+1, 0, niattribs, iattributes, 0, iresults, 0)) { + throw new GLException("Error getting pixel format attributes for pixel format " + (i + 1) + " of device context"); + } + availableCaps[i] = AttribList2GLCapabilities(glp, iattributes, niattribs, iresults, + relaxed, onscreen, usePBuffer); + } + } + } else { + long lastErr = WGL.GetLastError(); + // Intel Extreme graphics fails with a zero error code + if (lastErr != 0) { + throw new GLException("Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code " + WGL.GetLastError()); + } + } + return availableCaps; + } public static boolean GLCapabilities2AttribList(GLCapabilities caps, int[] iattributes, @@ -498,7 +629,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio } public String toString() { - return "WindowsWGLGraphicsConfiguration["+getScreen()+", pfdID " + pixelfmtID + + return "WindowsWGLGraphicsConfiguration["+getScreen()+", pfdID " + pixelfmtID + ", wglChoosen "+choosenByWGLPixelFormat+ ",\n\trequested " + getRequestedCapabilities() + ",\n\tchosen " + getChosenCapabilities() + "]"; diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index f5974dc61..98ad83313 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -99,6 +99,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } + boolean choosenBywGLPixelFormat = false; WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) nativeWindow.getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities capabilities = (GLCapabilities) config.getRequestedCapabilities(); boolean onscreen = capabilities.isOnscreen(); @@ -113,7 +114,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio } PIXELFORMATDESCRIPTOR pfd = null; - int pixelFormat = -1; + int pixelFormat = -1; // 1-based pixel format boolean pixelFormatSet = false; GLCapabilities chosenCaps = null; @@ -125,7 +126,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio // - or the Java2D/OpenGL pipeline's configuration if (DEBUG) { System.err.println("!!!! NOTE: pixel format already chosen for HDC: 0x" + Long.toHexString(hdc)+ - ", pixelformat "+WGL.GetPixelFormat(hdc)); + ", pixelformat "+pixelFormat); } pixelFormatSet = true; } @@ -138,27 +139,25 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio WindowsWGLDrawable dummyDrawable = null; GLContextImpl dummyContext = null; WGLExt dummyWGLExt = null; - dummyDrawable = new WindowsDummyWGLDrawable(factory); - dummyContext = (GLContextImpl) dummyDrawable.createContext(null); - if (dummyContext != null) { - dummyContext.makeCurrent(); - dummyWGLExt = (WGLExt) dummyContext.getPlatformGLExtensions(); - } - int recommendedPixelFormat = pixelFormat - 1; + if (capabilities.getSampleBuffers()) { + dummyDrawable = new WindowsDummyWGLDrawable(factory); + dummyContext = (GLContextImpl) dummyDrawable.createContext(null); + if (dummyContext != null) { + dummyContext.makeCurrent(); + dummyWGLExt = (WGLExt) dummyContext.getPlatformGLExtensions(); + } + } + int recommendedPixelFormat = pixelFormat; // 1-based pixel format boolean haveWGLChoosePixelFormatARB = false; - boolean haveWGLARBMultisample = false; boolean gotAvailableCaps = false; if (dummyWGLExt != null) { try { haveWGLChoosePixelFormatARB = dummyWGLExt.isExtensionAvailable("WGL_ARB_pixel_format"); if (haveWGLChoosePixelFormatARB) { - haveWGLARBMultisample = dummyWGLExt.isExtensionAvailable("WGL_ARB_multisample"); - - int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS]; - int[] iresults = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS]; - float[] fattributes = new float[1]; - if(pixelFormat<=0) { + int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS]; + float[] fattributes = new float[1]; + if(WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities, iattributes, dummyWGLExt, @@ -174,8 +173,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio numFormatsTmp, 0)) { numFormats = numFormatsTmp[0]; if (recommendedPixelFormat<=0 && numFormats > 0) { - // Remove one-basing of pixel format (added on later) - recommendedPixelFormat = pformats[0] - 1; + recommendedPixelFormat = pformats[0]; if (DEBUG) { System.err.println(getThreadName() + ": Used wglChoosePixelFormatARB to recommend pixel format " + recommendedPixelFormat); } @@ -187,7 +185,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio } } if (DEBUG) { - if (recommendedPixelFormat < 0) { + if (recommendedPixelFormat <= 0) { System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format"); if (capabilities.getSampleBuffers()) { System.err.print(" for multisampled GLCapabilities"); @@ -198,65 +196,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio } } - // Produce a list of GLCapabilities to give to the - // GLCapabilitiesChooser. - // Use wglGetPixelFormatAttribivARB instead of - // DescribePixelFormat to get higher-precision information - // about the pixel format (should make the GLCapabilities - // more precise as well...i.e., remove the - // "HardwareAccelerated" bit, which is basically - // meaningless, and put in whether it can render to a - // window, to a pbuffer, or to a pixmap) - int niattribs = 0; - iattributes[0] = WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB; - if (dummyWGLExt.wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, iattributes, 0, iresults, 0)) { - numFormats = iresults[0]; - - if (DEBUG) { - System.err.println("wglGetPixelFormatAttribivARB reported WGL_NUMBER_PIXEL_FORMATS = " + numFormats); - } - - // Should we be filtering out the pixel formats which aren't - // applicable, as we are doing here? - // We don't have enough information in the GLCapabilities to - // represent those that aren't... - iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_WINDOW_ARB; - iattributes[niattribs++] = WGLExt.WGL_ACCELERATION_ARB; - iattributes[niattribs++] = WGLExt.WGL_SUPPORT_OPENGL_ARB; - iattributes[niattribs++] = WGLExt.WGL_DEPTH_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_STENCIL_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_DOUBLE_BUFFER_ARB; - iattributes[niattribs++] = WGLExt.WGL_STEREO_ARB; - iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE_ARB; - iattributes[niattribs++] = WGLExt.WGL_RED_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_GREEN_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_BLUE_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_ALPHA_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_ACCUM_RED_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_ACCUM_GREEN_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_ACCUM_BLUE_BITS_ARB; - iattributes[niattribs++] = WGLExt.WGL_ACCUM_ALPHA_BITS_ARB; - if (haveWGLARBMultisample) { - iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB; - iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB; - } - - availableCaps = new GLCapabilities[numFormats]; - for (int i = 0; i < numFormats; i++) { - if (!dummyWGLExt.wglGetPixelFormatAttribivARB(hdc, i+1, 0, niattribs, iattributes, 0, iresults, 0)) { - throw new GLException("Error getting pixel format attributes for pixel format " + (i + 1) + " of device context"); - } - availableCaps[i] = WindowsWGLGraphicsConfiguration.AttribList2GLCapabilities(glProfile, iattributes, niattribs, iresults, - pixelFormatSet, onscreen, usePBuffer); - } - gotAvailableCaps = true; - } else { - long lastErr = WGL.GetLastError(); - // Intel Extreme graphics fails with a zero error code - if (lastErr != 0) { - throw new GLException("Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code " + WGL.GetLastError()); - } - } + availableCaps = WindowsWGLGraphicsConfiguration.HDC2GLCapabilities(dummyWGLExt, hdc, -1, glProfile, pixelFormatSet, onscreen, usePBuffer); + gotAvailableCaps = null!=availableCaps ; + choosenBywGLPixelFormat = gotAvailableCaps ; } } finally { dummyContext.release(); @@ -265,7 +207,6 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio } } - // Fallback path for older cards, in particular Intel Extreme motherboard graphics if (!gotAvailableCaps) { if (DEBUG) { if (!capabilities.getSampleBuffers()) { @@ -279,8 +220,6 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio if (DEBUG) { System.err.println(getThreadName() + ": Recommended pixel format = " + recommendedPixelFormat); } - // Remove one-basing of pixel format (added on later) - recommendedPixelFormat -= 1; numFormats = WGL.DescribePixelFormat(hdc, 1, 0, null); if (numFormats == 0) { @@ -305,19 +244,18 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio if(null!=chooser) { // Supply information to chooser try { - pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat); + pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat) + 1; } catch (NativeWindowException e) { throw new GLException(e); } } else { pixelFormat = recommendedPixelFormat; } - if ((pixelFormat < 0) || (pixelFormat >= numFormats)) { + if ((pixelFormat <= 0) || (pixelFormat > numFormats)) { throw new GLException("Invalid result " + pixelFormat + - " from GLCapabilitiesChooser (should be between 0 and " + - (numFormats - 1) + ")"); + " from GLCapabilitiesChooser (should be between 1 and " + + numFormats + ")"); } - pixelFormat += 1; // one-base the index } chosenCaps = availableCaps[pixelFormat-1]; if (DEBUG) { @@ -355,7 +293,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio } else { capabilities = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(glProfile, pfd, onscreen, usePBuffer); } - config.setCapsPFD(capabilities, pfd, pixelFormat); + config.setCapsPFD(capabilities, pfd, pixelFormat, choosenBywGLPixelFormat); } protected static String getThreadName() { diff --git a/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java b/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java index a173baff0..18dc7dae3 100755 --- a/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java +++ b/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java @@ -59,7 +59,7 @@ public class WindowsWindow extends Window { hmon = MonitorFromWindow(windowHandle); if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { Exception e = new Exception("!!! Window new surface handle "+Thread.currentThread().getName()+ - ",HDC 0x"+Long.toHexString(hdc)+", HMON 0x"+Long.toHexString(hmon)); + ", HWND 0x"+Long.toHexString(windowHandle)+", HDC 0x"+Long.toHexString(hdc)+", HMON 0x"+Long.toHexString(hmon)); e.printStackTrace(); } } @@ -105,6 +105,11 @@ public class WindowsWindow extends Window { throw new NativeWindowException("Error creating window"); } windowHandleClose = windowHandle; + if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { + Exception e = new Exception("!!! Window new window handle "+Thread.currentThread().getName()+ + ", HWND 0x"+Long.toHexString(windowHandle)); + e.printStackTrace(); + } } protected void closeNative() { |