diff options
989 files changed, 27611 insertions, 7355 deletions
diff --git a/doc/Implementation/AWTPrinting.txt b/doc/Implementation/AWTPrinting.txt index f2fcbbdd9..7b304e19e 100644 --- a/doc/Implementation/AWTPrinting.txt +++ b/doc/Implementation/AWTPrinting.txt @@ -13,7 +13,7 @@ Print code: AWTPrintLifecycle: <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java;hb=HEAD> GLCanvas: - <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/javax/media/opengl/awt/GLCanvas.java;hb=HEAD#l731> + <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java;hb=HEAD#l731> ... AWTTilePainter (common code): <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java;hb=HEAD> diff --git a/doc/NEWT-Overview.html b/doc/NEWT-Overview.html index 953f95b54..ee6eca8d8 100644 --- a/doc/NEWT-Overview.html +++ b/doc/NEWT-Overview.html @@ -36,7 +36,7 @@ Consider the classic demo code <a href="http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java;hb=HEAD">GearsES2.java</a> [<a href="http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java;h=d92d98894acc4cfe42e77ec316858d16d202b5b8;hb=HEAD">v2.0-rc3</a>], which implements a -<a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLEventListener.html">GLEventEventListener</a>.</p> +<a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GLEventListener.html">GLEventEventListener</a>.</p> <p> The simple application @@ -45,7 +45,7 @@ The simple application creates a NEWT <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/opengl/GLWindow.html">GLWindow</a>, which implements a -<a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLAutoDrawable.html">GLAutoDrawable</a> +<a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GLAutoDrawable.html">GLAutoDrawable</a> and hence is able to add the demo code. NEWT’s GLWindow also implements the NEWT <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/Window.html">Window</a>, which gives you full control of the native windowing, as shown in the demo.</p> @@ -102,7 +102,7 @@ shows the same example using Swing.<br/> Last but not least, the above mechanism can be used to show NEWT Window’s in an AWT Applet.<br/> <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.html">JOGLNewtApplet1Run</a> is an Applet launcher for any -<a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLEventListener.html">GLEventEventListener</a> +<a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GLEventListener.html">GLEventEventListener</a> exposing a default constructor. See it <a href="/deployment/jogamp-next/jogl-test-applets.html"><i>alive</i> here</a>. </p> diff --git a/doc/Overview-OpenGL-Evolution-And-JOGL.html b/doc/Overview-OpenGL-Evolution-And-JOGL.html index c191b5272..c3268c9f7 100644 --- a/doc/Overview-OpenGL-Evolution-And-JOGL.html +++ b/doc/Overview-OpenGL-Evolution-And-JOGL.html @@ -135,27 +135,27 @@ by <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/overview-summary.html#o This is essential since creating an OpenGL context for each class of OpenGL profiles requires it's <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/overview-summary.html#GLAPIInclusionCriteria">specific initialisation</a>.<br/> Some OpenGL profiles like - <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLES2.html">GLES2</a> + <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GLES2.html">GLES2</a> for embedded may not be available on desktop machines.</p> Fixed Function (FFP) Only Profiles: <ul> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLES1.html">GLES1</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GLES1.html">GLES1</a></li> </ul><br/> Programmable Shader (PSP) Only Profiles: <ul> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLES2.html">GLES2</a></li> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLES3.html">GLES3</a></li> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL3.html">GL3</a></li> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL4.html">GL4</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GLES2.html">GLES2</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GLES3.html">GLES3</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL3.html">GL3</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL4.html">GL4</a></li> </ul><br/> FFP & PSP Profiles: <ul> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL2.html">GL2</a></li> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL3bc.html">GL3bc</a></li> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL4bc.html">GL4bc</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL2.html">GL2</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL3bc.html">GL3bc</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL4bc.html">GL4bc</a></li> </ul><br/> <p> @@ -164,25 +164,25 @@ to allow easy development of multiple target profiles.</p> Common OpenGL Profile Subsets: <ul> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL.html">GL</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL.html">GL</a></li> <li>Fixed Function (FFP) Only: <ul> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL2ES1.html">GL2ES1</a></li> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL2GL3.html">GL2GL3</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL2ES1.html">GL2ES1</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL2GL3.html">GL2GL3</a></li> </ul></li> <li>Programmable Shader (PSP) Only: <ul> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL2ES2.html">GL2ES2</a></li> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL3ES3.html">GL3ES3</a></li> - <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL4ES3.html">GL4ES3</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL2ES2.html">GL2ES2</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL3ES3.html">GL3ES3</a></li> + <li><a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL4ES3.html">GL4ES3</a></li> </ul></li> </ul><br/> <br/> For example using the common interface -<a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL2ES2.html">GL2ES2</a> -of <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL2.html">GL2</a> -and <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLES2.html">GLES2</a>, +<a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL2ES2.html">GL2ES2</a> +of <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL2.html">GL2</a> +and <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GLES2.html">GLES2</a>, ensures the code complies with the GL2 and GLES2 profile and an implementation may use both:<br/> <pre> void renderSomethingForGL2(GL2 gl, int program) { diff --git a/doc/deployment/lstjars/lstjars.linux_amd64-20100420.log b/doc/deployment/lstjars/lstjars.linux_amd64-20100420.log index 3e455a7fc..591aa81cf 100644 --- a/doc/deployment/lstjars/lstjars.linux_amd64-20100420.log +++ b/doc/deployment/lstjars/lstjars.linux_amd64-20100420.log @@ -128,9 +128,9 @@ all vs allparts delta -com/jogamp/test/junit/jogl/util/texture/gl2/TextureGL2ListenerDraw1.class -com/jogamp/test/junit/newt/TestWindows01NEWT.class -com/jogamp/test/junit/util/MiscUtils.class - javax/media/nativewindow/AbstractGraphicsConfiguration.class - javax/media/nativewindow/AbstractGraphicsDevice.class - javax/media/nativewindow/AbstractGraphicsScreen.class + com/jogamp/nativewindow/AbstractGraphicsConfiguration.class + com/jogamp/nativewindow/AbstractGraphicsDevice.class + com/jogamp/nativewindow/AbstractGraphicsScreen.class JOGL Deployment Payload for jar JOGL ES1 NEWT CORE diff --git a/etc/test.bat b/etc/test.bat index d635c7e8f..ef924fb56 100755 --- a/etc/test.bat +++ b/etc/test.bat @@ -6,7 +6,7 @@ echo CP_ALL %CP_ALL% set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true"
-REM java -classpath %CP_ALL% %X_ARGS% javax.media.opengl.awt.GLCanvas > java-win64.log 2>&1
+REM java -classpath %CP_ALL% %X_ARGS% com.jogamp.opengl.awt.GLCanvas > java-win64.log 2>&1
REM java -classpath %CP_ALL% %X_ARGS% com.jogamp.common.GlueGenVersion > test.log 2>&1
REM java -classpath %CP_ALL% %X_ARGS% com.jogamp.nativewindow.NativeWindowVersion >> test.log 2>&1
diff --git a/etc/test.sh b/etc/test.sh index 714c3d8a4..3e5be1220 100755 --- a/etc/test.sh +++ b/etc/test.sh @@ -39,6 +39,6 @@ X_ARGS="-Dsun.java2d.noddraw=true -Dsun.java2d.opengl=false" #java $X_ARGS $ARGS_AWT $D_ARGS com.jogamp.nativewindow.NativeWindowVersion 2>&1 | tee -a $logfile #java $X_ARGS $ARGS_AWT $D_ARGS com.jogamp.opengl.JoglVersion 2>&1 | tee -a $logfile #java $X_ARGS $ARGS_AWT $D_ARGS com.jogamp.newt.NewtVersion 2>&1 | tee -a $logfile -#java $X_ARGS $ARGS_AWT $D_ARGS javax.media.opengl.awt.GLCanvas 2>&1 | tee -a $logfile +#java $X_ARGS $ARGS_AWT $D_ARGS com.jogamp.opengl.awt.GLCanvas 2>&1 | tee -a $logfile java $X_ARGS $ARGS_NEWT $D_ARGS com.jogamp.newt.opengl.GLWindow 2>&1 | tee -a $logfile diff --git a/etc/test_dbg.sh b/etc/test_dbg.sh index 72b2b3fcf..7bfd5ee67 100755 --- a/etc/test_dbg.sh +++ b/etc/test_dbg.sh @@ -39,6 +39,6 @@ X_ARGS="-Dsun.java2d.noddraw=true -Dsun.java2d.opengl=false" #java $X_ARGS $ARGS_AWT $D_ARGS com.jogamp.nativewindow.NativeWindowVersion 2>&1 | tee -a $logfile #java $X_ARGS $ARGS_AWT $D_ARGS com.jogamp.opengl.JoglVersion 2>&1 | tee -a $logfile #java $X_ARGS $ARGS_AWT $D_ARGS com.jogamp.newt.NewtVersion 2>&1 | tee -a $logfile -#java $X_ARGS $ARGS_AWT $D_ARGS javax.media.opengl.awt.GLCanvas 2>&1 | tee -a $logfile +#java $X_ARGS $ARGS_AWT $D_ARGS com.jogamp.opengl.awt.GLCanvas 2>&1 | tee -a $logfile java $X_ARGS $ARGS_NEWT $D_ARGS com.jogamp.newt.opengl.GLWindow 2>&1 | tee -a $logfile diff --git a/make/build-common.xml b/make/build-common.xml index a601dc792..89353ccd0 100644 --- a/make/build-common.xml +++ b/make/build-common.xml @@ -447,7 +447,7 @@ <property name="jogl-all-noawt.jar" value="${jar}/jogl-all-noawt.jar" /> <property name="jogl-all-mobile.jar" value="${jar}/jogl-all-mobile.jar" /> <property name="jogl-all-android.jar" value="${jar}/jogl-all-android.jar" /> - <property name="jogl-all-android.apk" value="${jar}/jogl-all-android-${android.abi}.apk" /> + <property name="jogl-all-android.apk" value="${jar}/jogl-all-${os.and.arch}.apk" /> <!-- JavaSE combinations . JOAL (optional) --> <property name="joal.jar" value="${build.joal}/jar/joal.jar" /> diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 4efe992de..119bb9d3d 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -92,20 +92,20 @@ value="com/jogamp/opengl/util/* jogamp/opengl/util/* com/jogamp/opengl/util/glsl/* jogamp/opengl/util/glsl/* jogamp/opengl/shader/**"/> <property name="java.part.core" - value="${java.part.gluegen-gl-rt} javax/media/opengl/* javax/media/opengl/fixedfunc/* com/jogamp/opengl/* com/jogamp/opengl/math/** jogamp/opengl/* ${java.part.core.util}"/> - <property name="java.part.core.exclude" value="javax/media/opengl/Debug* javax/media/opengl/Trace* com/jogamp/opengl/util/AWTAnimatorImpl* com/jogamp/opengl/util/PNG*"/> + value="${java.part.gluegen-gl-rt} com/jogamp/opengl/* com/jogamp/opengl/fixedfunc/* com/jogamp/opengl/math/** jogamp/opengl/* ${java.part.core.util}"/> + <property name="java.part.core.exclude" value="com/jogamp/opengl/Debug* com/jogamp/opengl/Trace* com/jogamp/opengl/util/AWTAnimatorImpl* com/jogamp/opengl/util/PNG*"/> <property name="java.part.nv-cg" value="com/jogamp/opengl/cg com/jogamp/opengl/cg/* jogamp/opengl/cg/*"/> <property name="java.part.egl" - value="jogamp/opengl/egl/*"/> + value="com/jogamp/opengl/egl/* jogamp/opengl/egl/*"/> <property name="java.part.glu" - value="javax/media/opengl/glu/* javax/media/opengl/glu/gl2es1/* jogamp/opengl/glu/* jogamp/opengl/glu/error/* jogamp/opengl/glu/tessellator/** jogamp/opengl/glu/mipmap/**"/> + value="com/jogamp/opengl/glu/* com/jogamp/opengl/glu/gl2es1/* jogamp/opengl/glu/* jogamp/opengl/glu/error/* jogamp/opengl/glu/tessellator/** jogamp/opengl/glu/mipmap/**"/> <property name="java.part.glu.gldesktop" - value="jogamp/opengl/glu/gl2/** jogamp/opengl/glu/nurbs/** jogamp/opengl/glu/registry/** javax/media/opengl/glu/gl2/**"/> + value="jogamp/opengl/glu/gl2/** jogamp/opengl/glu/nurbs/** jogamp/opengl/glu/registry/** com/jogamp/opengl/glu/gl2/**"/> <property name="java.part.openmax" value="jogamp/opengl/omx/**"/> @@ -132,22 +132,22 @@ value="jogamp/opengl/**/gl2/** jogamp/opengl/**/gl3/** jogamp/opengl/**/gl4/**"/> <property name="java.part.gldesktop.dbg" - value="javax/media/opengl/TraceGL2.* javax/media/opengl/DebugGL2.* javax/media/opengl/TraceGL3.* javax/media/opengl/DebugGL3.* javax/media/opengl/TraceGL3bc.* javax/media/opengl/DebugGL3bc.* javax/media/opengl/TraceGL4.* javax/media/opengl/DebugGL4.* javax/media/opengl/TraceGL4bc.* javax/media/opengl/DebugGL4bc.*"/> + value="com/jogamp/opengl/TraceGL2.* com/jogamp/opengl/DebugGL2.* com/jogamp/opengl/TraceGL3.* com/jogamp/opengl/DebugGL3.* com/jogamp/opengl/TraceGL3bc.* com/jogamp/opengl/DebugGL3bc.* com/jogamp/opengl/TraceGL4.* com/jogamp/opengl/DebugGL4.* com/jogamp/opengl/TraceGL4bc.* com/jogamp/opengl/DebugGL4bc.*"/> <property name="java.part.es1" - value="javax/media/opengl/**/es1/** com/jogamp/opengl/**/es1/** jogamp/opengl/**/es1/**"/> + value="com/jogamp/opengl/**/es1/** jogamp/opengl/**/es1/**"/> <property name="java.part.es1.dbg" - value="javax/media/opengl/TraceGLES1.* javax/media/opengl/DebugGLES1.*"/> + value="com/jogamp/opengl/TraceGLES1.* com/jogamp/opengl/DebugGLES1.*"/> <property name="java.part.es2es3" value="jogamp/opengl/**/es3/**"/> <property name="java.part.es2es3.dbg" - value="javax/media/opengl/TraceGLES2.* javax/media/opengl/DebugGLES2.* javax/media/opengl/TraceGLES3.* javax/media/opengl/DebugGLES3.*"/> + value="com/jogamp/opengl/TraceGLES2.* com/jogamp/opengl/DebugGLES2.* com/jogamp/opengl/TraceGLES3.* com/jogamp/opengl/DebugGLES3.*"/> <property name="java.part.awt" - value="javax/media/opengl/awt/** jogamp/opengl/**/awt/** com/jogamp/opengl/util/AWTAnimatorImpl*"/> + value="com/jogamp/opengl/awt/** jogamp/opengl/**/awt/** com/jogamp/opengl/util/AWTAnimatorImpl*"/> <property name="java.part.swt" value="com/jogamp/opengl/**/swt/**"/> @@ -307,7 +307,7 @@ <property name="javadoc.dev" value="${project.root}/javadoc_jogl_dev" /> <property name="javadoc.windowtitle" value="JOGL API Specification -- Version ${jogamp.version.base}" /> <property name="javadoc.overview" value="doc/jogl/spec-overview.html" /> - <property name="javadoc.spec.packagenames" value="javax.media.opengl.*" /> + <property name="javadoc.spec.packagenames" value="com.jogamp.opengl.*" /> <property name="javadoc.packagenames" value="${javadoc.spec.packagenames},com.jogamp.opengl.util.*" /> @@ -378,31 +378,31 @@ <!-- Now check for the presence of one well-known file --> <uptodate property="java.generate.skip.es1" - targetfile="${src.generated.java}/javax/media/opengl/GLES1.java"> + targetfile="${src.generated.java}/com/jogamp/opengl/GLES1.java"> <srcfiles refid="stub.includes.dependencies.fileset.1" /> <srcfiles refid="stub.includes.dependencies.fileset.2" /> <srcfiles refid="stub.includes.dependencies.fileset.3" /> </uptodate> <uptodate property="java.generate.skip.es2" - targetfile="${src.generated.java}/javax/media/opengl/GLES2.java"> + targetfile="${src.generated.java}/com/jogamp/opengl/GLES2.java"> <srcfiles refid="stub.includes.dependencies.fileset.1" /> <srcfiles refid="stub.includes.dependencies.fileset.2" /> <srcfiles refid="stub.includes.dependencies.fileset.3" /> </uptodate> <uptodate property="java.generate.skip.es3" - targetfile="${src.generated.java}/javax/media/opengl/GLES3.java"> + targetfile="${src.generated.java}/com/jogamp/opengl/GLES3.java"> <srcfiles refid="stub.includes.dependencies.fileset.1" /> <srcfiles refid="stub.includes.dependencies.fileset.2" /> <srcfiles refid="stub.includes.dependencies.fileset.3" /> </uptodate> <uptodate property="java.generate.skip.gl2" - targetfile="${src.generated.java}/javax/media/opengl/GL2.java"> + targetfile="${src.generated.java}/com/jogamp/opengl/GL2.java"> <srcfiles refid="stub.includes.dependencies.fileset.1" /> <srcfiles refid="stub.includes.dependencies.fileset.2" /> <srcfiles refid="stub.includes.dependencies.fileset.3" /> </uptodate> <uptodate property="java.generate.skip.glu" - targetfile="${src.generated.java}/javax/media/opengl/glu/GLU.java"> + targetfile="${src.generated.java}/com/jogamp/opengl/glu/GLU.java"> <srcfiles refid="stub.includes.dependencies.fileset.1" /> <srcfiles refid="stub.includes.dependencies.fileset.2" /> <srcfiles refid="stub.includes.dependencies.fileset.3" /> @@ -917,15 +917,15 @@ <!-- Blow away the DebugGL*.java and TraceGL*.java sources if GL*.class has changed (the uptodate element doesn't support arbitrary source and destination files) --> <dependset> - <srcfilelist dir="${classes}/javax/media/opengl" files="GLES1.class" /> - <targetfileset dir="${src.generated.java}/javax/media/opengl" + <srcfilelist dir="${classes}/com/jogamp/opengl" files="GLES1.class" /> + <targetfileset dir="${src.generated.java}/com/jogamp/opengl" includes="DebugGLES1.java,TraceGLES1.java" /> </dependset> <!-- Now choose one of the two to test to see if we have to regenerate --> <uptodate property="java.generate.composable.pipeline.skip.es1" - srcfile="${classes}/javax/media/opengl/GLES1.class" - targetfile="${src.generated.java}/javax/media/opengl/DebugGLES1.java" /> + srcfile="${classes}/com/jogamp/opengl/GLES1.class" + targetfile="${src.generated.java}/com/jogamp/opengl/DebugGLES1.java" /> </target> @@ -933,15 +933,15 @@ <!-- Blow away the DebugGL*.java and TraceGL*.java sources if GL*.class has changed (the uptodate element doesn't support arbitrary source and destination files) --> <dependset> - <srcfilelist dir="${classes}/javax/media/opengl" files="GLES2.class" /> - <targetfileset dir="${src.generated.java}/javax/media/opengl" + <srcfilelist dir="${classes}/com/jogamp/opengl" files="GLES2.class" /> + <targetfileset dir="${src.generated.java}/com/jogamp/opengl" includes="DebugGLES2.java,TraceGLES2.java" /> </dependset> <!-- Now choose one of the two to test to see if we have to regenerate --> <uptodate property="java.generate.composable.pipeline.skip.es2" - srcfile="${classes}/javax/media/opengl/GLES2.class" - targetfile="${src.generated.java}/javax/media/opengl/DebugGLES2.java" /> + srcfile="${classes}/com/jogamp/opengl/GLES2.class" + targetfile="${src.generated.java}/com/jogamp/opengl/DebugGLES2.java" /> </target> @@ -949,15 +949,15 @@ <!-- Blow away the DebugGL*.java and TraceGL*.java sources if GL*.class has changed (the uptodate element doesn't support arbitrary source and destination files) --> <dependset> - <srcfilelist dir="${classes}/javax/media/opengl" files="GLES3.class" /> - <targetfileset dir="${src.generated.java}/javax/media/opengl" + <srcfilelist dir="${classes}/com/jogamp/opengl" files="GLES3.class" /> + <targetfileset dir="${src.generated.java}/com/jogamp/opengl" includes="DebugGLES3.java,TraceGLES3.java" /> </dependset> <!-- Now choose one of the two to test to see if we have to regenerate --> <uptodate property="java.generate.composable.pipeline.skip.es3" - srcfile="${classes}/javax/media/opengl/GLES3.class" - targetfile="${src.generated.java}/javax/media/opengl/DebugGLES3.java" /> + srcfile="${classes}/com/jogamp/opengl/GLES3.class" + targetfile="${src.generated.java}/com/jogamp/opengl/DebugGLES3.java" /> </target> @@ -965,67 +965,67 @@ <!-- Blow away the DebugGL*.java and TraceGL*.java sources if GL*.class has changed (the uptodate element doesn't support arbitrary source and destination files) --> <dependset> - <srcfilelist dir="${classes}/javax/media/opengl" files="GL2.class" /> - <targetfileset dir="${src.generated.java}/javax/media/opengl" + <srcfilelist dir="${classes}/com/jogamp/opengl" files="GL2.class" /> + <targetfileset dir="${src.generated.java}/com/jogamp/opengl" includes="DebugGL2.java,TraceGL2.java" /> </dependset> <!-- Now choose one of the two to test to see if we have to regenerate --> <uptodate property="java.generate.composable.pipeline.skip.gl2" - srcfile="${classes}/javax/media/opengl/GL2.class" - targetfile="${src.generated.java}/javax/media/opengl/DebugGL2.java" /> + srcfile="${classes}/com/jogamp/opengl/GL2.class" + targetfile="${src.generated.java}/com/jogamp/opengl/DebugGL2.java" /> </target> <target name="java.generate.composable.pipeline.check.gl3"> <!-- Blow away the DebugGL*.java and TraceGL*.java sources if GL*.class has changed (the uptodate element doesn't support arbitrary source and destination files) --> <dependset> - <srcfilelist dir="${classes}/javax/media/opengl" files="GL3.class" /> - <targetfileset dir="${src.generated.java}/javax/media/opengl" + <srcfilelist dir="${classes}/com/jogamp/opengl" files="GL3.class" /> + <targetfileset dir="${src.generated.java}/com/jogamp/opengl" includes="DebugGL3.java,TraceGL3.java,DebugGL3bc.java,TraceGL3bc.java" /> </dependset> <!-- Now choose one of the two to test to see if we have to regenerate --> <uptodate property="java.generate.composable.pipeline.skip.gl3" - srcfile="${classes}/javax/media/opengl/GL3.class" - targetfile="${src.generated.java}/javax/media/opengl/DebugGL3.java" /> + srcfile="${classes}/com/jogamp/opengl/GL3.class" + targetfile="${src.generated.java}/com/jogamp/opengl/DebugGL3.java" /> </target> <target name="java.generate.composable.pipeline.check.gl4bc"> <!-- Blow away the DebugGL*.java and TraceGL*.java sources if GL*.class has changed (the uptodate element doesn't support arbitrary source and destination files) --> <dependset> - <srcfilelist dir="${classes}/javax/media/opengl" files="GL4bc.class" /> - <targetfileset dir="${src.generated.java}/javax/media/opengl" + <srcfilelist dir="${classes}/com/jogamp/opengl" files="GL4bc.class" /> + <targetfileset dir="${src.generated.java}/com/jogamp/opengl" includes="DebugGL4bc.java,TraceGL4bc.java" /> </dependset> <!-- Now choose one of the two to test to see if we have to regenerate --> <uptodate property="java.generate.composable.pipeline.skip.gl4bc" - srcfile="${classes}/javax/media/opengl/GL4bc.class" - targetfile="${src.generated.java}/javax/media/opengl/DebugGL4bc.java" /> + srcfile="${classes}/com/jogamp/opengl/GL4bc.class" + targetfile="${src.generated.java}/com/jogamp/opengl/DebugGL4bc.java" /> </target> <target name="java.generate.composable.pipeline.es1" depends="java.generate.composable.pipeline.check.es1" unless="java.generate.composable.pipeline.skip.es1"> <java classname="com.jogamp.gluegen.opengl.BuildComposablePipeline" fork="yes" failonerror="true"> - <arg value="javax.media.opengl.GLES1" /> - <arg value="${src.generated.java}/javax/media/opengl" /> + <arg value="com.jogamp.opengl.GLES1" /> + <arg value="${src.generated.java}/com/jogamp/opengl" /> <classpath refid="pipeline.classpath" /> </java> </target> <target name="java.generate.composable.pipeline.es3" depends="java.generate.composable.pipeline.check.es3" unless="java.generate.composable.pipeline.skip.es3"> <java classname="com.jogamp.gluegen.opengl.BuildComposablePipeline" fork="yes" failonerror="true"> - <arg value="javax.media.opengl.GLES3" /> - <arg value="${src.generated.java}/javax/media/opengl" /> + <arg value="com.jogamp.opengl.GLES3" /> + <arg value="${src.generated.java}/com/jogamp/opengl" /> <classpath refid="pipeline.classpath" /> </java> </target> <target name="java.generate.composable.pipeline.gl4bc" depends="java.generate.composable.pipeline.check.gl4bc" unless="java.generate.composable.pipeline.skip.gl4bc"> <java classname="com.jogamp.gluegen.opengl.BuildComposablePipeline" fork="yes" failonerror="true"> - <arg value="javax.media.opengl.GL4bc" /> - <arg value="${src.generated.java}/javax/media/opengl" /> + <arg value="com.jogamp.opengl.GL4bc" /> + <arg value="${src.generated.java}/com/jogamp/opengl" /> <classpath refid="pipeline.classpath" /> </java> </target> @@ -1038,24 +1038,24 @@ (the uptodate element doesn't support arbitrary source and destination files) --> <dependset> <srcfilelist dir="${classes}/jogamp/opengl/util/glsl/fixedfunc" files="FixedFuncHook.class" /> - <srcfilelist dir="${classes}/javax/media/opengl" files="GL2ES1.class" /> - <srcfilelist dir="${classes}/javax/media/opengl" files="GL2ES2.class" /> + <srcfilelist dir="${classes}/com/jogamp/opengl" files="GL2ES1.class" /> + <srcfilelist dir="${classes}/com/jogamp/opengl" files="GL2ES2.class" /> <targetfileset dir="${src.generated.java}/jogamp/opengl/util/glsl/fixedfunc" includes="FixedFuncImpl.java" /> </dependset> <!-- Now choose one of the two to test to see if we have to regenerate --> <uptodate property="java.generate.composable.pipeline.custom.skip.glfixfunc" - srcfile="${classes}/javax/media/opengl/GL2ES1.class" + srcfile="${classes}/com/jogamp/opengl/GL2ES1.class" targetfile="${src.generated.java}/jogamp/opengl/util/glsl/fixedfunc/FixedFuncImpl.java" /> </target> <target name="java.generate.composable.pipeline.custom.glfixfunc" depends="java.generate.composable.pipeline.custom.check.glfixfunc" unless="java.generate.composable.pipeline.custom.skip.glfixfunc"> <java classname="com.jogamp.gluegen.opengl.BuildComposablePipeline" fork="yes" failonerror="true"> - <arg value="javax.media.opengl.GL2ES1" /> + <arg value="com.jogamp.opengl.GL2ES1" /> <arg value="${src.generated.java}/jogamp/opengl/util/glsl/fixedfunc" /> <arg value="jogamp.opengl.util.glsl.fixedfunc.FixedFuncImpl" /> <arg value="jogamp.opengl.util.glsl.fixedfunc.FixedFuncHook" /> - <arg value="javax.media.opengl.GL2ES2" /> + <arg value="com.jogamp.opengl.GL2ES2" /> <arg value="prolog_xor_downstream" /> <arg value="gl_identity_by_assignable_class" /> <classpath refid="pipeline.classpath" /> @@ -1072,7 +1072,7 @@ <target name="java.compile.firstpass" depends="java.generate,java.generate.cg"> <!-- Perform the first pass Java compile. --> <javac destdir="${classes}" - includes="javax/media/opengl/fixedfunc/** javax/media/opengl/GLDrawableFactory.java javax/media/opengl/GLDrawable.java javax/media/opengl/GLContext.java javax/media/opengl/GL.java javax/media/opengl/GL2ES1.java javax/media/opengl/GLES1.java javax/media/opengl/GL2ES2.java javax/media/opengl/GLES2.java javax/media/opengl/GL2ES3.java javax/media/opengl/GL2GL3.java javax/media/opengl/GL2.java javax/media/opengl/GL3ES3.java javax/media/opengl/GL3.java javax/media/opengl/GL3bc.java javax/media/opengl/GL4ES3.java javax/media/opengl/GLES3.java javax/media/opengl/GL4.java javax/media/opengl/GL4bc.java" + includes="com/jogamp/opengl/fixedfunc/** com/jogamp/opengl/GLDrawableFactory.java com/jogamp/opengl/GLDrawable.java com/jogamp/opengl/GLContext.java com/jogamp/opengl/GL.java com/jogamp/opengl/GL2ES1.java com/jogamp/opengl/GLES1.java com/jogamp/opengl/GL2ES2.java com/jogamp/opengl/GLES2.java com/jogamp/opengl/GL2ES3.java com/jogamp/opengl/GL2GL3.java com/jogamp/opengl/GL2.java com/jogamp/opengl/GL3ES3.java com/jogamp/opengl/GL3.java com/jogamp/opengl/GL3bc.java com/jogamp/opengl/GL4ES3.java com/jogamp/opengl/GLES3.java com/jogamp/opengl/GL4.java com/jogamp/opengl/GL4bc.java" fork="yes" includeAntRuntime="false" memoryMaximumSize="${javac.memorymax}" @@ -1194,6 +1194,12 @@ <compilerarg value="/usr/include" /> </compiler> + <compiler id="compiler.cfg.linux.aarch64.jogl.x11" extends="compiler.cfg.linux.aarch64"> + <!-- Need to force /usr/include headers on to include path (after all others), due to crosscompiler usage --> + <compilerarg value="-idirafter" /> + <compilerarg value="/usr/include" /> + </compiler> + <!-- linker configuration --> <linker id="linker.cfg.freebsd.jogl.x11" extends="linker.cfg.freebsd"> @@ -1220,6 +1226,10 @@ <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="X11"/> </linker> + <linker id="linker.cfg.linux.aarch64.jogl.x11" extends="linker.cfg.linux.aarch64"> + <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="X11"/> + </linker> + <linker id="linker.cfg.android.jogl" extends="linker.cfg.android"> </linker> @@ -1311,6 +1321,12 @@ <property name="linker.cfg.id.os" value="linker.cfg.linux.armv6.jogl.x11" /> </target> + <target name="c.configure.linux.aarch64" if="isLinuxARM64"> + <echo message="Linux.aarch64" /> + <property name="compiler.cfg.id" value="compiler.cfg.linux.aarch64.jogl.x11" /> + <property name="linker.cfg.id.os" value="linker.cfg.linux.aarch64.jogl.x11" /> + </target> + <target name="c.configure.linux.ia64" if="isLinuxIA64"> <echo message="Linux.IA64" /> <property name="compiler.cfg.id" value="compiler.cfg.linux" /> @@ -1353,7 +1369,7 @@ <property name="linker.cfg.id.os" value="linker.cfg.linux.jogl.x11" /> </target> - <target name="c.configure.linux" depends="c.configure.linux.armv6,c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.x11" if="isLinux" /> + <target name="c.configure.linux" depends="c.configure.linux.armv6,c.configure.linux.aarch64,c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.x11" if="isLinux" /> <target name="c.configure.android" if="isAndroid"> <echo message="Android" /> @@ -1512,11 +1528,13 @@ <include name="${rootrel.obj.joglsub}/ffmpeg_lavc53_lavf53_lavu51.*"/> <include name="${rootrel.obj.joglsub}/ffmpeg_lavc54_lavf54_lavu52_lavr01.*"/> <include name="${rootrel.obj.joglsub}/ffmpeg_lavc55_lavf55_lavu53_lavr01.*"/> + <include name="${rootrel.obj.joglsub}/ffmpeg_lavc56_lavf56_lavu54_lavr02.*"/> </patternset> <patternset id="c.src.files.jogl.desktop"> <include name="${rootrel.src.c}/JoglCommon.c"/> <include name="${rootrel.src.c}/GLContext.c"/> + <include name="${rootrel.src.c}/EGLContext.c"/> <include name="${rootrel.src.c}/GLDebugMessageHandler.c"/> <include name="${rootrel.src.c}/timespec.c" if="isOSX"/> <!-- currently only used for OSX --> <include name="${rootrel.src.c}/macosx/MacOSXCustomCGLCode.c" if="isOSX"/> @@ -1543,6 +1561,7 @@ <patternset id="c.src.files.jogl.mobile"> <include name="${rootrel.src.c}/JoglCommon.c"/> <include name="${rootrel.src.c}/GLContext.c"/> + <include name="${rootrel.src.c}/EGLContext.c"/> <include name="${rootrel.src.c}/GLDebugMessageHandler.c"/> <include name="${rootrel.src.c}/GLXGetProcAddressARB.c" if="isX11"/> <include name="${rootrel.src.c.libav}/ffmpeg_static.c"/> @@ -1650,7 +1669,7 @@ <target name="c.build.jogl.prepare"> <javah destdir="${build.jogl}/gensrc/native/jogl" classpath="${javah.classpath}" class="jogamp.opengl.GLDebugMessageHandler, jogamp.opengl.GLContextImpl" /> - <javah destdir="${src.generated.c.libav}" classpath="${javah.classpath}" class="jogamp.opengl.util.av.impl.FFMPEGStaticNatives,jogamp.opengl.util.av.impl.FFMPEGv08Natives,jogamp.opengl.util.av.impl.FFMPEGv09Natives,jogamp.opengl.util.av.impl.FFMPEGv10Natives" /> + <javah destdir="${src.generated.c.libav}" classpath="${javah.classpath}" class="jogamp.opengl.util.av.impl.FFMPEGStaticNatives,jogamp.opengl.util.av.impl.FFMPEGv08Natives,jogamp.opengl.util.av.impl.FFMPEGv09Natives,jogamp.opengl.util.av.impl.FFMPEGv10Natives,jogamp.opengl.util.av.impl.FFMPEGv11Natives" /> <javah destdir="${src.generated.c.openmax}" classpath="${javah.classpath}" class="jogamp.opengl.util.av.impl.OMXGLMediaPlayer" /> <!-- Generate the waveout Mixer header --> <!-- FIXME: this is temporary until we move this to another workspace --> @@ -1670,6 +1689,11 @@ output.lib.name="jogl_ffmpegv10" compiler.cfg.id="${compiler.cfg.id}" linker.cfg.id="${linker.cfg.id.os}"/> + + <c.build.ffmpeg version.lav="lavc56_lavf56_lavu54_lavr02" + output.lib.name="jogl_ffmpegv11" + compiler.cfg.id="${compiler.cfg.id}" + linker.cfg.id="${linker.cfg.id.os}"/> </target> <target name="c.build.jogl.desktop" unless="setup.noNativeDesktop"> @@ -1905,6 +1929,7 @@ bottom="${javadoc.bottom}" > <classpath refid="nativewindow_gluegen.classpath"/> <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" /> + <arg value="${javadoc.xarg1}"/> </javadoc> </target> @@ -1921,6 +1946,7 @@ bottom="${javadoc.bottom}" > <classpath refid="nativewindow_gluegen.classpath"/> <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" /> + <arg value="${javadoc.xarg1}"/> </javadoc> </target> @@ -1937,6 +1963,7 @@ bottom="${javadoc.bottom}" > <classpath refid="nativewindow_gluegen.classpath"/> <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" /> + <arg value="${javadoc.xarg1}"/> </javadoc> </target> diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml index 76fc5a287..92a2bf9d0 100644 --- a/make/build-nativewindow.xml +++ b/make/build-nativewindow.xml @@ -67,7 +67,7 @@ <!-- partitioning --> <property name="java.part.core" - value="javax/media/nativewindow/* javax/media/nativewindow/util/* com/jogamp/nativewindow/* com/jogamp/nativewindow/egl/* com/jogamp/nativewindow/swt/** jogamp/nativewindow/*"/> + value="com/jogamp/nativewindow/* com/jogamp/nativewindow/util/* com/jogamp/nativewindow/egl/* com/jogamp/nativewindow/swt/** jogamp/nativewindow/*"/> <property name="java.part.awt" value="com/jogamp/nativewindow/awt/* jogamp/nativewindow/jawt/** jogamp/nativewindow/**/awt/**"/> @@ -150,8 +150,8 @@ <property name="javadoc.spec" value="${project.root}/javadoc_nativewindow_spec" /> <property name="javadoc.dev" value="${project.root}/javadoc_nativewindow_dev" /> <property name="javadoc.windowtitle" value="Native Windowing Interface (NativeWindow) API -- ${jogamp.version.base} Specification" /> - <property name="javadoc.overview" value="../src/nativewindow/classes/javax/media/nativewindow/package.html" /> - <property name="javadoc.spec.packagenames" value="javax.media.nativewindow.*" /> + <property name="javadoc.overview" value="../src/nativewindow/classes/com/jogamp/nativewindow/package.html" /> + <property name="javadoc.spec.packagenames" value="com.jogamp.nativewindow.*" /> <property name="javadoc.packagenames" value="${javadoc.spec.packagenames}" /> @@ -344,6 +344,12 @@ <compilerarg value="/usr/include" /> </compiler> + <compiler id="compiler.cfg.linux.aarch64.nativewindow.x11" extends="compiler.cfg.linux.aarch64"> + <!-- Need to force /usr/include headers on to include path (after all others), due to crosscompiler usage --> + <compilerarg value="-idirafter" /> + <compilerarg value="/usr/include" /> + </compiler> + <compiler id="compiler.cfg.solaris.nativewindow.x11" extends="compiler.cfg.solaris"> <compilerarg value="-I/usr/X11R6/include" /> </compiler> @@ -397,6 +403,12 @@ <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="Xrender" /> </linker> + <linker id="linker.cfg.linux.aarch64.nativewindow.x11" extends="linker.cfg.linux.aarch64"> + <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="X11" /> + <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="Xxf86vm" /> + <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="Xrender" /> + </linker> + <linker id="linker.cfg.solaris.nativewindow.x11" extends="linker.cfg.solaris"> <linkerarg value="-L/usr/sfw/lib"/> <syslibset libs="X11"/> @@ -485,6 +497,12 @@ <property name="linker.cfg.id.oswin" value="linker.cfg.linux.armv6.nativewindow.x11" /> </target> + <target name="c.configure.linux.aarch64" if="isLinuxARM64"> + <echo message="Linux.aarch64" /> + <property name="compiler.cfg.id" value="compiler.cfg.linux.aarch64.nativewindow.x11" /> + <property name="linker.cfg.id.oswin" value="linker.cfg.linux.aarch64.nativewindow.x11" /> + </target> + <target name="c.configure.linux.ia64" if="isLinuxIA64"> <echo message="Linux.IA64" /> <property name="compiler.cfg.id" value="compiler.cfg.linux" /> @@ -527,7 +545,7 @@ <property name="linker.cfg.id.oswin" value="linker.cfg.linux.nativewindow.x11" /> </target> - <target name="c.configure.linux" depends="c.configure.linux.armv6,c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.x11" if="isLinux" /> + <target name="c.configure.linux" depends="c.configure.linux.armv6,c.configure.linux.aarch64,c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.x11" if="isLinux" /> <target name="c.configure.android" if="isAndroid"> <echo message="Android" /> @@ -870,6 +888,7 @@ maxmemory="${javac.memorymax}" linkoffline="${javadoc.link} 142-packages" bottom="${javadoc.bottom}" > + <arg value="${javadoc.xarg1}"/> </javadoc> </target> @@ -885,6 +904,7 @@ maxmemory="${javac.memorymax}" linkoffline="${javadoc.link} 142-packages" bottom="${javadoc.bottom}" > + <arg value="${javadoc.xarg1}"/> </javadoc> </target> @@ -900,6 +920,7 @@ maxmemory="${javac.memorymax}" linkoffline="${javadoc.link} 142-packages" bottom="${javadoc.bottom}" > + <arg value="${javadoc.xarg1}"/> </javadoc> </target> diff --git a/make/build-newt.xml b/make/build-newt.xml index 4a5997b02..cf8330eb1 100644 --- a/make/build-newt.xml +++ b/make/build-newt.xml @@ -271,6 +271,12 @@ <compilerarg value="/usr/include" /> </compiler> + <compiler id="compiler.cfg.linux.aarch64.newt.x11" extends="compiler.cfg.linux.aarch64"> + <!-- Need to force /usr/include headers on to include path (after all others), due to crosscompiler usage --> + <compilerarg value="-idirafter" /> + <compilerarg value="/usr/include" /> + </compiler> + <!-- linker configuration --> <linker id="linker.cfg.freebsd.newt.x11" extends="linker.cfg.freebsd"> @@ -331,6 +337,12 @@ <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="Xcursor" /> </linker> + <linker id="linker.cfg.linux.aarch64.newt.x11" extends="linker.cfg.linux.aarch64"> + <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="X11" /> + <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="Xrandr" /> + <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="Xcursor" /> + </linker> + <linker id="linker.cfg.android.newt" extends="linker.cfg.android"> <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="android" /> </linker> @@ -431,6 +443,16 @@ <echo message="linker.cfg.id.oswin ${linker.cfg.id.oswin}" /> </target> + <target name="c.configure.linux.aarch64" if="isLinuxARM64"> + <echo message="Linux.aarch64" /> + <property name="compiler.cfg.id" value="compiler.cfg.linux.aarch64.newt.x11" /> + <condition property="linker.cfg.id.oswin" value="linker.cfg.linux.aarch64.newt.x11" + else="linker.cfg.linux.aarch64"> + <isset property="isX11" /> + </condition> + <echo message="linker.cfg.id.oswin ${linker.cfg.id.oswin}" /> + </target> + <target name="c.configure.linux.hppa" if="isLinuxHppa"> <echo message="Linux.hppa" /> <property name="compiler.cfg.id" value="compiler.cfg.linux" /> @@ -497,7 +519,7 @@ <property name="linker.cfg.id.oswin" value="linker.cfg.linux.newt.x11" /> </target> - <target name="c.configure.linux" depends="c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.armv6,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.linux.ia64,c.configure.x11" if="isLinux"/> + <target name="c.configure.linux" depends="c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.armv6,c.configure.linux.aarch64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.linux.ia64,c.configure.x11" if="isLinux"/> <target name="c.configure.android" if="isAndroid"> <echo message="Android" /> @@ -868,6 +890,7 @@ linkoffline="${javadoc.link} 142-packages" bottom="${javadoc.bottom}" > <classpath refid="jogl_doc.classpath"/> + <arg value="${javadoc.xarg1}"/> </javadoc> </target> @@ -884,6 +907,7 @@ linkoffline="${javadoc.link} 142-packages" bottom="${javadoc.bottom}" > <classpath refid="jogl_doc.classpath"/> + <arg value="${javadoc.xarg1}"/> </javadoc> </target> @@ -900,6 +924,7 @@ linkoffline="${javadoc.link} 142-packages" bottom="${javadoc.bottom}" > <classpath refid="jogl_doc.classpath"/> + <arg value="${javadoc.xarg1}"/> </javadoc> </target> diff --git a/make/build-oculusvr.xml b/make/build-oculusvr.xml index aa0308365..48d48056d 100644 --- a/make/build-oculusvr.xml +++ b/make/build-oculusvr.xml @@ -686,6 +686,7 @@ bottom="" > <classpath refid="nativewindow_gluegen.classpath"/> <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" /> + <arg value="${javadoc.xarg1}"/> </javadoc> </target> diff --git a/make/build.xml b/make/build.xml index 03a711c54..14c1a3c09 100644 --- a/make/build.xml +++ b/make/build.xml @@ -394,12 +394,12 @@ <property name="javadoc.overview" value="doc/jogl/spec-overview.html" /> - <property name="javadoc.nw.overview" value="../src/nativewindow/classes/javax/media/nativewindow/package.html" /> + <property name="javadoc.nw.overview" value="../src/nativewindow/classes/com/jogamp/nativewindow/package.html" /> <property name="javadoc.nw.spec.windowtitle" value="NativeWindow API -- ${jogamp.version.base} Specification" /> - <property name="javadoc.nw.spec.packagenames" value="javax.media.nativewindow.*" /> + <property name="javadoc.nw.spec.packagenames" value="com.jogamp.nativewindow.*" /> <property name="javadoc.spec.windowtitle" value="JOGL API -- ${jogamp.version.base} Specification" /> - <property name="javadoc.spec.packagenames" value="javax.media.opengl.*" /> + <property name="javadoc.spec.packagenames" value="com.jogamp.opengl.*" /> <property name="javadoc.windowtitle" value="JOGL, NativeWindow and NEWT APIs" /> <property name="javadoc.packagenames" value="${javadoc.nw.spec.packagenames}, ${javadoc.spec.packagenames}, com.jogamp.opengl.*, com.jogamp.graph.*, com.jogamp.nativewindow.*, com.jogamp.newt.*, com.jogamp.oculusvr.*" /> @@ -430,6 +430,7 @@ <link offline="false" href="${gluegen.link}" /> <arg line="-J-Dnativetaglet.mapping=${basedir}/native-taglet.properties"/> <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" /> + <arg value="${javadoc.xarg1}"/> </javadoc> <copy todir="${javadoc.jogl.public.path}/resources" overwrite="true"> <fileset dir="${gluegen.make}/doc/javadoc/resources" includes="*" /> @@ -457,6 +458,7 @@ <arg line="-J-Dnativetaglet.mapping=${basedir}/native-taglet.properties"/> <link offline="false" href="../javadoc_nativewindow_spec" /> <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" /> + <arg value="${javadoc.xarg1}"/> </javadoc> <copy todir="${javadoc.jogl.spec.path}/resources" overwrite="true"> <fileset dir="${gluegen.make}/doc/javadoc/resources" includes="*" /> @@ -483,6 +485,7 @@ <link offline="false" href="${gluegen.link}" /> <arg line="-J-Dnativetaglet.mapping=${basedir}/native-taglet.properties"/> <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" /> + <arg value="${javadoc.xarg1}"/> </javadoc> <copy todir="${javadoc.jogl.dev.path}/resources" overwrite="true"> <fileset dir="${gluegen.make}/doc/javadoc/resources" includes="*" /> @@ -509,6 +512,7 @@ <link offline="false" href="${gluegen.link}" /> <arg line="-J-Dnativetaglet.mapping=${basedir}/native-taglet.properties"/> <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" /> + <arg value="${javadoc.xarg1}"/> </javadoc> <copy todir="${javadoc.nw.spec.path}/resources" overwrite="true"> <fileset dir="${gluegen.make}/doc/javadoc/resources" includes="*" /> diff --git a/make/config/jogl/egl-CustomCCode.c b/make/config/jogl/egl-CustomCCode.c index 0163c6742..974bcf9ae 100644 --- a/make/config/jogl/egl-CustomCCode.c +++ b/make/config/jogl/egl-CustomCCode.c @@ -4,10 +4,11 @@ #include <EGL/egl.h> /* Java->C glue code: - * Java package: jogamp.opengl.egl.EGL + * Java package: com.jogamp.opengl.egl.EGL * Java method: void eglGetConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values) */ -Java_jogamp_opengl_egl_EGL_dispatch_1eglGetConfigAttributes(JNIEnv *env, jclass _unused, jlong dpy, jlong config, jint attributeCount, jobject attributes, jint attributes_byte_offset, jobject values, jint values_byte_offset, jlong procAddress) { +JNIEXPORT void JNICALL +Java_com_jogamp_opengl_egl_EGL_dispatch_1eglGetConfigAttributes(JNIEnv *env, jclass _unused, jlong dpy, jlong config, jint attributeCount, jobject attributes, jint attributes_byte_offset, jobject values, jint values_byte_offset, jlong procAddress) { typedef EGLBoolean (EGLAPIENTRY*_local_PFNEGLGETCONFIGATTRIBPROC)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value); _local_PFNEGLGETCONFIGATTRIBPROC ptr_eglGetConfigAttrib = (_local_PFNEGLGETCONFIGATTRIBPROC) (intptr_t) procAddress; assert(ptr_eglGetConfigAttrib != NULL); diff --git a/make/config/jogl/egl-CustomJavaCode.java b/make/config/jogl/egl-CustomJavaCode.java index 15689b5d8..0c3935691 100644 --- a/make/config/jogl/egl-CustomJavaCode.java +++ b/make/config/jogl/egl-CustomJavaCode.java @@ -1,7 +1,8 @@ private static EGLProcAddressTable _table = new EGLProcAddressTable(new GLProcAddressResolver()); - public static void resetProcAddressTable(DynamicLookupHelper lookup) { + protected static boolean resetProcAddressTable(DynamicLookupHelper lookup) { _table.reset(lookup); + return 0 != _table._addressof_eglGetDisplay && 0 != _table._addressof_eglInitialize; } // There are some #defines in egl.h that GlueGen and PCPP don't currently handle @@ -12,15 +13,6 @@ public static final int EGL_DONT_CARE = -1; public static final int EGL_UNKNOWN = -1; - protected static long eglGetProcAddress(long eglGetProcAddressHandle, java.lang.String procname) - { - if (eglGetProcAddressHandle == 0) { - throw new GLException("Passed null pointer for method \"eglGetProcAddress\""); - } - return dispatch_eglGetProcAddress0(procname, eglGetProcAddressHandle); - } - - /** * In case of an error on a particualr attribute, the attribute in the attributes-buffer is set to 0. * <p> diff --git a/make/config/jogl/egl-common.cfg b/make/config/jogl/egl-common.cfg index cf5d0b083..b30abf742 100644 --- a/make/config/jogl/egl-common.cfg +++ b/make/config/jogl/egl-common.cfg @@ -5,8 +5,8 @@ GLHeader EGL/eglext.h # Imports needed by all glue code Import java.util.* -Import javax.media.opengl.* -Import javax.media.opengl.fixedfunc.* +Import com.jogamp.opengl.* +Import com.jogamp.opengl.fixedfunc.* Import jogamp.opengl.* # Treat all of the EGL types as opaque longs @@ -29,7 +29,9 @@ Opaque long __EGLFuncPtr # Implement the first argument to eglGetProcAddress as String instead # of byte[] -ArgumentIsString eglGetProcAddress 0 +#ArgumentIsString eglGetProcAddress 0 +#Implemented in EGLContext +Ignore eglGetProcAddress ReturnsString eglQueryString # Force all of the methods to be emitted using dynamic linking so we diff --git a/make/config/jogl/egl.cfg b/make/config/jogl/egl.cfg index 94b67951d..453987d3e 100644 --- a/make/config/jogl/egl.cfg +++ b/make/config/jogl/egl.cfg @@ -3,7 +3,7 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/egl -Package jogamp.opengl.egl +Package com.jogamp.opengl.egl JavaClass EGL Style AllStatic # Shouldn't matter which one of these we pick up @@ -19,10 +19,13 @@ HierarchicalNativeOutput false EmitProcAddressTable true ProcAddressTableClassName EGLProcAddressTable GetProcAddressTableExpr _table +AccessControl com.jogamp.opengl.egl.EGLProcAddressTable PACKAGE_PRIVATE # Implement the first argument to eglGetProcAddress as String instead # of byte[] -ArgumentIsString eglGetProcAddress 0 +#ArgumentIsString eglGetProcAddress 0 +#Implemented in EGLContext +Ignore eglGetProcAddress ReturnsString eglQueryString IncludeAs CustomJavaCode EGL egl-CustomJavaCode.java diff --git a/make/config/jogl/eglext.cfg b/make/config/jogl/eglext.cfg index 7fccce716..1da9b253d 100644 --- a/make/config/jogl/eglext.cfg +++ b/make/config/jogl/eglext.cfg @@ -3,7 +3,7 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/egl -Package jogamp.opengl.egl +Package com.jogamp.opengl.egl Style InterfaceAndImpl JavaClass EGLExt ImplPackage jogamp.opengl.egl @@ -15,7 +15,7 @@ Include egl-common.cfg NIOOnly __ALL__ NIODirectOnly __ALL__ -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/jogamp/opengl/egl/EGL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/egl/EGL.java IgnoreExtension EGL_VERSION_1_X @@ -24,7 +24,11 @@ HierarchicalNativeOutput false # Use a ProcAddressTable so we dynamically look up the routines EmitProcAddressTable true ProcAddressTableClassName EGLExtProcAddressTable -GetProcAddressTableExpr _context.getEGLExtProcAddressTable() +GetProcAddressTableExpr _table +AccessControl jogamp.opengl.egl.EGLExtProcAddressTable PACKAGE_PRIVATE + +Import com.jogamp.opengl.egl.EGLExt +Import com.jogamp.opengl.egl.EGLClientPixmapHI CustomCCode #include <stdio.h> /* android */ CustomCCode #include <gluegen_stdint.h> @@ -47,8 +51,9 @@ CustomJavaCode EGLExt public static final long EGL_NO_SYNC_KHR = 0; CustomJavaCode EGLExt public boolean isFunctionAvailable(String glFunctionName); CustomJavaCode EGLExt public boolean isExtensionAvailable(String glExtensionName); -CustomJavaCode EGLExtImpl public EGLExtImpl(EGLContext context) { +CustomJavaCode EGLExtImpl public EGLExtImpl(EGLContext context, EGLExtProcAddressTable table) { CustomJavaCode EGLExtImpl this._context = context; +CustomJavaCode EGLExtImpl this._table = table; CustomJavaCode EGLExtImpl } CustomJavaCode EGLExtImpl public boolean isFunctionAvailable(String glFunctionName) @@ -61,5 +66,7 @@ CustomJavaCode EGLExtImpl { CustomJavaCode EGLExtImpl return _context.isExtensionAvailable(glExtensionName); CustomJavaCode EGLExtImpl } -CustomJavaCode EGLExtImpl private EGLContext _context; +CustomJavaCode EGLExtImpl private final EGLContext _context; +CustomJavaCode EGLExtImpl private final EGLExtProcAddressTable _table; +CustomJavaCode EGLExtImpl final EGLExtProcAddressTable getProcAdressTable() { return _table; } diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg index d5c45314e..9101d36c9 100644 --- a/make/config/jogl/gl-common.cfg +++ b/make/config/jogl/gl-common.cfg @@ -23,8 +23,8 @@ GLHeader GL/glext-20130207.h # Imports needed by all glue code Import java.util.* -Import javax.media.opengl.* -Import javax.media.opengl.fixedfunc.* +Import com.jogamp.opengl.* +Import com.jogamp.opengl.fixedfunc.* Import jogamp.opengl.* ##################################################################### diff --git a/make/config/jogl/gl-es1.cfg b/make/config/jogl/gl-es1.cfg index b73b1a731..cc87a879e 100644 --- a/make/config/jogl/gl-es1.cfg +++ b/make/config/jogl/gl-es1.cfg @@ -2,16 +2,16 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/es1 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES1.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLLightingFunc.java # There are a few routines we don't handle yet Ignore glGetBufferPointervOES -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceAndImpl JavaClass GLES1 #Extends GLES1 GLBase @@ -28,7 +28,8 @@ Include gl-common-extensions.cfg EmitProcAddressTable true ProcAddressTableClassName GLES1ProcAddressTable -GetProcAddressTableExpr ((GLES1ProcAddressTable)_context.getGLProcAddressTable()) +GetProcAddressTableExpr _pat +# GetProcAddressTableExpr ((GLES1ProcAddressTable)_context.getGLProcAddressTable()) # Force all of the methods to be emitted using dynamic linking so we # don't need to link against any emulation library on the desktop or @@ -82,8 +83,8 @@ IncludeAs CustomJavaCode GLES1Impl gl-impl-CustomJavaCode-gles1.java IncludeAs CustomJavaCode GLES1Impl gl-impl-CustomJavaCode-embedded.java IncludeAs CustomCCode gl-impl-CustomCCode-gles1.c -Import javax.media.opengl.GLES1 -Import javax.media.opengl.GLES2 -Import javax.media.opengl.GL2 +Import com.jogamp.opengl.GLES1 +Import com.jogamp.opengl.GLES2 +Import com.jogamp.opengl.GL2 Import com.jogamp.common.nio.Buffers Import com.jogamp.opengl.util.GLBuffers diff --git a/make/config/jogl/gl-es3-impl.cfg b/make/config/jogl/gl-es3-impl.cfg index 9682e49af..22acdbdeb 100644 --- a/make/config/jogl/gl-es3-impl.cfg +++ b/make/config/jogl/gl-es3-impl.cfg @@ -2,14 +2,14 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/es3 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GLES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL4ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GLES3.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GLES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL4ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GLES3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java Style ImplOnly ImplPackage jogamp.opengl.es3 @@ -32,7 +32,8 @@ ForceExtension GL_ARB_ES3_compatibility EmitProcAddressTable true ProcAddressTableClassName GLES3ProcAddressTable -GetProcAddressTableExpr ((GLES3ProcAddressTable)_context.getGLProcAddressTable()) +GetProcAddressTableExpr _pat +# GetProcAddressTableExpr ((GLES3ProcAddressTable)_context.getGLProcAddressTable()) # Force all of the methods to be emitted using dynamic linking so we # don't need to link against any emulation library on the desktop or @@ -72,15 +73,15 @@ IncludeAs CustomJavaCode GLES3Impl gl-impl-CustomJavaCode-embedded.java IncludeAs CustomJavaCode GLES3Impl gl-impl-CustomJavaCode-gl2_es2.java IncludeAs CustomCCode gl-impl-CustomCCode-gles3.c -Import javax.media.opengl.GLBase -Import javax.media.opengl.GL -Import javax.media.opengl.GL2ES2 -Import javax.media.opengl.GL2ES3 -Import javax.media.opengl.GL3ES3 -Import javax.media.opengl.GL4ES3 -Import javax.media.opengl.GLES3 -Import javax.media.opengl.GLArrayData -Import javax.media.opengl.GLUniformData +Import com.jogamp.opengl.GLBase +Import com.jogamp.opengl.GL +Import com.jogamp.opengl.GL2ES2 +Import com.jogamp.opengl.GL2ES3 +Import com.jogamp.opengl.GL3ES3 +Import com.jogamp.opengl.GL4ES3 +Import com.jogamp.opengl.GLES3 +Import com.jogamp.opengl.GLArrayData +Import com.jogamp.opengl.GLUniformData Import com.jogamp.common.nio.Buffers Import com.jogamp.opengl.util.GLBuffers Import java.io.PrintStream diff --git a/make/config/jogl/gl-gl4bc.cfg b/make/config/jogl/gl-gl4bc.cfg index 6ccbace44..668fc3427 100644 --- a/make/config/jogl/gl-gl4bc.cfg +++ b/make/config/jogl/gl-gl4bc.cfg @@ -2,23 +2,23 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/gl4 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL4ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL4.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3bc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java - -Package javax.media.opengl +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES1.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL4ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL4.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3bc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLLightingFunc.java + +Package com.jogamp.opengl Style InterfaceAndImpl JavaClass GL4bc #Extends GL4bc GLBase @@ -116,7 +116,8 @@ LocalProcAddressCallingConvention __ALL__ APIENTRY EmitProcAddressTable true ProcAddressTableClassName GL4bcProcAddressTable -GetProcAddressTableExpr ((GL4bcProcAddressTable)_context.getGLProcAddressTable()) +GetProcAddressTableExpr _pat +# GetProcAddressTableExpr ((GL4bcProcAddressTable)_context.getGLProcAddressTable()) # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true @@ -162,18 +163,18 @@ IncludeAs CustomJavaCode GL4bcImpl gl-impl-CustomJavaCode-gl2_es2.java IncludeAs CustomCCode gl-impl-CustomCCode-gl4bc.c -Import javax.media.opengl.GLES1 -Import javax.media.opengl.GLES2 -Import javax.media.opengl.GL2ES1 -Import javax.media.opengl.GL2ES2 -Import javax.media.opengl.GL2ES3 -Import javax.media.opengl.GL3ES3 -Import javax.media.opengl.GL4ES3 -Import javax.media.opengl.GL2GL3 -Import javax.media.opengl.GL2 -Import javax.media.opengl.GL3 -Import javax.media.opengl.GL3bc -Import javax.media.opengl.GL4 +Import com.jogamp.opengl.GLES1 +Import com.jogamp.opengl.GLES2 +Import com.jogamp.opengl.GL2ES1 +Import com.jogamp.opengl.GL2ES2 +Import com.jogamp.opengl.GL2ES3 +Import com.jogamp.opengl.GL3ES3 +Import com.jogamp.opengl.GL4ES3 +Import com.jogamp.opengl.GL2GL3 +Import com.jogamp.opengl.GL2 +Import com.jogamp.opengl.GL3 +Import com.jogamp.opengl.GL3bc +Import com.jogamp.opengl.GL4 Import com.jogamp.common.nio.Buffers Import com.jogamp.opengl.util.GLBuffers Import java.io.PrintStream diff --git a/make/config/jogl/gl-if-es2.cfg b/make/config/jogl/gl-if-es2.cfg index 052722f40..23e392e9f 100644 --- a/make/config/jogl/gl-if-es2.cfg +++ b/make/config/jogl/gl-if-es2.cfg @@ -2,11 +2,11 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/es2 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GLES2 #Extends GLES2 GLBase diff --git a/make/config/jogl/gl-if-es3.cfg b/make/config/jogl/gl-if-es3.cfg index 66fd52597..80273e4cf 100644 --- a/make/config/jogl/gl-if-es3.cfg +++ b/make/config/jogl/gl-if-es3.cfg @@ -1,15 +1,15 @@ # This .cfg file is used to generate the GL interface. JavaOutputDir gensrc/classes -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GLES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL4ES3.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GLES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL4ES3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GLES3 #Extends GLES3 GLBase diff --git a/make/config/jogl/gl-if-gl.cfg b/make/config/jogl/gl-if-gl.cfg index 5c9e4caa2..d552e5a31 100644 --- a/make/config/jogl/gl-if-gl.cfg +++ b/make/config/jogl/gl-if-gl.cfg @@ -1,10 +1,10 @@ # This .cfg file is used to generate the GL interface and implementing class. -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL Extends GL GLBase -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java HierarchicalNativeOutput false Include gl-common.cfg diff --git a/make/config/jogl/gl-if-gl2.cfg b/make/config/jogl/gl-if-gl2.cfg index 0120bd674..85c7cbe15 100644 --- a/make/config/jogl/gl-if-gl2.cfg +++ b/make/config/jogl/gl-if-gl2.cfg @@ -2,17 +2,17 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/gl2 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java - -Package javax.media.opengl +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES1.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLLightingFunc.java + +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL2 #Extends GL2 GLBase diff --git a/make/config/jogl/gl-if-gl2_es1.cfg b/make/config/jogl/gl-if-gl2_es1.cfg index b533e83c3..1d517b731 100644 --- a/make/config/jogl/gl-if-gl2_es1.cfg +++ b/make/config/jogl/gl-if-gl2_es1.cfg @@ -1,5 +1,5 @@ # This .cfg file is used to generate the GL interface and implementing class. -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL2ES1 #Extends GL2ES1 GLBase @@ -8,11 +8,11 @@ Extends GL2ES1 GLMatrixFunc Extends GL2ES1 GLPointerFunc Extends GL2ES1 GLLightingFunc -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLLightingFunc.java HierarchicalNativeOutput false Include gl-common.cfg diff --git a/make/config/jogl/gl-if-gl2_es2.cfg b/make/config/jogl/gl-if-gl2_es2.cfg index db5489d06..3c4dbbb64 100644 --- a/make/config/jogl/gl-if-gl2_es2.cfg +++ b/make/config/jogl/gl-if-gl2_es2.cfg @@ -2,10 +2,10 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL2ES2 #Extends GL2ES2 GLBase diff --git a/make/config/jogl/gl-if-gl2_es3.cfg b/make/config/jogl/gl-if-gl2_es3.cfg index 112bc5434..2390652c4 100644 --- a/make/config/jogl/gl-if-gl2_es3.cfg +++ b/make/config/jogl/gl-if-gl2_es3.cfg @@ -2,18 +2,18 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL2ES3 #Extends GL2ES3 GLBase #Extends GL2ES3 GL Extends GL2ES3 GL2ES2 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java -ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL2ES3Subset.java +ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/com/jogamp/opengl/GL2ES3Subset.java HierarchicalNativeOutput false Include gl-common.cfg diff --git a/make/config/jogl/gl-if-gl2_gl3.cfg b/make/config/jogl/gl-if-gl2_gl3.cfg index 532a670e6..8e88a116e 100644 --- a/make/config/jogl/gl-if-gl2_gl3.cfg +++ b/make/config/jogl/gl-if-gl2_gl3.cfg @@ -1,5 +1,5 @@ # This .cfg file is used to generate the GL interface and implementing class. -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL2GL3 #Extends GL2GL3 GLBase @@ -7,12 +7,12 @@ JavaClass GL2GL3 #Extends GL2GL3 GL2ES2 Extends GL2GL3 GL2ES3 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java -ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL2GL3Subset.java +ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/com/jogamp/opengl/GL2GL3Subset.java HierarchicalNativeOutput false Include gl-common.cfg diff --git a/make/config/jogl/gl-if-gl2es3-subset.cfg b/make/config/jogl/gl-if-gl2es3-subset.cfg index 3e325e065..a7ecdce8d 100644 --- a/make/config/jogl/gl-if-gl2es3-subset.cfg +++ b/make/config/jogl/gl-if-gl2es3-subset.cfg @@ -1,7 +1,7 @@ # This .cfg file is used to generate the common GL2 ES3 set JavaOutputDir ../../build-temp/gluegen-set -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL2ES3Subset Include gl-common.cfg diff --git a/make/config/jogl/gl-if-gl2gl3-subset.cfg b/make/config/jogl/gl-if-gl2gl3-subset.cfg index ecb384ca3..1fae977e5 100644 --- a/make/config/jogl/gl-if-gl2gl3-subset.cfg +++ b/make/config/jogl/gl-if-gl2gl3-subset.cfg @@ -1,7 +1,7 @@ # This .cfg file is used to generate the common GL2 GL3 set JavaOutputDir ../../build-temp/gluegen-set -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL2GL3Subset Include gl-common.cfg diff --git a/make/config/jogl/gl-if-gl3.cfg b/make/config/jogl/gl-if-gl3.cfg index d472fbc29..3dbf86918 100644 --- a/make/config/jogl/gl-if-gl3.cfg +++ b/make/config/jogl/gl-if-gl3.cfg @@ -2,14 +2,14 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/gl3 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL3 #Extends GL3 GLBase diff --git a/make/config/jogl/gl-if-gl3_es3.cfg b/make/config/jogl/gl-if-gl3_es3.cfg index a25d9112a..16e194b80 100644 --- a/make/config/jogl/gl-if-gl3_es3.cfg +++ b/make/config/jogl/gl-if-gl3_es3.cfg @@ -2,7 +2,7 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL3ES3 #Extends GL3ES3 GLBase @@ -10,10 +10,10 @@ JavaClass GL3ES3 #Extends GL3ES3 GL2ES2 Extends GL3ES3 GL2ES3 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java HierarchicalNativeOutput false Include gl-common.cfg diff --git a/make/config/jogl/gl-if-gl3bc.cfg b/make/config/jogl/gl-if-gl3bc.cfg index 5172c726c..7a1a1c7b3 100644 --- a/make/config/jogl/gl-if-gl3bc.cfg +++ b/make/config/jogl/gl-if-gl3bc.cfg @@ -2,20 +2,20 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/gl3 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java - -Package javax.media.opengl +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES1.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/fixedfunc/GLLightingFunc.java + +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL3bc #Extends GL3bc GLBase diff --git a/make/config/jogl/gl-if-gl4.cfg b/make/config/jogl/gl-if-gl4.cfg index 144c10ad2..07645ac26 100644 --- a/make/config/jogl/gl-if-gl4.cfg +++ b/make/config/jogl/gl-if-gl4.cfg @@ -2,16 +2,16 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/gl4 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL4ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL4ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL4 #Extends GL4 GLBase diff --git a/make/config/jogl/gl-if-gl4_es3.cfg b/make/config/jogl/gl-if-gl4_es3.cfg index 6233d530a..556be2b88 100644 --- a/make/config/jogl/gl-if-gl4_es3.cfg +++ b/make/config/jogl/gl-if-gl4_es3.cfg @@ -2,7 +2,7 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl -Package javax.media.opengl +Package com.jogamp.opengl Style InterfaceOnly JavaClass GL4ES3 #Extends GL4ES3 GLBase @@ -11,12 +11,12 @@ JavaClass GL4ES3 #Extends GL4ES3 GL2ES3 Extends GL4ES3 GL3ES3 -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java -ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/com/jogamp/opengl/GLBase.java HierarchicalNativeOutput false Include gl-common.cfg diff --git a/make/config/jogl/gl-impl-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java index a2ca12960..503c125f0 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-common.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java @@ -1,8 +1,10 @@ + private final GLProfile glProfile; + private final GLContextImpl _context; + @Override public GLProfile getGLProfile() { return this.glProfile; } - private final GLProfile glProfile; @Override public final int getBoundBuffer(int target) { @@ -85,10 +87,8 @@ return _context; } - private final GLContextImpl _context; - /** - * @see javax.media.opengl.GLContext#setSwapInterval(int) + * @see com.jogamp.opengl.GLContext#setSwapInterval(int) */ @Override public final void setSwapInterval(int interval) { @@ -96,7 +96,7 @@ } /** - * @see javax.media.opengl.GLContext#getSwapInterval() + * @see com.jogamp.opengl.GLContext#getSwapInterval() */ @Override public final int getSwapInterval() { diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java index a8b5f8320..8ec1b3205 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java @@ -1,3 +1,5 @@ +private final GL4bcProcAddressTable _pat; + // Tracks glBegin/glEnd calls to determine whether it is legal to // query Vertex Buffer Object state private boolean inBeginEndPair; @@ -17,35 +19,21 @@ public void setObjectTracker(GLObjectTracker tracker) { public GL4bcImpl(GLProfile glp, GLContextImpl context) { this._context = context; - if(null != context) { - this.bufferObjectTracker = context.getBufferObjectTracker(); - this.bufferStateTracker = context.getBufferStateTracker(); - this.glStateTracker = context.getGLStateTracker(); - } else { - this.bufferObjectTracker = null; - this.bufferStateTracker = null; - this.glStateTracker = null; - } + this._pat = (GL4bcProcAddressTable)_context.getGLProcAddressTable(); + this.bufferObjectTracker = context.getBufferObjectTracker(); + this.bufferStateTracker = context.getBufferStateTracker(); + this.glStateTracker = context.getGLStateTracker(); this.glProfile = glp; } public final void finalizeInit() { - if(null != _context) { - haveARBPixelBufferObject = isExtensionAvailable("GL_ARB_pixel_buffer_object"); - haveEXTPixelBufferObject = isExtensionAvailable("GL_EXT_pixel_buffer_object"); - haveGL15 = isExtensionAvailable("GL_VERSION_1_5"); - haveGL21 = isExtensionAvailable("GL_VERSION_2_1"); - haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object"); - haveARBVertexArrayObject = _context.getGLVersionNumber().compareTo(GLContext.Version300) >= 0 || - isExtensionAvailable("GL_ARB_vertex_array_object"); - } else { - haveARBPixelBufferObject = false; - haveEXTPixelBufferObject = false; - haveGL15 = false; - haveGL21 = false; - haveARBVertexBufferObject = false; - haveARBVertexArrayObject = false; - } + haveARBPixelBufferObject = isExtensionAvailable("GL_ARB_pixel_buffer_object"); + haveEXTPixelBufferObject = isExtensionAvailable("GL_EXT_pixel_buffer_object"); + haveGL15 = isExtensionAvailable("GL_VERSION_1_5"); + haveGL21 = isExtensionAvailable("GL_VERSION_2_1"); + haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object"); + haveARBVertexArrayObject = _context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 || + isExtensionAvailable("GL_ARB_vertex_array_object"); } private int[] imageSizeTemp = new int[1]; @@ -482,7 +470,7 @@ public final void glTexCoordPointer(GLArrayData array) { @Override public final void glBufferData(int target, long size, Buffer data, int usage) { - final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferData; + final long glProcAddress = _pat._addressof_glBufferData; if ( 0 == glProcAddress ) { throw new GLException(String.format("Method \"%s\" not available", "glBufferData")); } @@ -493,7 +481,7 @@ public final void glBufferData(int target, long size, Buffer data, int usage) { /** FIXME Add for OpenGL 4.4 @Override public final void glBufferStorage(int target, long size, Buffer data, int flags) { - final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferStorage; + final long glProcAddress = _pat._addressof_glBufferStorage; if ( 0 == glProcAddress ) { throw new GLException(String.format("Method \"%s\" not available", "glBufferStorage")); } @@ -516,7 +504,7 @@ private native void dispatch_glBufferStorage(int target, long size, Object data, @Override public final void glNamedBufferDataEXT(int buffer, long size, Buffer data, int usage) { - final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glNamedBufferDataEXT; + final long glProcAddress = _pat._addressof_glNamedBufferDataEXT; if ( 0 == glProcAddress ) { throw new GLException(String.format("Method \"%s\" not available", "glNamedBufferDataEXT")); } @@ -538,7 +526,7 @@ private native void dispatch_glNamedBufferDataEXT(int buffer, long size, Object @Override public boolean glUnmapBuffer(int target) { - final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapBuffer; + final long glProcAddress = _pat._addressof_glUnmapBuffer; if ( 0 == glProcAddress ) { throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer")); } @@ -547,7 +535,7 @@ public boolean glUnmapBuffer(int target) { @Override public boolean glUnmapNamedBufferEXT(int buffer) { - final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapNamedBufferEXT; + final long glProcAddress = _pat._addressof_glUnmapNamedBufferEXT; if ( 0 == glProcAddress ) { throw new GLException(String.format("Method \"%s\" not available", "glUnmapNamedBufferEXT")); } @@ -563,7 +551,7 @@ private native boolean dispatch_glUnmapNamedBufferEXT(int buffer, long procAddre @Override public final GLBufferStorage mapBuffer(final int target, final int access) { - final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; + final long glProcAddress = _pat._addressof_glMapBuffer; if ( 0 == glProcAddress ) { throw new GLException("Method \"glMapBuffer\" not available"); } @@ -571,7 +559,7 @@ public final GLBufferStorage mapBuffer(final int target, final int access) { } @Override public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) { - final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferRange; + final long glProcAddress = _pat._addressof_glMapBufferRange; if ( 0 == glProcAddress ) { throw new GLException("Method \"glMapBufferRange\" not available"); } @@ -580,7 +568,7 @@ public final GLBufferStorage mapBufferRange(final int target, final long offset, @Override public final GLBufferStorage mapNamedBuffer(final int bufferName, final int access) { - final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapNamedBufferEXT; + final long glProcAddress = _pat._addressof_glMapNamedBufferEXT; if ( 0 == glProcAddress ) { throw new GLException("Method \"glMapNamedBufferEXT\" not available"); } @@ -597,7 +585,7 @@ private native long dispatch_glMapNamedBufferEXT(int buffer, int access, long gl @Override public final GLBufferStorage mapNamedBufferRange(final int bufferName, final long offset, final long length, final int access) { - final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapNamedBufferRangeEXT; + final long glProcAddress = _pat._addressof_glMapNamedBufferRangeEXT; if ( 0 == glProcAddress ) { throw new GLException("Method \"glMapNamedBufferRangeEXT\" not available"); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index 6a7e12ca1..636f20d60 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -1,14 +1,11 @@ +private final GLES1ProcAddressTable _pat; + public GLES1Impl(GLProfile glp, GLContextImpl context) { this._context = context; - if(null != context) { - this.bufferObjectTracker = context.getBufferObjectTracker(); - this.bufferStateTracker = context.getBufferStateTracker(); - this.glStateTracker = context.getGLStateTracker(); - } else { - this.bufferObjectTracker = null; - this.bufferStateTracker = null; - this.glStateTracker = null; - } + this._pat = (GLES1ProcAddressTable)_context.getGLProcAddressTable(); + this.bufferObjectTracker = context.getBufferObjectTracker(); + this.bufferStateTracker = context.getBufferStateTracker(); + this.glStateTracker = context.getGLStateTracker(); this.glProfile = glp; } @@ -312,7 +309,7 @@ public final void glTexCoordPointer(GLArrayData array) { @Override public final void glBufferData(int target, long size, Buffer data, int usage) { - final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferData; + final long glProcAddress = _pat._addressof_glBufferData; if ( 0 == glProcAddress ) { throw new GLException(String.format("Method \"%s\" not available", "glBufferData")); } @@ -323,7 +320,7 @@ public final void glBufferData(int target, long size, Buffer data, int usage) { @Override public boolean glUnmapBuffer(int target) { - final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapBuffer; + final long glProcAddress = _pat._addressof_glUnmapBuffer; if ( 0 == glProcAddress ) { throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer")); } @@ -332,7 +329,7 @@ public boolean glUnmapBuffer(int target) { @Override public final GLBufferStorage mapBuffer(final int target, final int access) { - final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; + final long glProcAddress = _pat._addressof_glMapBuffer; if ( 0 == glProcAddress ) { throw new GLException("Method \"glMapBuffer\" not available"); } @@ -340,7 +337,7 @@ public final GLBufferStorage mapBuffer(final int target, final int access) { } @Override public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) { - final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferRange; + final long glProcAddress = _pat._addressof_glMapBufferRange; if ( 0 == glProcAddress ) { throw new GLException("Method \"glMapBufferRange\" not available"); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java index 42adca4b1..a0e3c6570 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java @@ -1,15 +1,11 @@ +private final GLES3ProcAddressTable _pat; public GLES3Impl(GLProfile glp, GLContextImpl context) { this._context = context; - if(null != context) { - this.bufferObjectTracker = context.getBufferObjectTracker(); - this.bufferStateTracker = context.getBufferStateTracker(); - this.glStateTracker = context.getGLStateTracker(); - } else { - this.bufferObjectTracker = null; - this.bufferStateTracker = null; - this.glStateTracker = null; - } + this._pat = (GLES3ProcAddressTable)_context.getGLProcAddressTable(); + this.bufferObjectTracker = context.getBufferObjectTracker(); + this.bufferStateTracker = context.getBufferStateTracker(); + this.glStateTracker = context.getGLStateTracker(); this.glProfile = glp; this._isES3 = glp.getImplName() == GLProfile.GLES3; } @@ -354,7 +350,7 @@ public final void glDepthRange(double zNear, double zFar) { @Override public final void glBufferData(int target, long size, Buffer data, int usage) { - final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferData; + final long glProcAddress = _pat._addressof_glBufferData; if ( 0 == glProcAddress ) { throw new GLException(String.format("Method \"%s\" not available", "glBufferData")); } @@ -365,7 +361,7 @@ public final void glBufferData(int target, long size, Buffer data, int usage) { @Override public boolean glUnmapBuffer(int target) { - final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapBuffer; + final long glProcAddress = _pat._addressof_glUnmapBuffer; if ( 0 == glProcAddress ) { throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer")); } @@ -374,7 +370,7 @@ public boolean glUnmapBuffer(int target) { @Override public final GLBufferStorage mapBuffer(final int target, final int access) { - final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; + final long glProcAddress = _pat._addressof_glMapBuffer; if ( 0 == glProcAddress ) { throw new GLException("Method \"glMapBuffer\" not available"); } @@ -382,7 +378,7 @@ public final GLBufferStorage mapBuffer(final int target, final int access) { } @Override public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) { - final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferRange; + final long glProcAddress = _pat._addressof_glMapBufferRange; if ( 0 == glProcAddress ) { throw new GLException("Method \"glMapBufferRange\" not available"); } diff --git a/make/config/jogl/glu-CustomJavaCode-base.java b/make/config/jogl/glu-CustomJavaCode-base.java index e8047d9d7..c6b892bf6 100644 --- a/make/config/jogl/glu-CustomJavaCode-base.java +++ b/make/config/jogl/glu-CustomJavaCode-base.java @@ -84,8 +84,8 @@ static { Class _gl2es1Class=null; try { final ClassLoader cl = GLU.class.getClassLoader(); - _gl2Class = Class.forName("javax.media.opengl.glu.gl2.GLUgl2", false, cl); - _gl2es1Class = Class.forName("javax.media.opengl.glu.gl2es1.GLUgl2es1", false, cl); + _gl2Class = Class.forName("com.jogamp.opengl.glu.gl2.GLUgl2", false, cl); + _gl2es1Class = Class.forName("com.jogamp.opengl.glu.gl2es1.GLUgl2es1", false, cl); } catch (Throwable t) {} gl2Class = _gl2Class; gl2es1Class = _gl2es1Class; @@ -389,7 +389,7 @@ public static final void gluTessNormal(GLUtessellator tessellator, double x, dou * * <b>GLU_TESS_BEGIN</b> * <UL> - * The begin callback is invoked like {@link javax.media.opengl.GL#glBegin + * The begin callback is invoked like {@link com.jogamp.opengl.GL#glBegin * glBegin} to indicate the start of a (triangle) primitive. The method * takes a single argument of type int. If the * <b>GLU_TESS_BOUNDARY_ONLY</b> property is set to <b>GL_FALSE</b>, then @@ -418,7 +418,7 @@ public static final void gluTessNormal(GLUtessellator tessellator, double x, dou * <b>GLU_TESS_EDGE_FLAG</b> * <UL> * The edge flag callback is similar to - * {@link javax.media.opengl.GL#glEdgeFlag glEdgeFlag}. The method takes + * {@link com.jogamp.opengl.GL#glEdgeFlag glEdgeFlag}. The method takes * a single boolean boundaryEdge that indicates which edges lie on the * polygon boundary. If the boundaryEdge is <b>GL_TRUE</b>, then each vertex * that follows begins an edge that lies on the polygon boundary, that is, @@ -453,7 +453,7 @@ public static final void gluTessNormal(GLUtessellator tessellator, double x, dou * <b>GLU_TESS_VERTEX</b> * <UL> * The vertex callback is invoked between the begin and end callbacks. It is - * similar to {@link javax.media.opengl.GL#glVertex3f glVertex3f}, and it + * similar to {@link com.jogamp.opengl.GL#glVertex3f glVertex3f}, and it * defines the vertices of the triangles created by the tessellation * process. The method takes a reference as its only argument. This * reference is identical to the opaque reference provided by the user when @@ -480,7 +480,7 @@ public static final void gluTessNormal(GLUtessellator tessellator, double x, dou * <b>GLU_TESS_END</b> * <UL> * The end callback serves the same purpose as - * {@link javax.media.opengl.GL#glEnd glEnd}. It indicates the end of a + * {@link com.jogamp.opengl.GL#glEnd glEnd}. It indicates the end of a * primitive and it takes no arguments. The method prototype for this * callback is: * </UL> @@ -638,9 +638,9 @@ public static final void gluTessNormal(GLUtessellator tessellator, double x, dou * @param aCallback * Specifies the callback object to be called. * - * @see javax.media.opengl.GL#glBegin glBegin - * @see javax.media.opengl.GL#glEdgeFlag glEdgeFlag - * @see javax.media.opengl.GL#glVertex3f glVertex3f + * @see com.jogamp.opengl.GL#glBegin glBegin + * @see com.jogamp.opengl.GL#glEdgeFlag glEdgeFlag + * @see com.jogamp.opengl.GL#glVertex3f glVertex3f * @see #gluNewTess gluNewTess * @see #gluErrorString gluErrorString * @see #gluTessVertex gluTessVertex diff --git a/make/config/jogl/glu-base.cfg b/make/config/jogl/glu-base.cfg index 05aa2110e..542f8afef 100644 --- a/make/config/jogl/glu-base.cfg +++ b/make/config/jogl/glu-base.cfg @@ -4,7 +4,7 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl Style ImplOnly -ImplPackage javax.media.opengl.glu +ImplPackage com.jogamp.opengl.glu ImplJavaClass GLU AccessControl GLU PUBLIC diff --git a/make/config/jogl/glu-common.cfg b/make/config/jogl/glu-common.cfg index 85d556b77..45535d21d 100644 --- a/make/config/jogl/glu-common.cfg +++ b/make/config/jogl/glu-common.cfg @@ -9,8 +9,8 @@ TagNativeBinding true # # Imports needed by all glue code # -Import javax.media.opengl.* -Import javax.media.opengl.glu.* +Import com.jogamp.opengl.* +Import com.jogamp.opengl.glu.* import com.jogamp.opengl.util.glsl.ShaderState Import jogamp.opengl.* Import jogamp.opengl.glu.* diff --git a/make/config/jogl/glu-gl2.cfg b/make/config/jogl/glu-gl2.cfg index 696e07050..c3a10a900 100644 --- a/make/config/jogl/glu-gl2.cfg +++ b/make/config/jogl/glu-gl2.cfg @@ -4,7 +4,7 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/gl2 Style ImplOnly -ImplPackage javax.media.opengl.glu.gl2 +ImplPackage com.jogamp.opengl.glu.gl2 ImplJavaClass GLUgl2 ParentClass GLUgl2 GLU @@ -24,10 +24,10 @@ CustomCCode #include <inttypes.h> CustomCCode #endif EmitProcAddressTable true -ProcAddressTablePackage javax.media.opengl.glu.gl2 +ProcAddressTablePackage com.jogamp.opengl.glu.gl2 ProcAddressTableClassName GLUgl2ProcAddressTable GetProcAddressTableExpr getGLUProcAddressTable() -AccessControl javax.media.opengl.glu.gl2.GLUgl2ProcAddressTable PACKAGE_PRIVATE +AccessControl com.jogamp.opengl.glu.gl2.GLUgl2ProcAddressTable PACKAGE_PRIVATE CustomCCode /* Include the OpenGL GLU header */ CustomCCode #include <GL/glu.h> @@ -45,7 +45,7 @@ Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver Import jogamp.opengl.glu.gl2.nurbs.* Import jogamp.opengl.glu.mipmap.Mipmap Import jogamp.opengl.glu.gl2.* -Import javax.media.opengl.GL2 +Import com.jogamp.opengl.GL2 Import jogamp.opengl.gl2.ProjectDouble # diff --git a/make/config/jogl/glu-gl2es1.cfg b/make/config/jogl/glu-gl2es1.cfg index ef9405fac..98217da1f 100644 --- a/make/config/jogl/glu-gl2es1.cfg +++ b/make/config/jogl/glu-gl2es1.cfg @@ -4,7 +4,7 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/gl2es1 Style ImplOnly -ImplPackage javax.media.opengl.glu.gl2es1 +ImplPackage com.jogamp.opengl.glu.gl2es1 ImplJavaClass GLUgl2es1 ParentClass GLUgl2es1 GLU @@ -20,7 +20,7 @@ Ignore gluScaleImage IncludeAs CustomJavaCode GLUgl2es1 glu-CustomJavaCode-gl2es1.java ManualStaticInitCall GLUgl2es1 -Import javax.media.opengl.GLES1 +Import com.jogamp.opengl.GLES1 Import jogamp.opengl.glu.mipmap.Mipmap diff --git a/make/config/jogl/glx-x11.cfg b/make/config/jogl/glx-x11.cfg index 6a5bdc484..38f56c26a 100644 --- a/make/config/jogl/glx-x11.cfg +++ b/make/config/jogl/glx-x11.cfg @@ -96,7 +96,7 @@ Ignore GLXHyperpipeConfigSGIX Ignore GLXPipeRect Ignore GLXPipeRectLimits -CustomJavaCode GLX protected static long glXGetProcAddress(long glXGetProcAddressHandle, java.lang.String procname) +CustomJavaCode GLX static long glXGetProcAddress(long glXGetProcAddressHandle, java.lang.String procname) CustomJavaCode GLX { CustomJavaCode GLX if (glXGetProcAddressHandle == 0) { CustomJavaCode GLX throw new GLException("Passed null pointer for method \"glXGetProcAddress\""); diff --git a/make/config/jogl/wgl-win32.cfg b/make/config/jogl/wgl-win32.cfg index d9dbb13e6..435cab0a0 100644 --- a/make/config/jogl/wgl-win32.cfg +++ b/make/config/jogl/wgl-win32.cfg @@ -62,7 +62,7 @@ DropUniqVendorExtensions SGIX DropUniqVendorExtensions SUN DropUniqVendorExtensions WIN -CustomJavaCode WGL protected static long wglGetProcAddress(long wglGetProcAddressHandle, java.lang.String procname) +CustomJavaCode WGL static long wglGetProcAddress(long wglGetProcAddressHandle, java.lang.String procname) CustomJavaCode WGL { CustomJavaCode WGL if (wglGetProcAddressHandle == 0) { CustomJavaCode WGL throw new GLException("Passed null pointer for method \"wglGetProcAddress\""); diff --git a/make/config/nativewindow/win32-lib.cfg b/make/config/nativewindow/win32-lib.cfg index 26c744a80..9c60348d2 100644 --- a/make/config/nativewindow/win32-lib.cfg +++ b/make/config/nativewindow/win32-lib.cfg @@ -22,8 +22,8 @@ Opaque long HPBUFFERARB Opaque long HPBUFFEREXT Opaque long void ** -Import javax.media.nativewindow.util.Point -Import javax.media.nativewindow.NativeWindowException +Import com.jogamp.nativewindow.util.Point +Import com.jogamp.nativewindow.NativeWindowException Import jogamp.nativewindow.NWJNILibLoader import jogamp.nativewindow.Debug diff --git a/make/config/nativewindow/x11-lib.cfg b/make/config/nativewindow/x11-lib.cfg index ed8c13b54..8104b4697 100644 --- a/make/config/nativewindow/x11-lib.cfg +++ b/make/config/nativewindow/x11-lib.cfg @@ -12,7 +12,7 @@ NativeOutputDir gensrc/native/X11 # Imports needed by all glue code Import java.nio.* Import java.util.* -Import javax.media.nativewindow.util.Point +Import com.jogamp.nativewindow.util.Point # XID needs to be treated as a long for 32/64 bit compatibility Opaque long XID diff --git a/make/doc/jogl/spec-overview.html b/make/doc/jogl/spec-overview.html index 1a63fb7dd..a2c37e976 100644 --- a/make/doc/jogl/spec-overview.html +++ b/make/doc/jogl/spec-overview.html @@ -42,7 +42,7 @@ bindings to the native OpenGL(R) 3D graphics library profiles: <li> <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/nio/package-summary.html"> Java 1.4 <i>java.nio</i> implementation</a> </li> </ul></li> </ul></li> - <li> {@linkplain javax.media.nativewindow NativeWindow Protocol} + <li> {@linkplain com.jogamp.nativewindow NativeWindow Protocol} <p>The <i>NativeWindow Protocol</i> is included in JogAmp's implementation</p></li> </ul> <br> @@ -57,13 +57,13 @@ bindings to the native OpenGL(R) 3D graphics library profiles: The packages defined by this specification include:<br> <ul> - <li>The <b>javax.media.opengl</b> package<br> + <li>The <b>com.jogamp.opengl</b> package<br> <p>This package contains all Java bindings for all OpenGL profiles.</p> <p>See <a href="#GLAPIInclusionCriteria">Inclusion Criteria</a> explaining the OpenGL profile seperation.</p> <p>See <a href="#GLRuntimeVersion">OpenGL Runtime Requirements</a>.</p> <p>The main OpenGL profile interfaces are:</p> <ul> - <li> {@link javax.media.opengl.GL2 javax.media.opengl.GL2} interface + <li> {@link com.jogamp.opengl.GL2 com.jogamp.opengl.GL2} interface <p>This interface contains all OpenGL [ 1.0 .. 3.0 ] methods, as well as most of it's extensions defined at the time of this specification.</p> <p>OpenGL extensions whose functionality was incorporated into core OpenGL ≤ 3.0, @@ -73,7 +73,7 @@ bindings to the native OpenGL(R) 3D graphics library profiles: <p>Future extensions will be added with a <a href="#maintenanceupdates">maintenance update</a></p> </li> - <li> {@link javax.media.opengl.GL3 javax.media.opengl.GL3} interface + <li> {@link com.jogamp.opengl.GL3 com.jogamp.opengl.GL3} interface <p>This interface contains all OpenGL [ 3.1 .. 3.3 ] <i>core</i> methods, as well as most of it's extensions defined at the time of this specification.</p> <p>Note: OpenGL [ 3.1 .. 3.3 ] core profile does not includes fixed point functionality.</p> @@ -82,40 +82,40 @@ bindings to the native OpenGL(R) 3D graphics library profiles: <p>Future extensions will be added with a <a href="#maintenanceupdates">maintenance update</a></p> </li> - <li> {@link javax.media.opengl.GL3bc javax.media.opengl.GL3bc} interface + <li> {@link com.jogamp.opengl.GL3bc com.jogamp.opengl.GL3bc} interface <p>This interface contains all OpenGL [ 3.1 .. 3.3 ] <i>compatibility</i> methods, as well as most of it's extensions defined at the time of this specification.</p> <p>Note: OpenGL [ 3.1 .. 3.3 ] compatibility profile does includes fixed point functionality.</p> <p>Future extensions will be added with a <a href="#maintenanceupdates">maintenance update</a></p> </li> - <li> {@link javax.media.opengl.GL4 javax.media.opengl.GL4} interface + <li> {@link com.jogamp.opengl.GL4 com.jogamp.opengl.GL4} interface <p>This interface contains all OpenGL [ 4.0 .. 4.3 ] <i>core</i> methods, as well as most of it's extensions defined at the time of this specification.</p> <p>Note: OpenGL [ 4.0 .. 4.3 ] core profile does not includes fixed point functionality.</p> <p>Future extensions will be added with a <a href="#maintenanceupdates">maintenance update</a></p> </li> - <li> {@link javax.media.opengl.GL4bc javax.media.opengl.GL4bc} interface + <li> {@link com.jogamp.opengl.GL4bc com.jogamp.opengl.GL4bc} interface <p>This interface contains all OpenGL [ 4.0 .. 4.3 ] <i>compatibility</i> profile, as well as most of it's extensions defined at the time of this specification.</p> <p>Note: OpenGL [ 4.0 .. 4.3 ] compatibility profile does includes fixed point functionality.</p> <p>Future extensions will be added with a <a href="#maintenanceupdates">maintenance update</a></p> </li> - <li> {@link javax.media.opengl.GLES1 javax.media.opengl.GLES1} interface + <li> {@link com.jogamp.opengl.GLES1 com.jogamp.opengl.GLES1} interface <p>This interface contains all OpenGL ES [ 1.0 .. 1.1 ] methods, as well as most of it's extensions defined at the time of this specification.</p> <p>Future extensions will be added with a <a href="#maintenanceupdates">maintenance update</a></p> </li> - <li> {@link javax.media.opengl.GLES2 javax.media.opengl.GLES2} interface + <li> {@link com.jogamp.opengl.GLES2 com.jogamp.opengl.GLES2} interface <p>This interface contains all OpenGL ES 2.0 methods, as well as most of it's extensions defined at the time of this specification.</p> <p>Future extensions will be added with a <a href="#maintenanceupdates">maintenance update</a></p> </li> - <li> {@link javax.media.opengl.GLES3 javax.media.opengl.GLES3} interface + <li> {@link com.jogamp.opengl.GLES3 com.jogamp.opengl.GLES3} interface <p>This interface contains all OpenGL ES 3.0 methods, as well as most of it's extensions defined at the time of this specification.</p> <p>Future extensions will be added with a <a href="#maintenanceupdates">maintenance update</a></p> @@ -125,39 +125,39 @@ bindings to the native OpenGL(R) 3D graphics library profiles: These <i>common profiles</i> may be utilize for cross profile code supposed to either run on desktop and mobile devices, or across GL profiles themselves:</p> <ul> - <li> {@link javax.media.opengl.GLBase javax.media.opengl.GLBase} interface + <li> {@link com.jogamp.opengl.GLBase com.jogamp.opengl.GLBase} interface <p>Common interface containing the profile type identification and conversion methods.</p> <p>Used to query which specialized profile class an instance of this object actually is and offering a protocol to convert it to these types.</p></li> - <li> {@link javax.media.opengl.GL javax.media.opengl.GL} interface + <li> {@link com.jogamp.opengl.GL com.jogamp.opengl.GL} interface <p>Common interface containing the subset of all profiles, GL4bc, GL4, GL3bc, GL3, GL2, GLES1, GLES2 and GLES3.</p> <p>This interface reflects common data types, texture and framebuffer functionality.</p></li> - <li> {@link javax.media.opengl.GL2ES1 javax.media.opengl.GL2ES1} interface + <li> {@link com.jogamp.opengl.GL2ES1 com.jogamp.opengl.GL2ES1} interface <p>Interface containing the common subset of GL2 and GLES1.</p> <p>This interface reflects the fixed functionality of OpenGL, without the immediate mode API.</p></li> - <li> {@link javax.media.opengl.GL2ES2 javax.media.opengl.GL2ES2} interface + <li> {@link com.jogamp.opengl.GL2ES2 com.jogamp.opengl.GL2ES2} interface <p>Interface containing the common subset of GL2 and GLES2. Interface is almost GLES2 complete.</p> <p>This interface reflects the programmable shader functionality of desktop and embedded OpenGL up until GLES2.</p></li> - <li> {@link javax.media.opengl.GL3ES3 javax.media.opengl.GL3ES3} interface + <li> {@link com.jogamp.opengl.GL3ES3 com.jogamp.opengl.GL3ES3} interface <p>Interface containing the common subset of core GL3 and GLES3. Interface is almost GLES3 complete, lacking <code>GL_ARB_ES3_compatibility</code> extension.</p> <p>This interface reflects the programmable shader functionality of desktop and embedded OpenGL up until GLES3.</p></li> - <li> {@link javax.media.opengl.GL4ES3 javax.media.opengl.GL4ES3} interface + <li> {@link com.jogamp.opengl.GL4ES3 com.jogamp.opengl.GL4ES3} interface <p>Interface containing the common subset of core GL4 and GLES3. Interface is GLES3 complete w/o vendor extensions.</p> <p>This interface reflects the programmable shader functionality of desktop and embedded OpenGL up until GLES3.</p></li> - <li> {@link javax.media.opengl.GL2GL3 javax.media.opengl.GL2GL3} interface + <li> {@link com.jogamp.opengl.GL2GL3 com.jogamp.opengl.GL2GL3} interface <p>Interface containing the common subset of core GL3 (OpenGL 3.1+) and GL2 (OpenGL 3.0), also known as the OpenGL 3.0 forward compatible, non deprecated subset.</p> <p>This interface reflects only the programmable shader functionality of desktop OpenGL</p></li> </ul> </li> - <li>The <b>javax.media.opengl.glu</b> package + <li>The <b>com.jogamp.opengl.glu</b> package <p> This package contains bindings for the OpenGL Graphics System Utility (GLU) Library version 1.3, inclusive, with the exception of the GLU NURBS routines @@ -172,7 +172,7 @@ experience. <p> The rules for creating the Java language binding are described in the following sections. These rules should be followed as closely as possible for all future -APIs that share the javax.media.opengl namespace.</p> +APIs that share the com.jogamp.opengl namespace.</p> <h4>Function Naming</h4> Functions are named in the same way as in the C binding. That is, an OpenGL @@ -333,7 +333,7 @@ Sharing of server-side OpenGL objects such as buffer objects, e.g. VBOs, and textures among OpenGL contexts is supported in this specification. <p> -See {@link javax.media.opengl.GLSharedContextSetter GLSharedContextSetter} interface +See {@link com.jogamp.opengl.GLSharedContextSetter GLSharedContextSetter} interface for details. </p> @@ -344,7 +344,7 @@ for details. according the following rules: </p> <ul> - <li><a name="GL3InclusionCriteria">{@link javax.media.opengl.GL3 javax.media.opengl.GL3} interface</a> + <li><a name="GL3InclusionCriteria">{@link com.jogamp.opengl.GL3 com.jogamp.opengl.GL3} interface</a> <ul> <li>All functions in core, forward compatible, OpenGL [ 3.1 - 3.3 ], inclusive, have been included, as described in the header files <code>GL/glcorearb.h</code>.</li> @@ -362,7 +362,7 @@ according the following rules: </p> <li> OpenGL 3.2 Spec Appendix E.1: It is not possible to implement both core and compatibility profiles in a single GL context, ..</li> </ul></li> </ul></li> - <li><a name="GL2InclusionCriteria"> {@link javax.media.opengl.GL2 javax.media.opengl.GL2} interface</a> + <li><a name="GL2InclusionCriteria"> {@link com.jogamp.opengl.GL2 com.jogamp.opengl.GL2} interface</a> <ul> <li>All functions in core OpenGL 3.0, inclusive, have been included.</li> <li>Reason for making the <em>cut</em> at OpenGL 3.0 are: @@ -439,13 +439,13 @@ implementation. <h3><a name="GLRuntimeVersion">OpenGL Version on Runtime System</a></h3> -<h4><a name="GL4RuntimeVersion">{@link javax.media.opengl.GL4 GL4} Desktop Requirements</a></h4> +<h4><a name="GL4RuntimeVersion">{@link com.jogamp.opengl.GL4 GL4} Desktop Requirements</a></h4> An OpenGL ≥ 4.0 version is required to instantiate a GL4 context. -<h4><a name="GL3RuntimeVersion">{@link javax.media.opengl.GL3 GL3} Desktop Requirements</a></h4> +<h4><a name="GL3RuntimeVersion">{@link com.jogamp.opengl.GL3 GL3} Desktop Requirements</a></h4> An OpenGL ≥ 3.1 version is required to instantiate a GL3 context. -<h4><a name="GL2RuntimeVersion">{@link javax.media.opengl.GL2 GL2} Desktop Requirements</a></h4> +<h4><a name="GL2RuntimeVersion">{@link com.jogamp.opengl.GL2 GL2} Desktop Requirements</a></h4> Even though OpenGL extensions whose functionality was included into core OpenGL by version 3.0, inclusive, are not included in the bindings, it should be noted that OpenGL version 3.0 is not an absolute requirement on the runtime @@ -460,13 +460,13 @@ the presence of at least OpenGL 1.5 on the target system. due to it's dynamical function binding starting with OpenGL 1.2.</p> <p>In future revisions of the API, this minimum standard may be raised.</p> -<h4><a name="GLES3RuntimeVersion">{@link javax.media.opengl.GLES3 GLES3} Requirements</a></h4> +<h4><a name="GLES3RuntimeVersion">{@link com.jogamp.opengl.GLES3 GLES3} Requirements</a></h4> An OpenGL ES ≥ 3.0 version is required to instantiate an ES3 context. -<h4><a name="GLES2RuntimeVersion">{@link javax.media.opengl.GLES2 GLES2} Requirements</a></h4> +<h4><a name="GLES2RuntimeVersion">{@link com.jogamp.opengl.GLES2 GLES2} Requirements</a></h4> An OpenGL ES ≥ 2.0 version is required to instantiate an ES2 context. -<h4><a name="GLES1RuntimeVersion">{@link javax.media.opengl.GLES1 GLES1} Requirements</a></h4> +<h4><a name="GLES1RuntimeVersion">{@link com.jogamp.opengl.GLES1 GLES1} Requirements</a></h4> An OpenGL ES [ 1.0 .. 1.1 ] version is required to instantiate an ES1 context. <h3><a name="RuntimeVersionInformation">Runtime Version Information</a></h3> @@ -485,7 +485,7 @@ the build date and source code repository branch name and it's latest commit ide <h3><a name="maintenanceupdates">Future Maintenance Updates</a></h3> New core APIs found in future versions of OpenGL, as well as new OpenGL extensions, are expected to be added to the bindings and included into the -javax.media.opengl namespace via future maintenance updates to the API. +com.jogamp.opengl namespace via future maintenance updates to the API. <h3>Related Links</h3> <ul> diff --git a/make/joglversion b/make/joglversion index 4e53b8de0..ded0fb106 100644 --- a/make/joglversion +++ b/make/joglversion @@ -10,7 +10,7 @@ Implementation-Branch: @SCM_BRANCH@ Implementation-Commit: @SCM_COMMIT@ Implementation-Vendor: JogAmp Community Implementation-URL: http://jogamp.org/ -Extension-Name: javax.media.opengl +Extension-Name: com.jogamp.opengl Implementation-Vendor-Id: com.jogamp Trusted-Library: true Permissions: all-permissions diff --git a/make/joglversion-all b/make/joglversion-all index 4e53b8de0..ded0fb106 100644 --- a/make/joglversion-all +++ b/make/joglversion-all @@ -10,7 +10,7 @@ Implementation-Branch: @SCM_BRANCH@ Implementation-Commit: @SCM_COMMIT@ Implementation-Vendor: JogAmp Community Implementation-URL: http://jogamp.org/ -Extension-Name: javax.media.opengl +Extension-Name: com.jogamp.opengl Implementation-Vendor-Id: com.jogamp Trusted-Library: true Permissions: all-permissions diff --git a/make/nativewindowversion b/make/nativewindowversion index f31c7f2bc..7c047a631 100644 --- a/make/nativewindowversion +++ b/make/nativewindowversion @@ -10,7 +10,7 @@ Implementation-Branch: @SCM_BRANCH@ Implementation-Commit: @SCM_COMMIT@ Implementation-Vendor: JogAmp Community Implementation-URL: http://jogamp.org/ -Extension-Name: javax.media.nativewindow +Extension-Name: com.jogamp.nativewindow Implementation-Vendor-Id: com.jogamp Trusted-Library: true Permissions: all-permissions diff --git a/make/resources/android/AndroidManifest-jogl.xml b/make/resources/android/AndroidManifest-jogl.xml index 1b6c46356..76872b69e 100644 --- a/make/resources/android/AndroidManifest-jogl.xml +++ b/make/resources/android/AndroidManifest-jogl.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" sharedUserId="com.jogamp.Community" - package="javax.media.opengl"> + package="com.jogamp.opengl"> <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <uses-feature android:name="android.hardware.camera" android:required="false" /> diff --git a/make/resources/android/AndroidManifest-test.xml b/make/resources/android/AndroidManifest-test.xml index 916f34e05..3238c2280 100644 --- a/make/resources/android/AndroidManifest-test.xml +++ b/make/resources/android/AndroidManifest-test.xml @@ -8,7 +8,7 @@ <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /> <uses-library android:name="com.jogamp.common" android:required="true" /> - <uses-library android:name="javax.media.opengl" android:required="true" /> + <uses-library android:name="com.jogamp.opengl" android:required="true" /> <uses-library android:name="jogamp.android.launcher" android:required="true" /> <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/> diff --git a/make/scripts/adb-install-all-aarch64.sh b/make/scripts/adb-install-all-aarch64.sh new file mode 100755 index 000000000..0572817bf --- /dev/null +++ b/make/scripts/adb-install-all-aarch64.sh @@ -0,0 +1,4 @@ +#adb $* install ../build-android-aarch64/jogamp-android-launcher.apk +#adb $* install ../build-android-aarch64/gluegen-rt-android-aarch64.apk +adb $* install ../build-android-aarch64/jar/jogl-all-android-aarch64.apk +adb $* install ../build-android-aarch64/jar/jogl-test-android.apk diff --git a/make/scripts/adb-install-all-armv6.sh b/make/scripts/adb-install-all-armv6.sh index 0ba9f3ca0..be890b197 100755 --- a/make/scripts/adb-install-all-armv6.sh +++ b/make/scripts/adb-install-all-armv6.sh @@ -1,4 +1,4 @@ #adb $* install ../../gluegen/build-android-armv6/jogamp-android-launcher.apk -#adb $* install ../../gluegen/build-android-armv6/gluegen-rt-android-armeabi.apk -adb $* install ../build-android-armv6/jar/jogl-all-android-armeabi.apk +#adb $* install ../../gluegen/build-android-armv6/gluegen-rt-android-armv6.apk +adb $* install ../build-android-armv6/jar/jogl-all-android-armv6.apk adb $* install ../build-android-armv6/jar/jogl-test-android.apk diff --git a/make/scripts/adb-install-all-armv7.sh b/make/scripts/adb-install-all-armv7.sh deleted file mode 100755 index f0a1dc522..000000000 --- a/make/scripts/adb-install-all-armv7.sh +++ /dev/null @@ -1,4 +0,0 @@ -#adb $* install ../../gluegen/build-android-armv7/jogamp-android-launcher.apk -#adb $* install ../../gluegen/build-android-armv7/gluegen-rt-android-armeabi-v7a.apk -adb $* install ../build-android-armv7/jar/jogl-all-android-armeabi-v7a.apk -adb $* install ../build-android-armv7/jar/jogl-test-android.apk diff --git a/make/scripts/adb-launch-junit.sh b/make/scripts/adb-launch-junit.sh index e53e76456..6780f9fa6 100644 --- a/make/scripts/adb-launch-junit.sh +++ b/make/scripts/adb-launch-junit.sh @@ -60,7 +60,7 @@ LOGFILE=`basename $0 .sh`.log #adb -s $TARGET_IP:$TARGET_ADB_PORT install $BUILD_DIR/jogamp-android-launcher.apk #adb -s $TARGET_IP:$TARGET_ADB_PORT install $BUILD_DIR/gluegen-rt-android-armeabi.apk -#adb -s $TARGET_IP:$TARGET_ADB_PORT uninstall javax.media.opengl +#adb -s $TARGET_IP:$TARGET_ADB_PORT uninstall com.jogamp.opengl #adb -s $TARGET_IP:$TARGET_ADB_PORT install $BUILD_DIR/jar/jogl-all-android-armeabi.apk #adb -s $TARGET_IP:$TARGET_ADB_PORT uninstall com.jogamp.opengl.test diff --git a/make/scripts/adb-launch-main.sh b/make/scripts/adb-launch-main.sh index 12dcab1e4..0068ef7dd 100644 --- a/make/scripts/adb-launch-main.sh +++ b/make/scripts/adb-launch-main.sh @@ -51,7 +51,7 @@ LOGFILE=`basename $0 .sh`.log #adb -s $TARGET_IP:$TARGET_ADB_PORT install $BUILD_DIR/jogamp-android-launcher.apk #adb -s $TARGET_IP:$TARGET_ADB_PORT install $BUILD_DIR/gluegen-rt-android-armeabi.apk -#adb -s $TARGET_IP:$TARGET_ADB_PORT uninstall javax.media.opengl +#adb -s $TARGET_IP:$TARGET_ADB_PORT uninstall com.jogamp.opengl #adb -s $TARGET_IP:$TARGET_ADB_PORT install $BUILD_DIR/jar/jogl-all-android-armeabi.apk #adb -s $TARGET_IP:$TARGET_ADB_PORT uninstall com.jogamp.opengl.test diff --git a/make/scripts/adb-logcat.sh b/make/scripts/adb-logcat.sh index 443011f84..bac072e7f 100755 --- a/make/scripts/adb-logcat.sh +++ b/make/scripts/adb-logcat.sh @@ -1,4 +1,8 @@ sdir=`dirname $0` +#adb $* shell stop +#adb $* shell setprop log.redirect-stdio true +#adb $* shell setprop log.redirect-stderr true +#adb $* shell start adb $* logcat -c adb $* logcat 2>&1 | tee adb-logcat.log diff --git a/make/scripts/adb-reinstall-all-armv7.sh b/make/scripts/adb-reinstall-all-aarch64.sh index 2cb7713dc..e27a1e929 100755 --- a/make/scripts/adb-reinstall-all-armv7.sh +++ b/make/scripts/adb-reinstall-all-aarch64.sh @@ -1,5 +1,5 @@ sdir=`dirname $0` $sdir/adb-uninstall-all.sh $* -$sdir/adb-install-all-armv7.sh $* +$sdir/adb-install-all-aarch64.sh $* diff --git a/make/scripts/adb-uninstall-all.sh b/make/scripts/adb-uninstall-all.sh index a80c38f61..af40b5129 100755 --- a/make/scripts/adb-uninstall-all.sh +++ b/make/scripts/adb-uninstall-all.sh @@ -1,4 +1,5 @@ #adb $* uninstall jogamp.android.launcher #adb $* uninstall com.jogamp.common adb $* uninstall javax.media.opengl +adb $* uninstall com.jogamp.opengl adb $* uninstall com.jogamp.opengl.test diff --git a/make/scripts/cmpOld2New.sh b/make/scripts/cmpOld2New.sh index 4a121a632..a9475523e 100755 --- a/make/scripts/cmpOld2New.sh +++ b/make/scripts/cmpOld2New.sh @@ -2,8 +2,8 @@ dirscript=`dirname $0` -dirold=../build-old/jogl/gensrc/classes/javax/media/opengl/ -dirnew=../build/jogl/gensrc/classes/javax/media/opengl/ +dirold=../build-old/jogl/gensrc/classes/com/jogamp/opengl/ +dirnew=../build/jogl/gensrc/classes/com/jogamp/opengl/ dircmp=cmp-old2new rm -rf $dircmp diff --git a/make/scripts/lsGL23_commons.sh b/make/scripts/lsGL23_commons.sh index cab55639b..ec16fa209 100755 --- a/make/scripts/lsGL23_commons.sh +++ b/make/scripts/lsGL23_commons.sh @@ -7,7 +7,7 @@ if [ -z "$BUILDDIR" ] ; then exit 1 fi -idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl +idir=$BUILDDIR/jogl/gensrc/classes/com/jogamp/opengl SOURCE="$idir/GL.java $idir/GL2ES2.java $idir/GL2GL3.java $idir/GL3.java" diff --git a/make/scripts/lsGL23_unique.sh b/make/scripts/lsGL23_unique.sh index e21112ecc..560a3e4cd 100755 --- a/make/scripts/lsGL23_unique.sh +++ b/make/scripts/lsGL23_unique.sh @@ -7,7 +7,7 @@ if [ -z "$BUILDDIR" ] ; then exit 1 fi -idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl +idir=$BUILDDIR/jogl/gensrc/classes/com/jogamp/opengl SOURCE="$idir/GL.java $idir/GLES2.java $idir/GL2ES2.java $idir/GL3.java $idir/GL2.java $idir/GL2GL3.java" diff --git a/make/scripts/lsGL23toGL2ES1_commons.sh b/make/scripts/lsGL23toGL2ES1_commons.sh index 83a543b3c..b5439ac33 100755 --- a/make/scripts/lsGL23toGL2ES1_commons.sh +++ b/make/scripts/lsGL23toGL2ES1_commons.sh @@ -7,7 +7,7 @@ if [ -z "$BUILDDIR" ] ; then exit 1 fi -idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl +idir=$BUILDDIR/jogl/gensrc/classes/com/jogamp/opengl echo GL2GL3 to GL2ES1 enums # sort $idir/GL2.java $idir/GL3.java $idir/GL2ES1.java $idir/GL2GL3.java | uniq -d | grep GL_ | awk ' { print $5 } ' diff --git a/make/scripts/lsGL2_GL3_commons.sh b/make/scripts/lsGL2_GL3_commons.sh index 722ba850d..b0ebbdae3 100755 --- a/make/scripts/lsGL2_GL3_commons.sh +++ b/make/scripts/lsGL2_GL3_commons.sh @@ -7,7 +7,7 @@ if [ -z "$BUILDDIR" ] ; then exit 1 fi -idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl +idir=$BUILDDIR/jogl/gensrc/classes/com/jogamp/opengl SOURCE="$idir/GL.java $idir/GL2ES2.java $idir/GL2GL3.java $idir/GL2.java $idir/GL3.java" diff --git a/make/scripts/lsGLES2toGL3_commons.sh b/make/scripts/lsGLES2toGL3_commons.sh index d271b7ea2..aa65c8cfe 100755 --- a/make/scripts/lsGLES2toGL3_commons.sh +++ b/make/scripts/lsGLES2toGL3_commons.sh @@ -7,7 +7,7 @@ if [ -z "$BUILDDIR" ] ; then exit 1 fi -idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl +idir=$BUILDDIR/jogl/gensrc/classes/com/jogamp/opengl echo GLES2 to GL3 enums sort $idir/GLES2.java $idir/GL3.java $idir/GL2ES2.java | uniq -d | grep GL_ | awk ' { print $5 } ' diff --git a/make/scripts/lsGLtoES1ES2_commons.sh b/make/scripts/lsGLtoES1ES2_commons.sh index 21efb6549..eece3d25a 100755 --- a/make/scripts/lsGLtoES1ES2_commons.sh +++ b/make/scripts/lsGLtoES1ES2_commons.sh @@ -7,7 +7,7 @@ if [ -z "$BUILDDIR" ] ; then exit 1 fi -idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl +idir=$BUILDDIR/jogl/gensrc/classes/com/jogamp/opengl echo GL to GL2ES1 to GL2ES1 GL2 enums sort $idir/GL.java $idir/GL2ES1.java $idir/GL2ES2.java $idir/GL2.java | uniq -d | grep GL_ | awk ' { print $5 } ' diff --git a/make/scripts/lsGLtoES1_commons.sh b/make/scripts/lsGLtoES1_commons.sh index e8a370acb..ba72ecc23 100755 --- a/make/scripts/lsGLtoES1_commons.sh +++ b/make/scripts/lsGLtoES1_commons.sh @@ -7,7 +7,7 @@ if [ -z "$BUILDDIR" ] ; then exit 1 fi -idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl +idir=$BUILDDIR/jogl/gensrc/classes/com/jogamp/opengl echo GL to GL2ES1 to GLES1 enums sort $idir/GL.java $idir/GLES1.java $idir/GL2ES1.java | uniq -d | grep GL_ | awk ' { print $5 } ' diff --git a/make/scripts/lsGLtoES2_commons.sh b/make/scripts/lsGLtoES2_commons.sh index bbd0e239c..ade2ff110 100755 --- a/make/scripts/lsGLtoES2_commons.sh +++ b/make/scripts/lsGLtoES2_commons.sh @@ -7,7 +7,7 @@ if [ -z "$BUILDDIR" ] ; then exit 1 fi -idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl +idir=$BUILDDIR/jogl/gensrc/classes/com/jogamp/opengl echo GL to GL2ES2 to GLES2 enums sort $idir/GL.java $idir/GLES2.java $idir/GL2ES2.java | uniq -d | grep GL_ | awk ' { print $5 } ' diff --git a/make/scripts/lsGLtoGL3_commons.sh b/make/scripts/lsGLtoGL3_commons.sh index 44cc34ccd..a2126ce79 100755 --- a/make/scripts/lsGLtoGL3_commons.sh +++ b/make/scripts/lsGLtoGL3_commons.sh @@ -7,7 +7,7 @@ if [ -z "$BUILDDIR" ] ; then exit 1 fi -idir=$BUILDDIR/jogl/gensrc/classes/javax/media/opengl +idir=$BUILDDIR/jogl/gensrc/classes/com/jogamp/opengl echo GL to GL2ES2 to GL3 enums sort $idir/GL.java $idir/GL3.java $idir/GL2ES2.java | uniq -d | grep GL_ | awk ' { print $5 } ' diff --git a/make/scripts/make.jogl.all.android-aarch64-cross.sh b/make/scripts/make.jogl.all.android-aarch64-cross.sh new file mode 100755 index 000000000..96d369ecc --- /dev/null +++ b/make/scripts/make.jogl.all.android-aarch64-cross.sh @@ -0,0 +1,63 @@ +#! /bin/sh + +SDIR=`dirname $0` + +if [ -e $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh ] ; then + . $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh +fi + +if [ -e $SDIR/../../../gluegen/make/scripts/setenv-android-tools.sh ] ; then + . $SDIR/../../../gluegen/make/scripts/setenv-android-tools.sh +fi + +export NODE_LABEL=. + +export HOST_UID=jogamp +# jogamp02 - 10.1.0.122 +export HOST_IP=10.1.0.122 +export HOST_RSYNC_ROOT=PROJECTS/JOGL + +export TARGET_UID=jogamp +export TARGET_IP=panda02 +#export TARGET_IP=jautab03 +#export TARGET_IP=jauphone04 +export TARGET_ADB_PORT=5555 +# needs executable bit (probably su) +export TARGET_ROOT=/data/projects +export TARGET_ANT_HOME=/usr/share/ant + +export ANDROID_VERSION=21 +export SOURCE_LEVEL=1.6 +export TARGET_LEVEL=1.6 +export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar + +#export GCC_VERSION=4.4.3 +export GCC_VERSION=4.9 +HOST_ARCH=linux-x86_64 +export TARGET_TRIPLE=aarch64-linux-android + +export NDK_TOOLCHAIN_ROOT=$NDK_ROOT/toolchains/${TARGET_TRIPLE}-${GCC_VERSION}/prebuilt/${HOST_ARCH} +export TARGET_PLATFORM_ROOT=${NDK_ROOT}/platforms/android-${ANDROID_VERSION}/arch-arm64 + +# Need to add toolchain bins to the PATH. +# May need to create symbolic links within $NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin +# cd $NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin +# ln -s ../../bin/aarch64-linux-android-gcc gcc +export PATH="$NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH" + +export GLUEGEN_CPPTASKS_FILE=`pwd`/../../gluegen/make/lib/gluegen-cpptasks-android-aarch64.xml + +#export JUNIT_DISABLED="true" +#export JUNIT_RUN_ARG0="-Dnewt.test.Screen.disableScreenMode" + +echo PATH $PATH 2>&1 | tee make.jogl.all.android-aarch64-cross.log +echo gcc `which gcc` 2>&1 | tee -a make.jogl.all.android-aarch64-cross.log + +#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org" +export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet" + +# BUILD_ARCHIVE=true \ +ant \ + -Drootrel.build=build-android-aarch64 \ + $* 2>&1 | tee -a make.jogl.all.android-aarch64-cross.log + diff --git a/make/scripts/make.jogl.all.android-armv6-cross.sh b/make/scripts/make.jogl.all.android-armv6-cross.sh index 1b5f5bf44..ad7255aad 100755 --- a/make/scripts/make.jogl.all.android-armv6-cross.sh +++ b/make/scripts/make.jogl.all.android-armv6-cross.sh @@ -6,6 +6,10 @@ if [ -e $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh ] ; then . $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh fi +if [ -e $SDIR/../../../gluegen/make/scripts/setenv-android-tools.sh ] ; then + . $SDIR/../../../gluegen/make/scripts/setenv-android-tools.sh +fi + export NODE_LABEL=. export HOST_UID=jogamp @@ -22,70 +26,21 @@ export TARGET_ADB_PORT=5555 export TARGET_ROOT=/data/projects export TARGET_ANT_HOME=/usr/share/ant -echo ANDROID_HOME $ANDROID_HOME -echo NDK_ROOT $NDK_ROOT - -if [ -z "$NDK_ROOT" ] ; then - # - # Generic android-ndk - # - if [ -e /usr/local/android-ndk ] ; then - NDK_ROOT=/usr/local/android-ndk - elif [ -e /opt-linux-x86/android-ndk ] ; then - NDK_ROOT=/opt-linux-x86/android-ndk - elif [ -e /opt/android-ndk ] ; then - NDK_ROOT=/opt/android-ndk - # - # Specific android-ndk-r8d - # - elif [ -e /usr/local/android-ndk-r8d ] ; then - NDK_ROOT=/usr/local/android-ndk-r8d - elif [ -e /opt-linux-x86/android-ndk-r8d ] ; then - NDK_ROOT=/opt-linux-x86/android-ndk-r8d - elif [ -e /opt/android-ndk-r8d ] ; then - NDK_ROOT=/opt/android-ndk-r8d - else - echo NDK_ROOT is not specified and does not exist in default locations - exit 1 - fi -elif [ ! -e $NDK_ROOT ] ; then - echo NDK_ROOT $NDK_ROOT does not exist - exit 1 -fi -export NDK_ROOT - -if [ -z "$ANDROID_HOME" ] ; then - if [ -e /usr/local/android-sdk-linux_x86 ] ; then - ANDROID_HOME=/usr/local/android-sdk-linux_x86 - elif [ -e /opt-linux-x86/android-sdk-linux_x86 ] ; then - ANDROID_HOME=/opt-linux-x86/android-sdk-linux_x86 - elif [ -e /opt/android-sdk-linux_x86 ] ; then - ANDROID_HOME=/opt/android-sdk-linux_x86 - else - echo ANDROID_HOME is not specified and does not exist in default locations - exit 1 - fi -elif [ ! -e $ANDROID_HOME ] ; then - echo ANDROID_HOME $ANDROID_HOME does not exist - exit 1 -fi -export ANDROID_HOME - export ANDROID_VERSION=9 export SOURCE_LEVEL=1.6 export TARGET_LEVEL=1.6 export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar #export GCC_VERSION=4.4.3 -export GCC_VERSION=4.7 -HOST_ARCH=linux-x86 +export GCC_VERSION=4.8 +HOST_ARCH=linux-x86_64 export TARGET_TRIPLE=arm-linux-androideabi export NDK_TOOLCHAIN_ROOT=$NDK_ROOT/toolchains/${TARGET_TRIPLE}-${GCC_VERSION}/prebuilt/${HOST_ARCH} export TARGET_PLATFORM_ROOT=${NDK_ROOT}/platforms/android-${ANDROID_VERSION}/arch-arm # Need to add toolchain bins to the PATH. -export PATH="$NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/17.0.0:$PATH" +export PATH="$NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH" export GLUEGEN_CPPTASKS_FILE=`pwd`/../../gluegen/make/lib/gluegen-cpptasks-android-armv6.xml diff --git a/make/scripts/make.jogl.all.android-armv7-cross.sh b/make/scripts/make.jogl.all.android-armv7-cross.sh deleted file mode 100755 index fd7bf2010..000000000 --- a/make/scripts/make.jogl.all.android-armv7-cross.sh +++ /dev/null @@ -1,100 +0,0 @@ -#! /bin/sh - -if [ -e $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh ] ; then - . $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh -fi - -export NODE_LABEL=. - -export HOST_UID=jogamp -# jogamp02 - 10.1.0.122 -export HOST_IP=10.1.0.122 -export HOST_RSYNC_ROOT=PROJECTS/JOGL - -export TARGET_UID=jogamp -export TARGET_IP=panda02 -#export TARGET_IP=jautab03 -#export TARGET_IP=jauphone04 -export TARGET_ADB_PORT=5555 -# needs executable bit (probably su) -export TARGET_ROOT=/data/projects -export TARGET_ANT_HOME=/usr/share/ant - -echo ANDROID_HOME $ANDROID_HOME -echo NDK_ROOT $NDK_ROOT - -if [ -z "$NDK_ROOT" ] ; then - # - # Generic android-ndk - # - if [ -e /usr/local/android-ndk ] ; then - NDK_ROOT=/usr/local/android-ndk - elif [ -e /opt-linux-x86/android-ndk ] ; then - NDK_ROOT=/opt-linux-x86/android-ndk - elif [ -e /opt/android-ndk ] ; then - NDK_ROOT=/opt/android-ndk - # - # Specific android-ndk-r8d - # - elif [ -e /usr/local/android-ndk-r8d ] ; then - NDK_ROOT=/usr/local/android-ndk-r8d - elif [ -e /opt-linux-x86/android-ndk-r8d ] ; then - NDK_ROOT=/opt-linux-x86/android-ndk-r8d - elif [ -e /opt/android-ndk-r8d ] ; then - NDK_ROOT=/opt/android-ndk-r8d - else - echo NDK_ROOT is not specified and does not exist in default locations - exit 1 - fi -elif [ ! -e $NDK_ROOT ] ; then - echo NDK_ROOT $NDK_ROOT does not exist - exit 1 -fi -export NDK_ROOT - -if [ -z "$ANDROID_HOME" ] ; then - if [ -e /usr/local/android-sdk-linux_x86 ] ; then - ANDROID_HOME=/usr/local/android-sdk-linux_x86 - elif [ -e /opt-linux-x86/android-sdk-linux_x86 ] ; then - ANDROID_HOME=/opt-linux-x86/android-sdk-linux_x86 - elif [ -e /opt/android-sdk-linux_x86 ] ; then - ANDROID_HOME=/opt/android-sdk-linux_x86 - else - echo ANDROID_HOME is not specified and does not exist in default locations - exit 1 - fi -elif [ ! -e $ANDROID_HOME ] ; then - echo ANDROID_HOME $ANDROID_HOME does not exist - exit 1 -fi -export ANDROID_HOME - -export ANDROID_VERSION=9 -export SOURCE_LEVEL=1.6 -export TARGET_LEVEL=1.6 -export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar - -#export GCC_VERSION=4.4.3 -export GCC_VERSION=4.7 -HOST_ARCH=linux-x86 -export TARGET_TRIPLE=arm-linux-androideabi - -export NDK_TOOLCHAIN_ROOT=$NDK_ROOT/toolchains/${TARGET_TRIPLE}-${GCC_VERSION}/prebuilt/${HOST_ARCH} -export TARGET_PLATFORM_ROOT=${NDK_ROOT}/platforms/android-${ANDROID_VERSION}/arch-arm - -# Need to add toolchain bins to the PATH. -export PATH="$NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin:$ANDROID_HOME/platform-tools:$PATH" - -export GLUEGEN_CPPTASKS_FILE=`pwd`/../../gluegen/make/lib/gluegen-cpptasks-android-armv7.xml - -#export JUNIT_DISABLED="true" -#export JUNIT_RUN_ARG0="-Dnewt.test.Screen.disableScreenMode" - -#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org" -export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet" - -# BUILD_ARCHIVE=true \ -ant \ - -Drootrel.build=build-android-armv7 \ - $* 2>&1 | tee -a make.jogl.all.android-armv7-cross.log - diff --git a/make/scripts/setenv-jogl.sh b/make/scripts/setenv-jogl.sh index bbaf5187c..79db4f9b1 100755 --- a/make/scripts/setenv-jogl.sh +++ b/make/scripts/setenv-jogl.sh @@ -115,17 +115,18 @@ JOGAMP_ALL_NOAWT_ALT_CLASSPATH=.:"$GLUEGEN_ALT_JAR":"$JOAL_JAR":"$JOGL_ALL_NOAWT JOGAMP_MOBILE_ALT_CLASSPATH=.:"$GLUEGEN_ALT_JAR":"$JOAL_JAR":"$JOGL_MOBILE_CLASSPATH":"$SWT_CLASSPATH":"$JUNIT_JAR":"$ANT_JARS":"$SEMVER_JAR":"$GLUEGEN_TESTUTIL_JAR" export JOGAMP_ALL_AWT_CLASSPATH JOGAMP_ALL_NOAWT_CLASSPATH JOGAMP_MOBILE_CLASSPATH JOGAMP_ATOMICS_NOAWT_CLASSPATH JOGAMP_ALL_NOAWT_ALT_CLASSPATH JOGAMP_MOBILE_ALT_CLASSPATH -CLASSPATH=.:"$GLUEGEN_JAR":"$JOAL_JAR":"$JOGL_CLASSPATH":"$SWT_CLASSPATH":"$JUNIT_JAR":"$ANT_JARS":"$SEMVER_JAR":"$GLUEGEN_TESTUTIL_JAR" -export CLASSPATH +JOGAMP_CLASSPATH=.:"$GLUEGEN_JAR":"$JOAL_JAR":"$JOGL_CLASSPATH":"$SWT_CLASSPATH":"$JUNIT_JAR":"$ANT_JARS":"$SEMVER_JAR":"$GLUEGEN_TESTUTIL_JAR" +export JOGAMP_CLASSPATH -# We use TempJarCache per default now! -#export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$GLUEGEN_OS":"$JOGL_LIB_DIR" -#export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH":"$GLUEGEN_OS:"$JOGL_LIB_DIR" +export JOGAMP_LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$GLUEGEN_OS":"$JOGL_LIB_DIR" +export JOGAMP_DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH":"$GLUEGEN_OS":"$JOGL_LIB_DIR" echo JOGAMP_ALL_AWT_CLASSPATH: "$JOGAMP_ALL_AWT_CLASSPATH" echo JOGAMP_ALL_NOAWT_CLASSPATH: "$JOGAMP_ALL_NOAWT_CLASSPATH" echo JOGAMP_MOBILE_CLASSPATH: "$JOGAMP_MOBILE_CLASSPATH" -echo CLASSPATH: "$CLASSPATH" +echo JOGAMP_CLASSPATH: "$JOGAMP_CLASSPATH" +echo JOGAMP_LD_LIBRARY_PATH: "$JOGAMP_LD_LIBRARY_PATH" +echo JOGAMP_DYLD_LIBRARY_PATH: "$JOGAMP_DYLD_LIBRARY_PATH" echo echo MacOSX REMEMBER to add the JVM arguments "-XstartOnFirstThread -Djava.awt.headless=true" for running demos without AWT, e.g. NEWT echo MacOSX REMEMBER to add the JVM arguments "-XstartOnFirstThread -Djava.awt.headless=true com.jogamp.newt.util.MainThread" for running demos with NEWT diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat index 2f67f4386..8a94a0fa2 100755 --- a/make/scripts/tests-win.bat +++ b/make/scripts/tests-win.bat @@ -1,6 +1,6 @@ REM scripts\java-win.bat jogamp.newt.awt.opengl.VersionApplet REM scripts\java-win.bat com.jogamp.newt.opengl.GLWindow -REM scripts\java-win.bat javax.media.opengl.awt.GLCanvas +REM scripts\java-win.bat com.jogamp.awt.GLCanvas REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT %* REM scripts\java-win.bat com.jogamp.oculusvr.OVRVersion %* @@ -12,7 +12,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGe REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 40000 -width 100 -height 100 -screen 0 %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT %* -REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT %* +scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.DemoGLJPanelPerf02AWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT %* @@ -194,7 +194,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.glsl.TestShaderCompil REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol01AWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol02NEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol03NewtAWT %* -scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestWindowAndPointerIconNEWT %* +REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestWindowAndPointerIconNEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestSWT01GLn %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestSWT02GLn %* diff --git a/make/scripts/tests-x32-dbg.bat b/make/scripts/tests-x32-dbg.bat index 91d1d6fbc..c89eee449 100755 --- a/make/scripts/tests-x32-dbg.bat +++ b/make/scripts/tests-x32-dbg.bat @@ -1,4 +1,9 @@ +set TEMP=\\jordan\data\Incoming\windows\temp
+set TMP=\\jordan\data\Incoming\windows\temp
+REM set TEMP=C:\Documents and Settings\jogamp\temp
+REM set TMP=C:\Documents and Settings\jogamp\temp
+
set BLD_SUB=build-win32
set J2RE_HOME=c:\jre1.7.0_67_x32
set JAVA_HOME=c:\jdk1.7.0_67_x32
@@ -31,6 +36,8 @@ REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.GLContext"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.windows.cpu_affinity_mode=0"
REM set D_ARGS="-Djogamp.debug.IOUtil" "-Djogl.debug.GLSLCode" "-Djogl.debug.GLMediaPlayer"
+REM set D_ARGS="-Djogamp.debug.IOUtil"
+set D_ARGS="-Djogl.debug.GLSLCode"
REM set D_ARGS="-Djogl.debug.ExtensionAvailabilityCache" "-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.ProcAddressHelper=true" "-Djogamp.debug.NativeLibrary=true" "-Djogamp.debug.NativeLibrary.Lookup=true"
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.NativeLibrary=true"
REM set D_ARGS="-Djogamp.debug.JNILibLoader=true" "-Djogamp.debug.NativeLibrary=true" "-Djogamp.debug.NativeLibrary.Lookup=true" "-Djogl.debug.GLProfile=true"
diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat index 1f0b88139..0439e0f78 100755 --- a/make/scripts/tests-x64-dbg.bat +++ b/make/scripts/tests-x64-dbg.bat @@ -1,4 +1,9 @@ +set TEMP=\\jordan\data\Incoming\windows\temp
+set TMP=\\jordan\data\Incoming\windows\temp
+REM set TEMP=C:\Documents and Settings\jogamp\temp
+REM set TMP=C:\Documents and Settings\jogamp\temp
+
set BLD_SUB=build-win64
set J2RE_HOME=c:\jre1.7.0_67_x64
set JAVA_HOME=c:\jdk1.7.0_67_x64
@@ -36,7 +41,7 @@ REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.QueryN REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.GLContext" "-Djogl.debug.GLCanvas"
REM set D_ARGS="-Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.CapabilitiesChooser -Djogl.debug.GLProfile"
REM set D_ARGS="-Djogamp.debug.IOUtil"
-set D_ARGS="-Djogl.debug.GLSLCode"
+REM set D_ARGS="-Djogl.debug.GLSLCode"
REM set D_ARGS="-Djogl.debug.GLSLCode" "-Djogl.debug.GLMediaPlayer"
REM set D_ARGS="-Djogl.debug.GLMediaPlayer"
REM set D_ARGS="-Djogl.debug.GLMediaPlayer" "-Djogl.debug.AudioSink"
@@ -60,6 +65,7 @@ REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLC REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.GLJPanel" "-Djogl.debug.TileRenderer" "-Djogl.debug.TileRenderer.PNG"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.GLJPanel" "-Djogl.debug.TileRenderer"
+set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.GLJPanel"
REM set D_ARGS="-Djogl.gljpanel.noverticalflip"
REM set D_ARGS="-Dnewt.debug=all"
REM set D_ARGS="-Dnewt.debug.Window"
diff --git a/make/scripts/tests-x64.sh b/make/scripts/tests-x64.sh index 30b0aaf8a..8102c011f 100755 --- a/make/scripts/tests-x64.sh +++ b/make/scripts/tests-x64.sh @@ -10,7 +10,10 @@ SDIR=`dirname $0` #export LD_LIBRARY_PATH=$HOME/libav-10.1/lib:$LD_LIBRARY_PATH #export LD_LIBRARY_PATH=$HOME/ffmpeg-2.2.2/lib:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH=$HOME/ffmpeg-2.2.3/lib:$LD_LIBRARY_PATH +#export LD_LIBRARY_PATH=$HOME/ffmpeg-2.2.3/lib:$LD_LIBRARY_PATH + +#export LD_LIBRARY_PATH=$HOME/libav-11.2/lib:$LD_LIBRARY_PATH +#export LD_LIBRARY_PATH=$HOME/ffmpeg-2.5/lib:$LD_LIBRARY_PATH #J2RE_HOME=/opt-linux-x86_64/jre1.7.0_45 #JAVA_HOME=/opt-linux-x86_64/jdk1.7.0_45 diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 00bd8571e..83d51f971 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -42,6 +42,10 @@ if [ $MOSX -eq 1 ] ; then MOSX_MT=1 fi +# We use TempJarCache per default now! +#export LD_LIBRARY_PATH=$JOGAMP_LD_LIBRARY_PATH +#export DYLD_LIBRARY_PATH=$JOGAMP_DYLD_LIBRARY_PATH + #export LD_LIBRARY_PATH=$spath/../../EXTERNAL/PVRVFrame/OGLES-2.0/Linux_x86_64:$LD_LIBRARY_PATH #export LD_LIBRARY_PATH=$spath/../../EXTERNAL/PVRVFrame/OGLES-2.0/Linux_x86_32:$LD_LIBRARY_PATH #export LD_LIBRARY_PATH=/usr/local/projects/Xorg.modular/build-x86_64/lib:$LD_LIBRARY_PATH @@ -116,6 +120,7 @@ function jrun() { #D_ARGS="-Dnativewindow.debug.X11Util.ATI_HAS_NO_XCLOSEDISPLAY_BUG" #D_ARGS="-Dnativewindow.debug.X11Util.ATI_HAS_NO_MULTITHREADING_BUG" + #D_ARGS="-Djogl.disable.opengldesktop" #D_ARGS="-Djogl.disable.opengles" #D_ARGS="-Djogl.disable.openglcore" #D_ARGS="-Djogl.disable.openglarbcontext" @@ -149,7 +154,16 @@ function jrun() { #D_ARGS="-Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.FBObject" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLDrawable -Dnativewindow.debug.GraphicsConfiguration" #D_ARGS="-Dnativewindow.debug.GraphicsConfiguration" + #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLDrawable" + #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLDrawable -Djogl.debug.GLProfile -Djogamp.common.utils.locks.Lock.timeout=600000 -Djogamp.debug.Lock" + #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLDrawable -Dnativewindow.debug.ProxySurface -Djogl.debug.GLProfile -Djogl.disable.opengldesktop" + #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLDrawable -Dnativewindow.debug.ProxySurface -Djogl.debug.GLProfile" + #D_ARGS="-Djogl.disable.surfacelesscontext -Djogl.debug.GLContext -Djogl.debug.GLDrawable -Djogl.debug.GLJPanel -Djogl.debug.DebugGL" + #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLJPanel -Djogl.debug.DebugGL" + #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLJPanel" + #D_ARGS="-Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.GLJPanel" + #D_ARGS="-Djogl.debug.GLJPanel" #D_ARGS="-Djogl.debug.GLContext.NoProfileAliasing" #D_ARGS="-Djogl.debug.GLDrawable -Dnativewindow.debug.X11Util -Dnativewindow.debug.NativeWindow -Dnewt.debug.Display -Dnewt.debug.Screen -Dnewt.debug.Window" #D_ARGS="-Djogl.debug.Animator" @@ -217,7 +231,7 @@ function jrun() { #D_ARGS="-Dnewt.debug.EDT" #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT -Djogl.debug.GLContext" #D_ARGS="-Dnewt.debug.Window -Djogl.debug.Animator -Dnewt.debug.Screen" - #D_ARGS="-Dnativewindow.debug.JAWT -Dnewt.debug.Window -Djogl.debug.GLJPanel -Djogl.debug.GLCanvas" + #D_ARGS="-Dnativewindow.debug.JAWT -Dnewt.debug.Window -Djogl.debug.GLJPanel -Djogl.debug.GLCanvas -Djogamp.debug.TempJarCache" #D_ARGS="-Dnewt.debug.Window.KeyEvent" #D_ARGS="-Dnewt.debug.Window.MouseEvent" #D_ARGS="-Dnewt.debug.Window.MouseEvent -Dnewt.debug.Window.KeyEvent" @@ -285,6 +299,8 @@ function jrun() { #X_ARGS="-Xcheck:jni -verbose:jni" #X_ARGS="-Xrs" #X_ARGS="-Dsun.awt.disableMixing=true" + #D_ARGS="-Djogamp.debug.NativeLibrary=true -Djogamp.debug.JNILibLoader=true -Djogl.debug.GLMediaPlayer" + D_ARGS="-Djogl.debug.GLMediaPlayer" #D_ARGS="-Djogamp.debug.IOUtil -Djogl.debug.GLSLCode -Djogl.debug.GLMediaPlayer" #D_ARGS="-Djogl.debug.AudioSink -Djoal.openal.lib=system" #D_ARGS="-Djogl.debug.AudioSink -Djogl.debug.AudioSink.trace" @@ -375,7 +391,7 @@ function testawtswt() { # Version # #testawt jogamp.newt.awt.opengl.VersionApplet $* -#testawt javax.media.opengl.awt.GLCanvas $* +#testawt com.jogamp.opengl.awt.GLCanvas $* #testnoawt com.jogamp.nativewindow.NativeWindowVersion $* #testnoawt com.jogamp.opengl.JoglVersion $* #testnoawt com.jogamp.newt.NewtVersion $* @@ -398,8 +414,8 @@ function testawtswt() { # HiDPI # #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* -#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* +#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* @@ -589,7 +605,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.newt.TestWindows01NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol02NEWT $* -testnoawt com.jogamp.opengl.test.junit.newt.TestWindowAndPointerIconNEWT $* +#testnoawt com.jogamp.opengl.test.junit.newt.TestWindowAndPointerIconNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows02NEWTAnimated $* #testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows03NEWTAnimResize $* @@ -785,13 +801,14 @@ testnoawt com.jogamp.opengl.test.junit.newt.TestWindowAndPointerIconNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTexture02AWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestJPEGImage01NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestJPEGJoglAWTCompareNewtAWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestJPEGJoglAWTBenchmarkNewtAWT $* +#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestJPEGJoglAWTCompareNewtAWT $* +#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestJPEGJoglAWTBenchmarkNewtAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestJPEGTextureFromFileNEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGPixelRect00NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGPixelRect01NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPixelFormat00NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPixelFormatUtil00NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPixelFormatUtil01NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGPixelRect00NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGPixelRect01NEWT $* #testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGTextureFromFileAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGTextureFromFileNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTGATextureFromFileNEWT $* @@ -825,7 +842,7 @@ testnoawt com.jogamp.opengl.test.junit.newt.TestWindowAndPointerIconNEWT $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.ui.UINewtDemo01 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo $* -#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* +testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* #testawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtCanvasAWTDemo $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $* diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/avcodec.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/avcodec.h new file mode 100644 index 000000000..253e45ad0 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/avcodec.h @@ -0,0 +1,4450 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVCODEC_H +#define AVCODEC_AVCODEC_H + +/** + * @file + * @ingroup libavc + * Libavcodec external API header + */ + +#include <errno.h> +#include "libavutil/samplefmt.h" +#include "libavutil/attributes.h" +#include "libavutil/avutil.h" +#include "libavutil/buffer.h" +#include "libavutil/cpu.h" +#include "libavutil/dict.h" +#include "libavutil/frame.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" + +#include "version.h" + +#if FF_API_FAST_MALLOC +// to provide fast_*alloc +#include "libavutil/mem.h" +#endif + +/** + * @defgroup libavc Encoding/Decoding Library + * @{ + * + * @defgroup lavc_decoding Decoding + * @{ + * @} + * + * @defgroup lavc_encoding Encoding + * @{ + * @} + * + * @defgroup lavc_codec Codecs + * @{ + * @defgroup lavc_codec_native Native Codecs + * @{ + * @} + * @defgroup lavc_codec_wrappers External library wrappers + * @{ + * @} + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge + * @{ + * @} + * @} + * @defgroup lavc_internal Internal + * @{ + * @} + * @} + * + */ + +/** + * @defgroup lavc_core Core functions/structures. + * @ingroup libavc + * + * Basic definitions, functions for querying libavcodec capabilities, + * allocating core structures, etc. + * @{ + */ + + +/** + * Identify the syntax and semantics of the bitstream. + * The principle is roughly: + * Two decoders with the same ID can decode the same streams. + * Two encoders with the same ID can encode compatible streams. + * There may be slight deviations from the principle due to implementation + * details. + * + * If you add a codec ID to this list, add it so that + * 1. no value of a existing codec ID changes (that would break ABI), + * 2. it is as close as possible to similar codecs. + * + * After adding new codec IDs, do not forget to add an entry to the codec + * descriptor list and bump libavcodec minor version. + */ +enum AVCodecID { + AV_CODEC_ID_NONE, + + /* video codecs */ + AV_CODEC_ID_MPEG1VIDEO, + AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding +#if FF_API_XVMC + AV_CODEC_ID_MPEG2VIDEO_XVMC, +#endif /* FF_API_XVMC */ + AV_CODEC_ID_H261, + AV_CODEC_ID_H263, + AV_CODEC_ID_RV10, + AV_CODEC_ID_RV20, + AV_CODEC_ID_MJPEG, + AV_CODEC_ID_MJPEGB, + AV_CODEC_ID_LJPEG, + AV_CODEC_ID_SP5X, + AV_CODEC_ID_JPEGLS, + AV_CODEC_ID_MPEG4, + AV_CODEC_ID_RAWVIDEO, + AV_CODEC_ID_MSMPEG4V1, + AV_CODEC_ID_MSMPEG4V2, + AV_CODEC_ID_MSMPEG4V3, + AV_CODEC_ID_WMV1, + AV_CODEC_ID_WMV2, + AV_CODEC_ID_H263P, + AV_CODEC_ID_H263I, + AV_CODEC_ID_FLV1, + AV_CODEC_ID_SVQ1, + AV_CODEC_ID_SVQ3, + AV_CODEC_ID_DVVIDEO, + AV_CODEC_ID_HUFFYUV, + AV_CODEC_ID_CYUV, + AV_CODEC_ID_H264, + AV_CODEC_ID_INDEO3, + AV_CODEC_ID_VP3, + AV_CODEC_ID_THEORA, + AV_CODEC_ID_ASV1, + AV_CODEC_ID_ASV2, + AV_CODEC_ID_FFV1, + AV_CODEC_ID_4XM, + AV_CODEC_ID_VCR1, + AV_CODEC_ID_CLJR, + AV_CODEC_ID_MDEC, + AV_CODEC_ID_ROQ, + AV_CODEC_ID_INTERPLAY_VIDEO, + AV_CODEC_ID_XAN_WC3, + AV_CODEC_ID_XAN_WC4, + AV_CODEC_ID_RPZA, + AV_CODEC_ID_CINEPAK, + AV_CODEC_ID_WS_VQA, + AV_CODEC_ID_MSRLE, + AV_CODEC_ID_MSVIDEO1, + AV_CODEC_ID_IDCIN, + AV_CODEC_ID_8BPS, + AV_CODEC_ID_SMC, + AV_CODEC_ID_FLIC, + AV_CODEC_ID_TRUEMOTION1, + AV_CODEC_ID_VMDVIDEO, + AV_CODEC_ID_MSZH, + AV_CODEC_ID_ZLIB, + AV_CODEC_ID_QTRLE, + AV_CODEC_ID_TSCC, + AV_CODEC_ID_ULTI, + AV_CODEC_ID_QDRAW, + AV_CODEC_ID_VIXL, + AV_CODEC_ID_QPEG, + AV_CODEC_ID_PNG, + AV_CODEC_ID_PPM, + AV_CODEC_ID_PBM, + AV_CODEC_ID_PGM, + AV_CODEC_ID_PGMYUV, + AV_CODEC_ID_PAM, + AV_CODEC_ID_FFVHUFF, + AV_CODEC_ID_RV30, + AV_CODEC_ID_RV40, + AV_CODEC_ID_VC1, + AV_CODEC_ID_WMV3, + AV_CODEC_ID_LOCO, + AV_CODEC_ID_WNV1, + AV_CODEC_ID_AASC, + AV_CODEC_ID_INDEO2, + AV_CODEC_ID_FRAPS, + AV_CODEC_ID_TRUEMOTION2, + AV_CODEC_ID_BMP, + AV_CODEC_ID_CSCD, + AV_CODEC_ID_MMVIDEO, + AV_CODEC_ID_ZMBV, + AV_CODEC_ID_AVS, + AV_CODEC_ID_SMACKVIDEO, + AV_CODEC_ID_NUV, + AV_CODEC_ID_KMVC, + AV_CODEC_ID_FLASHSV, + AV_CODEC_ID_CAVS, + AV_CODEC_ID_JPEG2000, + AV_CODEC_ID_VMNC, + AV_CODEC_ID_VP5, + AV_CODEC_ID_VP6, + AV_CODEC_ID_VP6F, + AV_CODEC_ID_TARGA, + AV_CODEC_ID_DSICINVIDEO, + AV_CODEC_ID_TIERTEXSEQVIDEO, + AV_CODEC_ID_TIFF, + AV_CODEC_ID_GIF, + AV_CODEC_ID_DXA, + AV_CODEC_ID_DNXHD, + AV_CODEC_ID_THP, + AV_CODEC_ID_SGI, + AV_CODEC_ID_C93, + AV_CODEC_ID_BETHSOFTVID, + AV_CODEC_ID_PTX, + AV_CODEC_ID_TXD, + AV_CODEC_ID_VP6A, + AV_CODEC_ID_AMV, + AV_CODEC_ID_VB, + AV_CODEC_ID_PCX, + AV_CODEC_ID_SUNRAST, + AV_CODEC_ID_INDEO4, + AV_CODEC_ID_INDEO5, + AV_CODEC_ID_MIMIC, + AV_CODEC_ID_RL2, + AV_CODEC_ID_ESCAPE124, + AV_CODEC_ID_DIRAC, + AV_CODEC_ID_BFI, + AV_CODEC_ID_CMV, + AV_CODEC_ID_MOTIONPIXELS, + AV_CODEC_ID_TGV, + AV_CODEC_ID_TGQ, + AV_CODEC_ID_TQI, + AV_CODEC_ID_AURA, + AV_CODEC_ID_AURA2, + AV_CODEC_ID_V210X, + AV_CODEC_ID_TMV, + AV_CODEC_ID_V210, + AV_CODEC_ID_DPX, + AV_CODEC_ID_MAD, + AV_CODEC_ID_FRWU, + AV_CODEC_ID_FLASHSV2, + AV_CODEC_ID_CDGRAPHICS, + AV_CODEC_ID_R210, + AV_CODEC_ID_ANM, + AV_CODEC_ID_BINKVIDEO, + AV_CODEC_ID_IFF_ILBM, + AV_CODEC_ID_IFF_BYTERUN1, + AV_CODEC_ID_KGV1, + AV_CODEC_ID_YOP, + AV_CODEC_ID_VP8, + AV_CODEC_ID_PICTOR, + AV_CODEC_ID_ANSI, + AV_CODEC_ID_A64_MULTI, + AV_CODEC_ID_A64_MULTI5, + AV_CODEC_ID_R10K, + AV_CODEC_ID_MXPEG, + AV_CODEC_ID_LAGARITH, + AV_CODEC_ID_PRORES, + AV_CODEC_ID_JV, + AV_CODEC_ID_DFA, + AV_CODEC_ID_WMV3IMAGE, + AV_CODEC_ID_VC1IMAGE, + AV_CODEC_ID_UTVIDEO, + AV_CODEC_ID_BMV_VIDEO, + AV_CODEC_ID_VBLE, + AV_CODEC_ID_DXTORY, + AV_CODEC_ID_V410, + AV_CODEC_ID_XWD, + AV_CODEC_ID_CDXL, + AV_CODEC_ID_XBM, + AV_CODEC_ID_ZEROCODEC, + AV_CODEC_ID_MSS1, + AV_CODEC_ID_MSA1, + AV_CODEC_ID_TSCC2, + AV_CODEC_ID_MTS2, + AV_CODEC_ID_CLLC, + AV_CODEC_ID_MSS2, + AV_CODEC_ID_VP9, + AV_CODEC_ID_AIC, + AV_CODEC_ID_ESCAPE130, + AV_CODEC_ID_G2M, + AV_CODEC_ID_WEBP, + AV_CODEC_ID_HNM4_VIDEO, + AV_CODEC_ID_HEVC, + AV_CODEC_ID_FIC, + AV_CODEC_ID_ALIAS_PIX, + AV_CODEC_ID_BRENDER_PIX, + AV_CODEC_ID_PAF_VIDEO, + AV_CODEC_ID_EXR, + AV_CODEC_ID_VP7, + AV_CODEC_ID_SANM, + AV_CODEC_ID_SGIRLE, + AV_CODEC_ID_MVC1, + AV_CODEC_ID_MVC2, + + /* various PCM "codecs" */ + AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs + AV_CODEC_ID_PCM_S16LE = 0x10000, + AV_CODEC_ID_PCM_S16BE, + AV_CODEC_ID_PCM_U16LE, + AV_CODEC_ID_PCM_U16BE, + AV_CODEC_ID_PCM_S8, + AV_CODEC_ID_PCM_U8, + AV_CODEC_ID_PCM_MULAW, + AV_CODEC_ID_PCM_ALAW, + AV_CODEC_ID_PCM_S32LE, + AV_CODEC_ID_PCM_S32BE, + AV_CODEC_ID_PCM_U32LE, + AV_CODEC_ID_PCM_U32BE, + AV_CODEC_ID_PCM_S24LE, + AV_CODEC_ID_PCM_S24BE, + AV_CODEC_ID_PCM_U24LE, + AV_CODEC_ID_PCM_U24BE, + AV_CODEC_ID_PCM_S24DAUD, + AV_CODEC_ID_PCM_ZORK, + AV_CODEC_ID_PCM_S16LE_PLANAR, + AV_CODEC_ID_PCM_DVD, + AV_CODEC_ID_PCM_F32BE, + AV_CODEC_ID_PCM_F32LE, + AV_CODEC_ID_PCM_F64BE, + AV_CODEC_ID_PCM_F64LE, + AV_CODEC_ID_PCM_BLURAY, + AV_CODEC_ID_PCM_LXF, + AV_CODEC_ID_S302M, + AV_CODEC_ID_PCM_S8_PLANAR, + AV_CODEC_ID_PCM_S24LE_PLANAR, + AV_CODEC_ID_PCM_S32LE_PLANAR, + + /* various ADPCM codecs */ + AV_CODEC_ID_ADPCM_IMA_QT = 0x11000, + AV_CODEC_ID_ADPCM_IMA_WAV, + AV_CODEC_ID_ADPCM_IMA_DK3, + AV_CODEC_ID_ADPCM_IMA_DK4, + AV_CODEC_ID_ADPCM_IMA_WS, + AV_CODEC_ID_ADPCM_IMA_SMJPEG, + AV_CODEC_ID_ADPCM_MS, + AV_CODEC_ID_ADPCM_4XM, + AV_CODEC_ID_ADPCM_XA, + AV_CODEC_ID_ADPCM_ADX, + AV_CODEC_ID_ADPCM_EA, + AV_CODEC_ID_ADPCM_G726, + AV_CODEC_ID_ADPCM_CT, + AV_CODEC_ID_ADPCM_SWF, + AV_CODEC_ID_ADPCM_YAMAHA, + AV_CODEC_ID_ADPCM_SBPRO_4, + AV_CODEC_ID_ADPCM_SBPRO_3, + AV_CODEC_ID_ADPCM_SBPRO_2, + AV_CODEC_ID_ADPCM_THP, + AV_CODEC_ID_ADPCM_IMA_AMV, + AV_CODEC_ID_ADPCM_EA_R1, + AV_CODEC_ID_ADPCM_EA_R3, + AV_CODEC_ID_ADPCM_EA_R2, + AV_CODEC_ID_ADPCM_IMA_EA_SEAD, + AV_CODEC_ID_ADPCM_IMA_EA_EACS, + AV_CODEC_ID_ADPCM_EA_XAS, + AV_CODEC_ID_ADPCM_EA_MAXIS_XA, + AV_CODEC_ID_ADPCM_IMA_ISS, + AV_CODEC_ID_ADPCM_G722, + AV_CODEC_ID_ADPCM_IMA_APC, + AV_CODEC_ID_ADPCM_VIMA, + + /* AMR */ + AV_CODEC_ID_AMR_NB = 0x12000, + AV_CODEC_ID_AMR_WB, + + /* RealAudio codecs*/ + AV_CODEC_ID_RA_144 = 0x13000, + AV_CODEC_ID_RA_288, + + /* various DPCM codecs */ + AV_CODEC_ID_ROQ_DPCM = 0x14000, + AV_CODEC_ID_INTERPLAY_DPCM, + AV_CODEC_ID_XAN_DPCM, + AV_CODEC_ID_SOL_DPCM, + + /* audio codecs */ + AV_CODEC_ID_MP2 = 0x15000, + AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 + AV_CODEC_ID_AAC, + AV_CODEC_ID_AC3, + AV_CODEC_ID_DTS, + AV_CODEC_ID_VORBIS, + AV_CODEC_ID_DVAUDIO, + AV_CODEC_ID_WMAV1, + AV_CODEC_ID_WMAV2, + AV_CODEC_ID_MACE3, + AV_CODEC_ID_MACE6, + AV_CODEC_ID_VMDAUDIO, + AV_CODEC_ID_FLAC, + AV_CODEC_ID_MP3ADU, + AV_CODEC_ID_MP3ON4, + AV_CODEC_ID_SHORTEN, + AV_CODEC_ID_ALAC, + AV_CODEC_ID_WESTWOOD_SND1, + AV_CODEC_ID_GSM, ///< as in Berlin toast format + AV_CODEC_ID_QDM2, + AV_CODEC_ID_COOK, + AV_CODEC_ID_TRUESPEECH, + AV_CODEC_ID_TTA, + AV_CODEC_ID_SMACKAUDIO, + AV_CODEC_ID_QCELP, + AV_CODEC_ID_WAVPACK, + AV_CODEC_ID_DSICINAUDIO, + AV_CODEC_ID_IMC, + AV_CODEC_ID_MUSEPACK7, + AV_CODEC_ID_MLP, + AV_CODEC_ID_GSM_MS, /* as found in WAV */ + AV_CODEC_ID_ATRAC3, +#if FF_API_VOXWARE + AV_CODEC_ID_VOXWARE, +#endif + AV_CODEC_ID_APE, + AV_CODEC_ID_NELLYMOSER, + AV_CODEC_ID_MUSEPACK8, + AV_CODEC_ID_SPEEX, + AV_CODEC_ID_WMAVOICE, + AV_CODEC_ID_WMAPRO, + AV_CODEC_ID_WMALOSSLESS, + AV_CODEC_ID_ATRAC3P, + AV_CODEC_ID_EAC3, + AV_CODEC_ID_SIPR, + AV_CODEC_ID_MP1, + AV_CODEC_ID_TWINVQ, + AV_CODEC_ID_TRUEHD, + AV_CODEC_ID_MP4ALS, + AV_CODEC_ID_ATRAC1, + AV_CODEC_ID_BINKAUDIO_RDFT, + AV_CODEC_ID_BINKAUDIO_DCT, + AV_CODEC_ID_AAC_LATM, + AV_CODEC_ID_QDMC, + AV_CODEC_ID_CELT, + AV_CODEC_ID_G723_1, + AV_CODEC_ID_G729, + AV_CODEC_ID_8SVX_EXP, + AV_CODEC_ID_8SVX_FIB, + AV_CODEC_ID_BMV_AUDIO, + AV_CODEC_ID_RALF, + AV_CODEC_ID_IAC, + AV_CODEC_ID_ILBC, + AV_CODEC_ID_OPUS, + AV_CODEC_ID_COMFORT_NOISE, + AV_CODEC_ID_TAK, + AV_CODEC_ID_METASOUND, + AV_CODEC_ID_PAF_AUDIO, + AV_CODEC_ID_ON2AVC, + + /* subtitle codecs */ + AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. + AV_CODEC_ID_DVD_SUBTITLE = 0x17000, + AV_CODEC_ID_DVB_SUBTITLE, + AV_CODEC_ID_TEXT, ///< raw UTF-8 text + AV_CODEC_ID_XSUB, + AV_CODEC_ID_SSA, + AV_CODEC_ID_MOV_TEXT, + AV_CODEC_ID_HDMV_PGS_SUBTITLE, + AV_CODEC_ID_DVB_TELETEXT, + AV_CODEC_ID_SRT, + + /* other specific kind of codecs (generally used for attachments) */ + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + AV_CODEC_ID_TTF = 0x18000, + + AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it + + AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS + * stream (only used by libavformat) */ + AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems + * stream (only used by libavformat) */ + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. +}; + +/** + * This struct describes the properties of a single codec described by an + * AVCodecID. + * @see avcodec_get_descriptor() + */ +typedef struct AVCodecDescriptor { + enum AVCodecID id; + enum AVMediaType type; + /** + * Name of the codec described by this descriptor. It is non-empty and + * unique for each codec descriptor. It should contain alphanumeric + * characters and '_' only. + */ + const char *name; + /** + * A more descriptive name for this codec. May be NULL. + */ + const char *long_name; + /** + * Codec properties, a combination of AV_CODEC_PROP_* flags. + */ + int props; +} AVCodecDescriptor; + +/** + * Codec uses only intra compression. + * Video codecs only. + */ +#define AV_CODEC_PROP_INTRA_ONLY (1 << 0) +/** + * Codec supports lossy compression. Audio and video codecs only. + * @note a codec may support both lossy and lossless + * compression modes + */ +#define AV_CODEC_PROP_LOSSY (1 << 1) +/** + * Codec supports lossless compression. Audio and video codecs only. + */ +#define AV_CODEC_PROP_LOSSLESS (1 << 2) +/** + * Codec supports frame reordering. That is, the coded order (the order in which + * the encoded packets are output by the encoders / stored / input to the + * decoders) may be different from the presentation order of the corresponding + * frames. + * + * For codecs that do not have this property set, PTS and DTS should always be + * equal. + */ +#define AV_CODEC_PROP_REORDER (1 << 3) + +/** + * @ingroup lavc_decoding + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * This is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end.<br> + * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + */ +#define FF_INPUT_BUFFER_PADDING_SIZE 8 + +/** + * @ingroup lavc_encoding + * minimum encoding buffer size + * Used to avoid some checks during header writing. + */ +#define FF_MIN_BUFFER_SIZE 16384 + + +/** + * @ingroup lavc_encoding + * motion estimation type. + */ +enum Motion_Est_ID { + ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed + ME_FULL, + ME_LOG, + ME_PHODS, + ME_EPZS, ///< enhanced predictive zonal search + ME_X1, ///< reserved for experiments + ME_HEX, ///< hexagon based search + ME_UMH, ///< uneven multi-hexagon search + ME_TESA, ///< transformed exhaustive search algorithm +}; + +/** + * @ingroup lavc_decoding + */ +enum AVDiscard{ + /* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). */ + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all +}; + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + +/** + * @ingroup lavc_encoding + */ +typedef struct RcOverride{ + int start_frame; + int end_frame; + int qscale; // If this is 0 then quality_factor will be used instead. + float quality_factor; +} RcOverride; + +#if FF_API_MAX_BFRAMES +/** + * @deprecated there is no libavcodec-wide limit on the number of B-frames + */ +#define FF_MAX_B_FRAMES 16 +#endif + +/* encoding support + These flags can be passed in AVCodecContext.flags before initialization. + Note: Not everything is supported yet. +*/ + +/** + * Allow decoders to produce frames with data planes that are not aligned + * to CPU requirements (e.g. due to cropping). + */ +#define CODEC_FLAG_UNALIGNED 0x0001 +#define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale. +#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263. +#define CODEC_FLAG_OUTPUT_CORRUPT 0x0008 ///< Output even those frames that might be corrupted +#define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC. +#if FF_API_GMC +/** + * @deprecated use the "gmc" private option of the libxvid encoder + */ +#define CODEC_FLAG_GMC 0x0020 ///< Use GMC. +#endif +#if FF_API_MV0 +/** + * @deprecated use the flag "mv0" in the "mpv_flags" private option of the + * mpegvideo encoders + */ +#define CODEC_FLAG_MV0 0x0040 +#endif +#if FF_API_INPUT_PRESERVED +/** + * @deprecated passing reference-counted frames to the encoders replaces this + * flag + */ +#define CODEC_FLAG_INPUT_PRESERVED 0x0100 +#endif +#define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode. +#define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode. +#define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale. +#if FF_API_EMU_EDGE +/** + * @deprecated edges are not used/required anymore. I.e. this flag is now always + * set. + */ +#define CODEC_FLAG_EMU_EDGE 0x4000 +#endif +#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding. +#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random + location instead of only at frame boundaries. */ +#if FF_API_NORMALIZE_AQP +/** + * @deprecated use the flag "naq" in the "mpv_flags" private option of the + * mpegvideo encoders + */ +#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 +#endif +#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. +#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay. +#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe. +#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT). +/* Fx : Flag for h263+ extra options */ +#define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction +#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter +#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation +#define CODEC_FLAG_CLOSED_GOP 0x80000000 +#define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. +#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. +#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. +#define CODEC_FLAG2_IGNORE_CROP 0x00010000 ///< Discard cropping information from SPS. + +#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. + +/* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independent Segment Decoding */ +/* /Fx */ +/* codec capabilities */ + +#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback. +/** + * Codec uses get_buffer() for allocating buffers and supports custom allocators. + * If not set, it might not use get_buffer() at all or use operations that + * assume the buffer was allocated by avcodec_default_get_buffer. + */ +#define CODEC_CAP_DR1 0x0002 +#define CODEC_CAP_TRUNCATED 0x0008 +#if FF_API_XVMC +/* Codec can export data for HW decoding (XvMC). */ +#define CODEC_CAP_HWACCEL 0x0010 +#endif /* FF_API_XVMC */ +/** + * Encoder or decoder requires flushing with NULL input at the end in order to + * give the complete and correct output. + * + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with + * with NULL data. The user can still send NULL data to the public encode + * or decode function, but libavcodec will not pass it along to the codec + * unless this flag is set. + * + * Decoders: + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to get the delayed data until the decoder no longer + * returns frames. + * + * Encoders: + * The encoder needs to be fed with NULL data at the end of encoding until the + * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. + */ +#define CODEC_CAP_DELAY 0x0020 +/** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. + */ +#define CODEC_CAP_SMALL_LAST_FRAME 0x0040 +#if FF_API_CAP_VDPAU +/** + * Codec can export data for HW decoding (VDPAU). + */ +#define CODEC_CAP_HWACCEL_VDPAU 0x0080 +#endif +/** + * Codec can output multiple frames per AVPacket + * Normally demuxers return one frame at a time, demuxers which do not do + * are connected to a parser to split what they return into proper frames. + * This flag is reserved to the very rare category of codecs which have a + * bitstream that cannot be split into frames without timeconsuming + * operations like full decoding. Demuxers carring such bitstreams thus + * may return multiple frames in a packet. This has many disadvantages like + * prohibiting stream copy in many cases thus it should only be considered + * as a last resort. + */ +#define CODEC_CAP_SUBFRAMES 0x0100 +/** + * Codec is experimental and is thus avoided in favor of non experimental + * encoders + */ +#define CODEC_CAP_EXPERIMENTAL 0x0200 +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define CODEC_CAP_CHANNEL_CONF 0x0400 +#if FF_API_NEG_LINESIZES +/** + * @deprecated no codecs use this capability + */ +#define CODEC_CAP_NEG_LINESIZES 0x0800 +#endif +/** + * Codec supports frame-level multithreading. + */ +#define CODEC_CAP_FRAME_THREADS 0x1000 +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define CODEC_CAP_SLICE_THREADS 0x2000 +/** + * Codec supports changed parameters at any point. + */ +#define CODEC_CAP_PARAM_CHANGE 0x4000 +/** + * Codec supports avctx->thread_count == 0 (auto). + */ +#define CODEC_CAP_AUTO_THREADS 0x8000 +/** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000 + +#if FF_API_MB_TYPE +//The following defines may change, don't expect compatibility if you use them. +#define MB_TYPE_INTRA4x4 0x0001 +#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific +#define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific +#define MB_TYPE_16x16 0x0008 +#define MB_TYPE_16x8 0x0010 +#define MB_TYPE_8x16 0x0020 +#define MB_TYPE_8x8 0x0040 +#define MB_TYPE_INTERLACED 0x0080 +#define MB_TYPE_DIRECT2 0x0100 //FIXME +#define MB_TYPE_ACPRED 0x0200 +#define MB_TYPE_GMC 0x0400 +#define MB_TYPE_SKIP 0x0800 +#define MB_TYPE_P0L0 0x1000 +#define MB_TYPE_P1L0 0x2000 +#define MB_TYPE_P0L1 0x4000 +#define MB_TYPE_P1L1 0x8000 +#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) +#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) +#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) +#define MB_TYPE_QUANT 0x00010000 +#define MB_TYPE_CBP 0x00020000 +//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) +#endif + +/** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + */ +typedef struct AVPanScan{ + /** + * id + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int id; + + /** + * width and height in 1/16 pel + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int width; + int height; + + /** + * position of the top left corner in 1/16 pel for up to 3 fields/frames + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t position[3][2]; +}AVPanScan; + +#if FF_API_QSCALE_TYPE +#define FF_QSCALE_TYPE_MPEG1 0 +#define FF_QSCALE_TYPE_MPEG2 1 +#define FF_QSCALE_TYPE_H264 2 +#define FF_QSCALE_TYPE_VP56 3 +#endif + +#if FF_API_GET_BUFFER +#define FF_BUFFER_TYPE_INTERNAL 1 +#define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user) +#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared. +#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything. + +#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore). +#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. +#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. +#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). +#endif + +/** + * The decoder will keep a reference to the frame and may reuse it later. + */ +#define AV_GET_BUFFER_FLAG_REF (1 << 0) + +/** + * @defgroup lavc_packet AVPacket + * + * Types and functions for working with AVPacket. + * @{ + */ +enum AVPacketSideDataType { + AV_PKT_DATA_PALETTE, + AV_PKT_DATA_NEW_EXTRADATA, + + /** + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: + * @code + * u32le param_flags + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) + * s32le channel_count + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) + * u64le channel_layout + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) + * s32le sample_rate + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) + * s32le width + * s32le height + * @endcode + */ + AV_PKT_DATA_PARAM_CHANGE, + + /** + * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of + * structures with info about macroblocks relevant to splitting the + * packet into smaller packets on macroblock edges (e.g. as for RFC 2190). + * That is, it does not necessarily contain info about all macroblocks, + * as long as the distance between macroblocks in the info is smaller + * than the target payload size. + * Each MB info structure is 12 bytes, and is laid out as follows: + * @code + * u32le bit offset from the start of the packet + * u8 current quantizer at the start of the macroblock + * u8 GOB number + * u16le macroblock address within the GOB + * u8 horizontal MV predictor + * u8 vertical MV predictor + * u8 horizontal MV predictor for block number 3 + * u8 vertical MV predictor for block number 3 + * @endcode + */ + AV_PKT_DATA_H263_MB_INFO, + + /** + * This side data should be associated with an audio stream and contains + * ReplayGain information in form of the AVReplayGain struct. + */ + AV_PKT_DATA_REPLAYGAIN, + + /** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the decoded video frames for + * correct presentation. + * + * See libavutil/display.h for a detailed description of the data. + */ + AV_PKT_DATA_DISPLAYMATRIX, + + /** + * This side data should be associated with a video stream and contains + * Stereoscopic 3D information in form of the AVStereo3D struct. + */ + AV_PKT_DATA_STEREO3D, +}; + +typedef struct AVPacketSideData { + uint8_t *data; + int size; + enum AVPacketSideDataType type; +} AVPacketSideData; + +/** + * This structure stores compressed data. It is typically exported by demuxers + * and then passed as input to decoders, or received as output from encoders and + * then passed to muxers. + * + * For video, it should typically contain one compressed frame. For audio it may + * contain several compressed frames. + * + * AVPacket is one of the few structs in Libav, whose size is a part of public + * ABI. Thus it may be allocated on stack and no new fields can be added to it + * without libavcodec and libavformat major bump. + * + * The semantics of data ownership depends on the buf or destruct (deprecated) + * fields. If either is set, the packet data is dynamically allocated and is + * valid indefinitely until av_free_packet() is called (which in turn calls + * av_buffer_unref()/the destruct callback to free the data). If neither is set, + * the packet data is typically backed by some static buffer somewhere and is + * only valid for a limited time (e.g. until the next read call when demuxing). + * + * The side data is always allocated with av_malloc() and is freed in + * av_free_packet(). + */ +typedef struct AVPacket { + /** + * A reference to the reference-counted buffer where the packet data is + * stored. + * May be NULL, then the packet data is not reference-counted. + */ + AVBufferRef *buf; + /** + * Presentation timestamp in AVStream->time_base units; the time at which + * the decompressed packet will be presented to the user. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + * pts MUST be larger or equal to dts as presentation cannot happen before + * decompression, unless one wants to view hex dumps. Some formats misuse + * the terms dts and pts/cts to mean something different. Such timestamps + * must be converted to true pts/dts before they are stored in AVPacket. + */ + int64_t pts; + /** + * Decompression timestamp in AVStream->time_base units; the time at which + * the packet is decompressed. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + */ + int64_t dts; + uint8_t *data; + int size; + int stream_index; + /** + * A combination of AV_PKT_FLAG values + */ + int flags; + /** + * Additional packet data that can be provided by the container. + * Packet can contain several types of side information. + */ + AVPacketSideData *side_data; + int side_data_elems; + + /** + * Duration of this packet in AVStream->time_base units, 0 if unknown. + * Equals next_pts - this_pts in presentation order. + */ + int duration; +#if FF_API_DESTRUCT_PACKET + attribute_deprecated + void (*destruct)(struct AVPacket *); + attribute_deprecated + void *priv; +#endif + int64_t pos; ///< byte position in stream, -1 if unknown + + /** + * Time difference in AVStream->time_base units from the pts of this + * packet to the point at which the output from the decoder has converged + * independent from the availability of previous frames. That is, the + * frames are virtually identical no matter if decoding started from + * the very first frame or from this keyframe. + * Is AV_NOPTS_VALUE if unknown. + * This field is not the display duration of the current packet. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. + * + * The purpose of this field is to allow seeking in streams that have no + * keyframes in the conventional sense. It corresponds to the + * recovery point SEI in H.264 and match_time_delta in NUT. It is also + * essential for some types of subtitle streams to ensure that all + * subtitles are correctly displayed after seeking. + */ + int64_t convergence_duration; +} AVPacket; +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted + +enum AVSideDataParamChangeFlags { + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, +}; +/** + * @} + */ + +struct AVCodecInternal; + +enum AVFieldOrder { + AV_FIELD_UNKNOWN, + AV_FIELD_PROGRESSIVE, + AV_FIELD_TT, //< Top coded_first, top displayed first + AV_FIELD_BB, //< Bottom coded first, bottom displayed first + AV_FIELD_TB, //< Top coded first, bottom displayed first + AV_FIELD_BT, //< Bottom coded first, top displayed first +}; + +/** + * main external API structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVCodecContext) must not be used outside libav*. + */ +typedef struct AVCodecContext { + /** + * information on struct for av_log + * - set by avcodec_alloc_context3 + */ + const AVClass *av_class; + int log_level_offset; + + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ + const struct AVCodec *codec; +#if FF_API_CODEC_NAME + /** + * @deprecated this field is not used for anything in libavcodec + */ + attribute_deprecated + char codec_name[32]; +#endif + enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ + + /** + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * A demuxer should set this to what is stored in the field used to identify the codec. + * If there are multiple such fields in a container then the demuxer should choose the one + * which maximizes the information about the used codec. + * If the codec tag field in a container is larger than 32 bits then the demuxer should + * remap the longer ID to 32 bits with a table or other structure. Alternatively a new + * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated + * first. + * - encoding: Set by user, if not then the default based on codec_id will be used. + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + */ + unsigned int codec_tag; + + /** + * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * - encoding: unused + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + */ + unsigned int stream_codec_tag; + + void *priv_data; + + /** + * Private context used for internal data. + * + * Unlike priv_data, this is not codec-specific. It is used in general + * libavcodec functions. + */ + struct AVCodecInternal *internal; + + /** + * Private data of the user, can be used to carry app specific stuff. + * - encoding: Set by user. + * - decoding: Set by user. + */ + void *opaque; + + /** + * the average bitrate + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream. + */ + int bit_rate; + + /** + * number of bits the bitstream is allowed to diverge from the reference. + * the reference can be CBR (for CBR pass1) or VBR (for pass2) + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: unused + */ + int bit_rate_tolerance; + + /** + * Global quality for codecs which cannot change it per frame. + * This should be proportional to MPEG-1/2/4 qscale. + * - encoding: Set by user. + * - decoding: unused + */ + int global_quality; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int compression_level; +#define FF_COMPRESSION_DEFAULT -1 + + /** + * CODEC_FLAG_*. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags; + + /** + * CODEC_FLAG2_* + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags2; + + /** + * some codecs need / can use extradata like Huffman tables. + * mjpeg: Huffman tables + * rv10: additional flags + * mpeg4: global headers (they can be in the bitstream or here) + * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * than extradata_size to avoid prolems if it is read with the bitstream reader. + * The bytewise contents of extradata must not depend on the architecture or CPU endianness. + * - encoding: Set/allocated/freed by libavcodec. + * - decoding: Set/allocated/freed by user. + */ + uint8_t *extradata; + int extradata_size; + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. For fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. + * - encoding: MUST be set by user. + * - decoding: Set by libavcodec. + */ + AVRational time_base; + + /** + * For some codecs, the time base is closer to the field rate than the frame rate. + * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration + * if no telecine is used ... + * + * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. + */ + int ticks_per_frame; + + /** + * Codec delay. + * + * Video: + * Number of frames the decoded output will be delayed relative to the + * encoded input. + * + * Audio: + * For encoding, this is the number of "priming" samples added by the + * encoder to the beginning of the stream. The decoded output will be + * delayed by this many samples relative to the input to the encoder (or + * more, if the decoder adds its own padding). + * The timestamps on the output packets are adjusted by the encoder so + * that they always refer to the first sample of the data actually + * contained in the packet, including any added padding. + * E.g. if the timebase is 1/samplerate and the timestamp of the first + * input sample is 0, the timestamp of the first output packet will be + * -delay. + * + * For decoding, this is the number of samples the decoder needs to + * output before the decoder's output is valid. When seeking, you should + * start decoding this many samples prior to your desired seek point. + * + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int delay; + + + /* video only */ + /** + * picture width / height. + * - encoding: MUST be set by user. + * - decoding: May be set by the user before opening the decoder if known e.g. + * from the container. Some decoders will require the dimensions + * to be set by the caller. During decoding, the decoder may + * overwrite those values as required. + */ + int width, height; + + /** + * Bitstream width / height, may be different from width/height e.g. when + * the decoded frame is cropped before being output. + * - encoding: unused + * - decoding: May be set by the user before opening the decoder if known + * e.g. from the container. During decoding, the decoder may + * overwrite those values as required. + */ + int coded_width, coded_height; + +#if FF_API_ASPECT_EXTENDED +#define FF_ASPECT_EXTENDED 15 +#endif + + /** + * the number of pictures in a group of pictures, or 0 for intra_only + * - encoding: Set by user. + * - decoding: unused + */ + int gop_size; + + /** + * Pixel format, see AV_PIX_FMT_xxx. + * May be set by the demuxer if known from headers. + * May be overriden by the decoder if it knows better. + * - encoding: Set by user. + * - decoding: Set by user if known, overridden by libavcodec if known + */ + enum AVPixelFormat pix_fmt; + + /** + * Motion estimation algorithm used for video coding. + * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), + * 8 (umh), 10 (tesa) [7, 8, 10 are x264 specific] + * - encoding: MUST be set by user. + * - decoding: unused + */ + int me_method; + + /** + * If non NULL, 'draw_horiz_band' is called by the libavcodec + * decoder to draw a horizontal band. It improves cache usage. Not + * all codecs can do that. You must check the codec capabilities + * beforehand. + * When multithreading is used, it may be called from multiple threads + * at the same time; threads might draw different parts of the same AVFrame, + * or multiple AVFrames, and there is no guarantee that slices will be drawn + * in order. + * The function is also used by hardware acceleration APIs. + * It is called at least once during frame decoding to pass + * the data needed for hardware render. + * In that mode instead of pixel data, AVFrame points to + * a structure specific to the acceleration API. The application + * reads the structure and can change some fields to indicate progress + * or mark state. + * - encoding: unused + * - decoding: Set by user. + * @param height the height of the slice + * @param y the y position of the slice + * @param type 1->top field, 2->bottom field, 3->frame + * @param offset offset into the AVFrame.data from which the slice should be read + */ + void (*draw_horiz_band)(struct AVCodecContext *s, + const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], + int y, int type, int height); + + /** + * callback to negotiate the pixelFormat + * @param fmt is the list of formats which are supported by the codec, + * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. + * The first is always the native one. + * @return the chosen format + * - encoding: unused + * - decoding: Set by user, if not set the native format will be chosen. + */ + enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); + + /** + * maximum number of B-frames between non-B-frames + * Note: The output will be delayed by max_b_frames+1 relative to the input. + * - encoding: Set by user. + * - decoding: unused + */ + int max_b_frames; + + /** + * qscale factor between IP and B-frames + * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_factor; + + /** obsolete FIXME remove */ + int rc_strategy; +#define FF_RC_STRATEGY_XVID 1 + + int b_frame_strategy; + + /** + * qscale offset between IP and B-frames + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_offset; + + /** + * Size of the frame reordering buffer in the decoder. + * For MPEG-2 it is 1 IPB or 0 low delay IP. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int has_b_frames; + + /** + * 0-> h263 quant 1-> mpeg quant + * - encoding: Set by user. + * - decoding: unused + */ + int mpeg_quant; + + /** + * qscale factor between P and I-frames + * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_factor; + + /** + * qscale offset between P and I-frames + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_offset; + + /** + * luminance masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float lumi_masking; + + /** + * temporary complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float temporal_cplx_masking; + + /** + * spatial complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float spatial_cplx_masking; + + /** + * p block masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float p_masking; + + /** + * darkness masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float dark_masking; + + /** + * slice count + * - encoding: Set by libavcodec. + * - decoding: Set by user (or 0). + */ + int slice_count; + /** + * prediction method (needed for huffyuv) + * - encoding: Set by user. + * - decoding: unused + */ + int prediction_method; +#define FF_PRED_LEFT 0 +#define FF_PRED_PLANE 1 +#define FF_PRED_MEDIAN 2 + + /** + * slice offsets in the frame in bytes + * - encoding: Set/allocated by libavcodec. + * - decoding: Set/allocated by user (or NULL). + */ + int *slice_offset; + + /** + * sample aspect ratio (0 if unknown) + * That is the width of a pixel divided by the height of the pixel. + * Numerator and denominator must be relatively prime and smaller than 256 for some video standards. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVRational sample_aspect_ratio; + + /** + * motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_cmp; + /** + * subpixel motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_sub_cmp; + /** + * macroblock comparison function (not supported yet) + * - encoding: Set by user. + * - decoding: unused + */ + int mb_cmp; + /** + * interlaced DCT comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int ildct_cmp; +#define FF_CMP_SAD 0 +#define FF_CMP_SSE 1 +#define FF_CMP_SATD 2 +#define FF_CMP_DCT 3 +#define FF_CMP_PSNR 4 +#define FF_CMP_BIT 5 +#define FF_CMP_RD 6 +#define FF_CMP_ZERO 7 +#define FF_CMP_VSAD 8 +#define FF_CMP_VSSE 9 +#define FF_CMP_NSSE 10 +#define FF_CMP_DCTMAX 13 +#define FF_CMP_DCT264 14 +#define FF_CMP_CHROMA 256 + + /** + * ME diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int dia_size; + + /** + * amount of previous MV predictors (2a+1 x 2a+1 square) + * - encoding: Set by user. + * - decoding: unused + */ + int last_predictor_count; + + /** + * prepass for motion estimation + * - encoding: Set by user. + * - decoding: unused + */ + int pre_me; + + /** + * motion estimation prepass comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_pre_cmp; + + /** + * ME prepass diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int pre_dia_size; + + /** + * subpel ME quality + * - encoding: Set by user. + * - decoding: unused + */ + int me_subpel_quality; + +#if FF_API_AFD + /** + * DTG active format information (additional aspect ratio + * information only used in DVB MPEG-2 transport streams) + * 0 if not set. + * + * - encoding: unused + * - decoding: Set by decoder. + * @deprecated Deprecated in favor of AVSideData + */ + attribute_deprecated int dtg_active_format; +#define FF_DTG_AFD_SAME 8 +#define FF_DTG_AFD_4_3 9 +#define FF_DTG_AFD_16_9 10 +#define FF_DTG_AFD_14_9 11 +#define FF_DTG_AFD_4_3_SP_14_9 13 +#define FF_DTG_AFD_16_9_SP_14_9 14 +#define FF_DTG_AFD_SP_4_3 15 +#endif /* FF_API_AFD */ + + /** + * maximum motion estimation search range in subpel units + * If 0 then no limit. + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_range; + + /** + * intra quantizer bias + * - encoding: Set by user. + * - decoding: unused + */ + int intra_quant_bias; +#define FF_DEFAULT_QUANT_BIAS 999999 + + /** + * inter quantizer bias + * - encoding: Set by user. + * - decoding: unused + */ + int inter_quant_bias; + + /** + * slice flags + * - encoding: unused + * - decoding: Set by user. + */ + int slice_flags; +#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display +#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics) +#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + +#if FF_API_XVMC + /** + * XVideo Motion Acceleration + * - encoding: forbidden + * - decoding: set by decoder + * @deprecated XvMC support is slated for removal. + */ + attribute_deprecated int xvmc_acceleration; +#endif /* FF_API_XVMC */ + + /** + * macroblock decision mode + * - encoding: Set by user. + * - decoding: unused + */ + int mb_decision; +#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp +#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits +#define FF_MB_DECISION_RD 2 ///< rate distortion + + /** + * custom intra quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + */ + uint16_t *intra_matrix; + + /** + * custom inter quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + */ + uint16_t *inter_matrix; + + /** + * scene change detection threshold + * 0 is default, larger means fewer detected scene changes. + * - encoding: Set by user. + * - decoding: unused + */ + int scenechange_threshold; + + /** + * noise reduction strength + * - encoding: Set by user. + * - decoding: unused + */ + int noise_reduction; + + /** + * Motion estimation threshold below which no motion estimation is + * performed, but instead the user specified motion vectors are used. + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_threshold; + + /** + * Macroblock threshold below which the user specified macroblock types will be used. + * - encoding: Set by user. + * - decoding: unused + */ + int mb_threshold; + + /** + * precision of the intra DC coefficient - 8 + * - encoding: Set by user. + * - decoding: unused + */ + int intra_dc_precision; + + /** + * Number of macroblock rows at the top which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_top; + + /** + * Number of macroblock rows at the bottom which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_bottom; + + /** + * Border processing masking, raises the quantizer for mbs on the borders + * of the picture. + * - encoding: Set by user. + * - decoding: unused + */ + float border_masking; + + /** + * minimum MB lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmin; + + /** + * maximum MB lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmax; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_penalty_compensation; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int bidir_refine; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int brd_scale; + + /** + * minimum GOP size + * - encoding: Set by user. + * - decoding: unused + */ + int keyint_min; + + /** + * number of reference frames + * - encoding: Set by user. + * - decoding: Set by lavc. + */ + int refs; + + /** + * chroma qp offset from luma + * - encoding: Set by user. + * - decoding: unused + */ + int chromaoffset; + +#if FF_API_UNUSED_MEMBERS + /** + * Multiplied by qscale for each frame and added to scene_change_score. + * - encoding: Set by user. + * - decoding: unused + */ + attribute_deprecated int scenechange_factor; +#endif + + /** + * + * Note: Value depends upon the compare function used for fullpel ME. + * - encoding: Set by user. + * - decoding: unused + */ + int mv0_threshold; + + /** + * Adjust sensitivity of b_frame_strategy 1. + * - encoding: Set by user. + * - decoding: unused + */ + int b_sensitivity; + + /** + * Chromaticity coordinates of the source primaries. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorPrimaries color_primaries; + + /** + * Color Transfer Characteristic. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorTransferCharacteristic color_trc; + + /** + * YUV colorspace type. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + /** + * MPEG vs JPEG YUV range. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorRange color_range; + + /** + * This defines the location of chroma samples. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVChromaLocation chroma_sample_location; + + /** + * Number of slices. + * Indicates number of picture subdivisions. Used for parallelized + * decoding. + * - encoding: Set by user + * - decoding: unused + */ + int slices; + + /** Field order + * - encoding: set by libavcodec + * - decoding: Set by libavcodec + */ + enum AVFieldOrder field_order; + + /* audio only */ + int sample_rate; ///< samples per second + int channels; ///< number of audio channels + + /** + * audio sample format + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVSampleFormat sample_fmt; ///< sample format + + /* The following data should not be initialized. */ + /** + * Number of samples per channel in an audio frame. + * + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame + * except the last must contain exactly frame_size samples per channel. + * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the + * frame size is not restricted. + * - decoding: may be set by some decoders to indicate constant frame size + */ + int frame_size; + + /** + * Frame counter, set by libavcodec. + * + * - decoding: total number of frames returned from the decoder so far. + * - encoding: total number of frames passed to the encoder so far. + * + * @note the counter is not incremented if encoding/decoding resulted in + * an error. + */ + int frame_number; + + /** + * number of bytes per packet if constant and known or 0 + * Used by some WAV based audio codecs. + */ + int block_align; + + /** + * Audio cutoff bandwidth (0 means "automatic") + * - encoding: Set by user. + * - decoding: unused + */ + int cutoff; + +#if FF_API_REQUEST_CHANNELS + /** + * Decoder should decode to this many channels if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + * @deprecated Deprecated in favor of request_channel_layout. + */ + attribute_deprecated int request_channels; +#endif + + /** + * Audio channel layout. + * - encoding: set by user. + * - decoding: set by libavcodec. + */ + uint64_t channel_layout; + + /** + * Request decoder to use this channel layout if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + */ + uint64_t request_channel_layout; + + /** + * Type of service that the audio stream conveys. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVAudioServiceType audio_service_type; + + /** + * Used to request a sample format from the decoder. + * - encoding: unused. + * - decoding: Set by user. + */ + enum AVSampleFormat request_sample_fmt; + +#if FF_API_GET_BUFFER + /** + * Called at the beginning of each frame to get a buffer for it. + * + * The function will set AVFrame.data[], AVFrame.linesize[]. + * AVFrame.extended_data[] must also be set, but it should be the same as + * AVFrame.data[] except for planar audio with more channels than can fit + * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as + * many data pointers as it can hold. + * + * if CODEC_CAP_DR1 is not set then get_buffer() must call + * avcodec_default_get_buffer() instead of providing buffers allocated by + * some other means. + * + * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't + * need it. avcodec_default_get_buffer() aligns the output buffer properly, + * but if get_buffer() is overridden then alignment considerations should + * be taken into account. + * + * @see avcodec_default_get_buffer() + * + * Video: + * + * If pic.reference is set then the frame will be read later by libavcodec. + * avcodec_align_dimensions2() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * + * If frame multithreading is used and thread_safe_callbacks is set, + * it may be called from a different thread, but not from more than one at + * once. Does not need to be reentrant. + * + * @see release_buffer(), reget_buffer() + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * Decoders cannot use the buffer after returning from + * avcodec_decode_audio4(), so they will not call release_buffer(), as it + * is assumed to be released immediately upon return. In some rare cases, + * a decoder may need to call get_buffer() more than once in a single + * call to avcodec_decode_audio4(). In that case, when get_buffer() is + * called again after it has already been called once, the previously + * acquired buffer is assumed to be released at that time and may not be + * reused by the decoder. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer() + * functions to find the required data size and to fill data pointers and + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio + * since all planes must be the same size. + * + * @see av_samples_get_buffer_size(), av_samples_fill_arrays() + * + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + * + * @deprecated use get_buffer2() + */ + attribute_deprecated + int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); + + /** + * Called to release buffers which were allocated with get_buffer. + * A released buffer can be reused in get_buffer(). + * pic.data[*] must be set to NULL. + * May be called from a different thread if frame multithreading is used, + * but not by more than one thread at once, so does not need to be reentrant. + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + * + * @deprecated custom freeing callbacks should be set from get_buffer2() + */ + attribute_deprecated + void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); + + /** + * Called at the beginning of a frame to get cr buffer for it. + * Buffer type (size, hints) must be the same. libavcodec won't check it. + * libavcodec will pass previous buffer in pic, function should return + * same buffer or new buffer with old frame "painted" into it. + * If pic.data[0] == NULL must behave like get_buffer(). + * if CODEC_CAP_DR1 is not set then reget_buffer() must call + * avcodec_default_reget_buffer() instead of providing buffers allocated by + * some other means. + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + attribute_deprecated + int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); +#endif + + /** + * This callback is called at the beginning of each frame to get data + * buffer(s) for it. There may be one contiguous buffer for all the data or + * there may be a buffer per each data plane or anything in between. What + * this means is, you may set however many entries in buf[] you feel necessary. + * Each buffer must be reference-counted using the AVBuffer API (see description + * of buf[] below). + * + * The following fields will be set in the frame before this callback is + * called: + * - format + * - width, height (video only) + * - sample_rate, channel_layout, nb_samples (audio only) + * Their values may differ from the corresponding values in + * AVCodecContext. This callback must use the frame values, not the codec + * context values, to calculate the required buffer size. + * + * This callback must fill the following fields in the frame: + * - data[] + * - linesize[] + * - extended_data: + * * if the data is planar audio with more than 8 channels, then this + * callback must allocate and fill extended_data to contain all pointers + * to all data planes. data[] must hold as many pointers as it can. + * extended_data must be allocated with av_malloc() and will be freed in + * av_frame_unref(). + * * otherwise exended_data must point to data + * - buf[] must contain one or more pointers to AVBufferRef structures. Each of + * the frame's data and extended_data pointers must be contained in these. That + * is, one AVBufferRef for each allocated chunk of memory, not necessarily one + * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(), + * and av_buffer_ref(). + * - extended_buf and nb_extended_buf must be allocated with av_malloc() by + * this callback and filled with the extra buffers if there are more + * buffers than buf[] can hold. extended_buf will be freed in + * av_frame_unref(). + * + * If CODEC_CAP_DR1 is not set then get_buffer2() must call + * avcodec_default_get_buffer2() instead of providing buffers allocated by + * some other means. + * + * Each data plane must be aligned to the maximum required by the target + * CPU. + * + * @see avcodec_default_get_buffer2() + * + * Video: + * + * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused + * (read and/or written to if it is writable) later by libavcodec. + * + * avcodec_align_dimensions2() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * + * If frame multithreading is used and thread_safe_callbacks is set, + * this callback may be called from a different thread, but not from more + * than one at once. Does not need to be reentrant. + * + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2() + * functions to find the required data size and to fill data pointers and + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio + * since all planes must be the same size. + * + * @see av_samples_get_buffer_size(), av_samples_fill_arrays() + * + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); + + /** + * If non-zero, the decoded audio and video frames returned from + * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted + * and are valid indefinitely. The caller must free them with + * av_frame_unref() when they are not needed anymore. + * Otherwise, the decoded frames must not be freed by the caller and are + * only valid until the next decode call. + * + * - encoding: unused + * - decoding: set by the caller before avcodec_open2(). + */ + int refcounted_frames; + + /* - encoding parameters */ + float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + float qblur; ///< amount of qscale smoothing over time (0.0-1.0) + + /** + * minimum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmin; + + /** + * maximum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmax; + + /** + * maximum quantizer difference between frames + * - encoding: Set by user. + * - decoding: unused + */ + int max_qdiff; + + /** + * ratecontrol qmin qmax limiting method + * 0-> clipping, 1-> use a nice continuous function to limit qscale wthin qmin/qmax. + * - encoding: Set by user. + * - decoding: unused + */ + float rc_qsquish; + + float rc_qmod_amp; + int rc_qmod_freq; + + /** + * decoder bitstream buffer size + * - encoding: Set by user. + * - decoding: unused + */ + int rc_buffer_size; + + /** + * ratecontrol override, see RcOverride + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + int rc_override_count; + RcOverride *rc_override; + + /** + * rate control equation + * - encoding: Set by user + * - decoding: unused + */ + const char *rc_eq; + + /** + * maximum bitrate + * - encoding: Set by user. + * - decoding: unused + */ + int rc_max_rate; + + /** + * minimum bitrate + * - encoding: Set by user. + * - decoding: unused + */ + int rc_min_rate; + + float rc_buffer_aggressivity; + + /** + * initial complexity for pass1 ratecontrol + * - encoding: Set by user. + * - decoding: unused + */ + float rc_initial_cplx; + + /** + * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_max_available_vbv_use; + + /** + * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_min_vbv_overflow_use; + + /** + * Number of bits which should be loaded into the rc buffer before decoding starts. + * - encoding: Set by user. + * - decoding: unused + */ + int rc_initial_buffer_occupancy; + +#define FF_CODER_TYPE_VLC 0 +#define FF_CODER_TYPE_AC 1 +#define FF_CODER_TYPE_RAW 2 +#define FF_CODER_TYPE_RLE 3 +#if FF_API_UNUSED_MEMBERS +#define FF_CODER_TYPE_DEFLATE 4 +#endif /* FF_API_UNUSED_MEMBERS */ + /** + * coder type + * - encoding: Set by user. + * - decoding: unused + */ + int coder_type; + + /** + * context model + * - encoding: Set by user. + * - decoding: unused + */ + int context_model; + + /** + * minimum Lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int lmin; + + /** + * maximum Lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int lmax; + + /** + * frame skip threshold + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_threshold; + + /** + * frame skip factor + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_factor; + + /** + * frame skip exponent + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_exp; + + /** + * frame skip comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_cmp; + + /** + * trellis RD quantization + * - encoding: Set by user. + * - decoding: unused + */ + int trellis; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int min_prediction_order; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int max_prediction_order; + + /** + * GOP timecode frame start number, in non drop frame format + * - encoding: Set by user. + * - decoding: unused + */ + int64_t timecode_frame_start; + + /* The RTP callback: This function is called */ + /* every time the encoder has a packet to send. */ + /* It depends on the encoder if the data starts */ + /* with a Start Code (it should). H.263 does. */ + /* mb_nb contains the number of macroblocks */ + /* encoded in the RTP payload. */ + void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); + + int rtp_payload_size; /* The size of the RTP payload: the coder will */ + /* do its best to deliver a chunk with size */ + /* below rtp_payload_size, the chunk will start */ + /* with a start code on some codecs like H.263. */ + /* This doesn't take account of any particular */ + /* headers inside the transmitted RTP payload. */ + + /* statistics, used for 2-pass encoding */ + int mv_bits; + int header_bits; + int i_tex_bits; + int p_tex_bits; + int i_count; + int p_count; + int skip_count; + int misc_bits; + + /** + * number of bits used for the previously encoded frame + * - encoding: Set by libavcodec. + * - decoding: unused + */ + int frame_bits; + + /** + * pass1 encoding statistics output buffer + * - encoding: Set by libavcodec. + * - decoding: unused + */ + char *stats_out; + + /** + * pass2 encoding statistics input buffer + * Concatenated stuff from stats_out of pass1 should be placed here. + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + char *stats_in; + + /** + * Work around bugs in encoders which sometimes cannot be detected automatically. + * - encoding: Set by user + * - decoding: Set by user + */ + int workaround_bugs; +#define FF_BUG_AUTODETECT 1 ///< autodetection +#if FF_API_OLD_MSMPEG4 +#define FF_BUG_OLD_MSMPEG4 2 +#endif +#define FF_BUG_XVID_ILACE 4 +#define FF_BUG_UMP4 8 +#define FF_BUG_NO_PADDING 16 +#define FF_BUG_AMV 32 +#if FF_API_AC_VLC +#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default. +#endif +#define FF_BUG_QPEL_CHROMA 64 +#define FF_BUG_STD_QPEL 128 +#define FF_BUG_QPEL_CHROMA2 256 +#define FF_BUG_DIRECT_BLOCKSIZE 512 +#define FF_BUG_EDGE 1024 +#define FF_BUG_HPEL_CHROMA 2048 +#define FF_BUG_DC_CLIP 4096 +#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. +#define FF_BUG_TRUNCATED 16384 + + /** + * strictly follow the standard (MPEG4, ...). + * - encoding: Set by user. + * - decoding: Set by user. + * Setting this to STRICT or higher means the encoder and decoder will + * generally do stupid things, whereas setting it to unofficial or lower + * will mean the encoder might produce output that is not supported by all + * spec-compliant decoders. Decoders don't differentiate between normal, + * unofficial and experimental (that is, they always try to decode things + * when they can) unless they are explicitly asked to behave stupidly + * (=strictly conform to the specs) + */ + int strict_std_compliance; +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. +#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. +#define FF_COMPLIANCE_NORMAL 0 +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. + + /** + * error concealment flags + * - encoding: unused + * - decoding: Set by user. + */ + int error_concealment; +#define FF_EC_GUESS_MVS 1 +#define FF_EC_DEBLOCK 2 + + /** + * debug + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug; +#define FF_DEBUG_PICT_INFO 1 +#define FF_DEBUG_RC 2 +#define FF_DEBUG_BITSTREAM 4 +#define FF_DEBUG_MB_TYPE 8 +#define FF_DEBUG_QP 16 +#if FF_API_DEBUG_MV +/** + * @deprecated this option does nothing + */ +#define FF_DEBUG_MV 32 +#endif +#define FF_DEBUG_DCT_COEFF 0x00000040 +#define FF_DEBUG_SKIP 0x00000080 +#define FF_DEBUG_STARTCODE 0x00000100 +#if FF_API_UNUSED_MEMBERS +#define FF_DEBUG_PTS 0x00000200 +#endif /* FF_API_UNUSED_MEMBERS */ +#define FF_DEBUG_ER 0x00000400 +#define FF_DEBUG_MMCO 0x00000800 +#define FF_DEBUG_BUGS 0x00001000 +#if FF_API_DEBUG_MV +#define FF_DEBUG_VIS_QP 0x00002000 +#define FF_DEBUG_VIS_MB_TYPE 0x00004000 +#endif +#define FF_DEBUG_BUFFERS 0x00008000 +#define FF_DEBUG_THREADS 0x00010000 + +#if FF_API_DEBUG_MV + /** + * @deprecated this option does not have any effect + */ + attribute_deprecated + int debug_mv; +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames +#endif + + /** + * Error recognition; may misdetect some more or less valid parts as errors. + * - encoding: unused + * - decoding: Set by user. + */ + int err_recognition; + +/** + * Verify checksums embedded in the bitstream (could be of either encoded or + * decoded data, depending on the codec) and print an error message on mismatch. + * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the + * decoder returning an error. + */ +#define AV_EF_CRCCHECK (1<<0) +#define AV_EF_BITSTREAM (1<<1) +#define AV_EF_BUFFER (1<<2) +#define AV_EF_EXPLODE (1<<3) + + /** + * opaque 64bit number (generally a PTS) that will be reordered and + * output in AVFrame.reordered_opaque + * - encoding: unused + * - decoding: Set by user. + */ + int64_t reordered_opaque; + + /** + * Hardware accelerator in use + * - encoding: unused. + * - decoding: Set by libavcodec + */ + struct AVHWAccel *hwaccel; + + /** + * Hardware accelerator context. + * For some hardware accelerators, a global context needs to be + * provided by the user. In that case, this holds display-dependent + * data Libav cannot instantiate itself. Please refer to the + * Libav HW accelerator documentation to know how to fill this + * is. e.g. for VA API, this is a struct vaapi_context. + * - encoding: unused + * - decoding: Set by user + */ + void *hwaccel_context; + + /** + * error + * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR. + * - decoding: unused + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + + /** + * DCT algorithm, see FF_DCT_* below + * - encoding: Set by user. + * - decoding: unused + */ + int dct_algo; +#define FF_DCT_AUTO 0 +#define FF_DCT_FASTINT 1 +#if FF_API_UNUSED_MEMBERS +#define FF_DCT_INT 2 +#endif /* FF_API_UNUSED_MEMBERS */ +#define FF_DCT_MMX 3 +#define FF_DCT_ALTIVEC 5 +#define FF_DCT_FAAN 6 + + /** + * IDCT algorithm, see FF_IDCT_* below. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int idct_algo; +#define FF_IDCT_AUTO 0 +#define FF_IDCT_INT 1 +#define FF_IDCT_SIMPLE 2 +#define FF_IDCT_SIMPLEMMX 3 +#define FF_IDCT_ARM 7 +#define FF_IDCT_ALTIVEC 8 +#if FF_API_ARCH_SH4 +#define FF_IDCT_SH4 9 +#endif +#define FF_IDCT_SIMPLEARM 10 +#if FF_API_UNUSED_MEMBERS +#define FF_IDCT_IPP 13 +#endif /* FF_API_UNUSED_MEMBERS */ +#define FF_IDCT_XVID 14 +#if FF_API_IDCT_XVIDMMX +#define FF_IDCT_XVIDMMX 14 +#endif /* FF_API_IDCT_XVIDMMX */ +#define FF_IDCT_SIMPLEARMV5TE 16 +#define FF_IDCT_SIMPLEARMV6 17 +#if FF_API_ARCH_SPARC +#define FF_IDCT_SIMPLEVIS 18 +#endif +#define FF_IDCT_FAAN 20 +#define FF_IDCT_SIMPLENEON 22 +#if FF_API_ARCH_ALPHA +#define FF_IDCT_SIMPLEALPHA 23 +#endif + + /** + * bits per sample/pixel from the demuxer (needed for huffyuv). + * - encoding: Set by libavcodec. + * - decoding: Set by user. + */ + int bits_per_coded_sample; + + /** + * Bits per sample/pixel of internal libavcodec pixel/sample format. + * - encoding: set by user. + * - decoding: set by libavcodec. + */ + int bits_per_raw_sample; + +#if FF_API_LOWRES + /** + * low resolution decoding, 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: Set by user. + * + * @deprecated use decoder private options instead + */ + attribute_deprecated int lowres; +#endif + + /** + * the picture in the bitstream + * - encoding: Set by libavcodec. + * - decoding: unused + */ + AVFrame *coded_frame; + + /** + * thread count + * is used to decide how many independent tasks should be passed to execute() + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_count; + + /** + * Which multithreading methods to use. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, + * so clients which cannot provide future frames should not use it. + * + * - encoding: Set by user, otherwise the default is used. + * - decoding: Set by user, otherwise the default is used. + */ + int thread_type; +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once +#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once + + /** + * Which multithreading methods are in use by the codec. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int active_thread_type; + + /** + * Set by the client if its custom get_buffer() callback can be called + * synchronously from another thread, which allows faster multithreaded decoding. + * draw_horiz_band() will be called from other threads regardless of this setting. + * Ignored if the default get_buffer() is used. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_safe_callbacks; + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * @param count the number of things to execute + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size); + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * Also see avcodec_thread_init and e.g. the --enable-pthread configure option. + * @param c context passed also to func + * @param count the number of things to execute + * @param arg2 argument passed unchanged to func + * @param ret return values of executed functions, must have space for "count" values. May be NULL. + * @param func function that will be called count times, with jobnr from 0 to count-1. + * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no + * two instances of func executing at the same time will have the same threadnr. + * @return always 0 currently, but code should handle a future improvement where when any call to func + * returns < 0 no further calls to func may be done and < 0 is returned. + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); + +#if FF_API_THREAD_OPAQUE + /** + * @deprecated this field should not be used from outside of lavc + */ + attribute_deprecated + void *thread_opaque; +#endif + + /** + * noise vs. sse weight for the nsse comparsion function + * - encoding: Set by user. + * - decoding: unused + */ + int nsse_weight; + + /** + * profile + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int profile; +#define FF_PROFILE_UNKNOWN -99 +#define FF_PROFILE_RESERVED -100 + +#define FF_PROFILE_AAC_MAIN 0 +#define FF_PROFILE_AAC_LOW 1 +#define FF_PROFILE_AAC_SSR 2 +#define FF_PROFILE_AAC_LTP 3 +#define FF_PROFILE_AAC_HE 4 +#define FF_PROFILE_AAC_HE_V2 28 +#define FF_PROFILE_AAC_LD 22 +#define FF_PROFILE_AAC_ELD 38 +#define FF_PROFILE_MPEG2_AAC_LOW 128 +#define FF_PROFILE_MPEG2_AAC_HE 131 + +#define FF_PROFILE_DTS 20 +#define FF_PROFILE_DTS_ES 30 +#define FF_PROFILE_DTS_96_24 40 +#define FF_PROFILE_DTS_HD_HRA 50 +#define FF_PROFILE_DTS_HD_MA 60 + +#define FF_PROFILE_MPEG2_422 0 +#define FF_PROFILE_MPEG2_HIGH 1 +#define FF_PROFILE_MPEG2_SS 2 +#define FF_PROFILE_MPEG2_SNR_SCALABLE 3 +#define FF_PROFILE_MPEG2_MAIN 4 +#define FF_PROFILE_MPEG2_SIMPLE 5 + +#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag +#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag + +#define FF_PROFILE_H264_BASELINE 66 +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) +#define FF_PROFILE_H264_MAIN 77 +#define FF_PROFILE_H264_EXTENDED 88 +#define FF_PROFILE_H264_HIGH 100 +#define FF_PROFILE_H264_HIGH_10 110 +#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_422 122 +#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_444 144 +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 +#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_CAVLC_444 44 + +#define FF_PROFILE_VC1_SIMPLE 0 +#define FF_PROFILE_VC1_MAIN 1 +#define FF_PROFILE_VC1_COMPLEX 2 +#define FF_PROFILE_VC1_ADVANCED 3 + +#define FF_PROFILE_MPEG4_SIMPLE 0 +#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1 +#define FF_PROFILE_MPEG4_CORE 2 +#define FF_PROFILE_MPEG4_MAIN 3 +#define FF_PROFILE_MPEG4_N_BIT 4 +#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5 +#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6 +#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7 +#define FF_PROFILE_MPEG4_HYBRID 8 +#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9 +#define FF_PROFILE_MPEG4_CORE_SCALABLE 10 +#define FF_PROFILE_MPEG4_ADVANCED_CODING 11 +#define FF_PROFILE_MPEG4_ADVANCED_CORE 12 +#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13 +#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14 +#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15 + +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 0 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 1 +#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 2 +#define FF_PROFILE_JPEG2000_DCINEMA_2K 3 +#define FF_PROFILE_JPEG2000_DCINEMA_4K 4 + + +#define FF_PROFILE_HEVC_MAIN 1 +#define FF_PROFILE_HEVC_MAIN_10 2 +#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 + + /** + * level + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int level; +#define FF_LEVEL_UNKNOWN -99 + + /** + * + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_loop_filter; + + /** + * + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_idct; + + /** + * + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_frame; + + /** + * Header containing style information for text subtitles. + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS + * [Script Info] and [V4+ Styles] section, plus the [Events] line and + * the Format line following. It shouldn't include any Dialogue line. + * - encoding: Set/allocated/freed by user (before avcodec_open2()) + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2()) + */ + uint8_t *subtitle_header; + int subtitle_header_size; + +#if FF_API_ERROR_RATE + /** + * @deprecated use the 'error_rate' private AVOption of the mpegvideo + * encoders + */ + attribute_deprecated + int error_rate; +#endif + +#if FF_API_CODEC_PKT + /** + * @deprecated this field is not supposed to be accessed from outside lavc + */ + attribute_deprecated + AVPacket *pkt; +#endif + + /** + * VBV delay coded in the last frame (in periods of a 27 MHz clock). + * Used for compliant TS muxing. + * - encoding: Set by libavcodec. + * - decoding: unused. + */ + uint64_t vbv_delay; + + /** + * Encoding only. Allow encoders to output packets that do not contain any + * encoded data, only side data. + * + * Some encoders need to output such packets, e.g. to update some stream + * parameters at the end of encoding. + * + * All callers are strongly recommended to set this option to 1 and update + * their code to deal with such packets, since this behaviour may become + * always enabled in the future (then this option will be deprecated and + * later removed). To avoid ABI issues when this happens, the callers should + * use AVOptions to set this field. + */ + int side_data_only_packets; +} AVCodecContext; + +/** + * AVProfile. + */ +typedef struct AVProfile { + int profile; + const char *name; ///< short name for the profile +} AVProfile; + +typedef struct AVCodecDefault AVCodecDefault; + +struct AVSubtitle; + +/** + * AVCodec. + */ +typedef struct AVCodec { + /** + * Name of the codec implementation. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + * This is the primary way to find a codec from the user perspective. + */ + const char *name; + /** + * Descriptive name for the codec, meant to be more human readable than name. + * You should use the NULL_IF_CONFIG_SMALL() macro to define it. + */ + const char *long_name; + enum AVMediaType type; + enum AVCodecID id; + /** + * Codec capabilities. + * see CODEC_CAP_* + */ + int capabilities; + const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} + const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 + const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 + const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 + const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 +#if FF_API_LOWRES + attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder +#endif + const AVClass *priv_class; ///< AVClass for the private context + const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + int priv_data_size; + struct AVCodec *next; + /** + * @name Frame-level threading support functions + * @{ + */ + /** + * If defined, called on thread contexts when they are created. + * If the codec allocates writable tables in init(), re-allocate them here. + * priv_data will be set to a copy of the original. + */ + int (*init_thread_copy)(AVCodecContext *); + /** + * Copy necessary context variables from a previous thread context to the current one. + * If not defined, the next thread will start automatically; otherwise, the codec + * must call ff_thread_finish_setup(). + * + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. + */ + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); + /** @} */ + + /** + * Private codec-specific defaults. + */ + const AVCodecDefault *defaults; + + /** + * Initialize codec static data, called from avcodec_register(). + */ + void (*init_static_data)(struct AVCodec *codec); + + int (*init)(AVCodecContext *); + int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, + const struct AVSubtitle *sub); + /** + * Encode data to an AVPacket. + * + * @param avctx codec context + * @param avpkt output AVPacket (may contain a user-provided buffer) + * @param[in] frame AVFrame containing the raw data to be encoded + * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a + * non-empty packet was returned in avpkt. + * @return 0 on success, negative error code on failure + */ + int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, + int *got_packet_ptr); + int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt); + int (*close)(AVCodecContext *); + /** + * Flush buffers. + * Will be called when seeking + */ + void (*flush)(AVCodecContext *); +} AVCodec; + +/** + * AVHWAccel. + */ +typedef struct AVHWAccel { + /** + * Name of the hardware accelerated codec. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + */ + const char *name; + + /** + * Type of codec implemented by the hardware accelerator. + * + * See AVMEDIA_TYPE_xxx + */ + enum AVMediaType type; + + /** + * Codec implemented by the hardware accelerator. + * + * See AV_CODEC_ID_xxx + */ + enum AVCodecID id; + + /** + * Supported pixel format. + * + * Only hardware accelerated formats are supported here. + */ + enum AVPixelFormat pix_fmt; + + /** + * Hardware accelerated codec capabilities. + * see FF_HWACCEL_CODEC_CAP_* + */ + int capabilities; + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVHWAccel *next; + + /** + * Allocate a custom buffer + */ + int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame); + + /** + * Called at the beginning of each frame or field picture. + * + * Meaningful frame information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * + * Note that buf can be NULL along with buf_size set to 0. + * Otherwise, this means the whole frame is available at this point. + * + * @param avctx the codec context + * @param buf the frame data buffer base + * @param buf_size the size of the frame in bytes + * @return zero if successful, a negative value otherwise + */ + int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + + /** + * Callback for each slice. + * + * Meaningful slice information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * + * @param avctx the codec context + * @param buf the slice data buffer base + * @param buf_size the size of the slice in bytes + * @return zero if successful, a negative value otherwise + */ + int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + + /** + * Called at the end of each frame or field picture. + * + * The whole picture is parsed at this point and can now be sent + * to the hardware accelerator. This function is mandatory. + * + * @param avctx the codec context + * @return zero if successful, a negative value otherwise + */ + int (*end_frame)(AVCodecContext *avctx); + + /** + * Size of per-frame hardware accelerator private data. + * + * Private data is allocated with av_mallocz() before + * AVCodecContext.get_buffer() and deallocated after + * AVCodecContext.release_buffer(). + */ + int frame_priv_data_size; + + /** + * Initialize the hwaccel private data. + * + * This will be called from ff_get_format(), after hwaccel and + * hwaccel_context are set and the hwaccel private data in AVCodecInternal + * is allocated. + */ + int (*init)(AVCodecContext *avctx); + + /** + * Uninitialize the hwaccel private data. + * + * This will be called from get_format() or avcodec_close(), after hwaccel + * and hwaccel_context are already uninitialized. + */ + int (*uninit)(AVCodecContext *avctx); + + /** + * Size of the private data to allocate in + * AVCodecInternal.hwaccel_priv_data. + */ + int priv_data_size; +} AVHWAccel; + +/** + * @defgroup lavc_picture AVPicture + * + * Functions for working with AVPicture + * @{ + */ + +/** + * four components are given, that's all. + * the last component is alpha + */ +typedef struct AVPicture { + uint8_t *data[AV_NUM_DATA_POINTERS]; + int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line +} AVPicture; + +/** + * @} + */ + +#define AVPALETTE_SIZE 1024 +#define AVPALETTE_COUNT 256 + +enum AVSubtitleType { + SUBTITLE_NONE, + + SUBTITLE_BITMAP, ///< A bitmap, pict will be set + + /** + * Plain text, the text field must be set by the decoder and is + * authoritative. ass and pict fields may contain approximations. + */ + SUBTITLE_TEXT, + + /** + * Formatted text, the ass field must be set by the decoder and is + * authoritative. pict and text fields may contain approximations. + */ + SUBTITLE_ASS, +}; + +#define AV_SUBTITLE_FLAG_FORCED 0x00000001 + +typedef struct AVSubtitleRect { + int x; ///< top left corner of pict, undefined when pict is not set + int y; ///< top left corner of pict, undefined when pict is not set + int w; ///< width of pict, undefined when pict is not set + int h; ///< height of pict, undefined when pict is not set + int nb_colors; ///< number of colors in pict, undefined when pict is not set + + /** + * data+linesize for the bitmap of this subtitle. + * can be set for text/ass as well once they where rendered + */ + AVPicture pict; + enum AVSubtitleType type; + + char *text; ///< 0 terminated plain UTF-8 text + + /** + * 0 terminated ASS/SSA compatible event line. + * The pressentation of this is unaffected by the other values in this + * struct. + */ + char *ass; + int flags; +} AVSubtitleRect; + +typedef struct AVSubtitle { + uint16_t format; /* 0 = graphics */ + uint32_t start_display_time; /* relative to packet pts, in ms */ + uint32_t end_display_time; /* relative to packet pts, in ms */ + unsigned num_rects; + AVSubtitleRect **rects; + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE +} AVSubtitle; + +/** + * If c is NULL, returns the first registered codec, + * if c is non-NULL, returns the next registered codec after c, + * or NULL if c is the last one. + */ +AVCodec *av_codec_next(const AVCodec *c); + +/** + * Return the LIBAVCODEC_VERSION_INT constant. + */ +unsigned avcodec_version(void); + +/** + * Return the libavcodec build-time configuration. + */ +const char *avcodec_configuration(void); + +/** + * Return the libavcodec license. + */ +const char *avcodec_license(void); + +/** + * Register the codec codec and initialize libavcodec. + * + * @warning either this function or avcodec_register_all() must be called + * before any other libavcodec functions. + * + * @see avcodec_register_all() + */ +void avcodec_register(AVCodec *codec); + +/** + * Register all the codecs, parsers and bitstream filters which were enabled at + * configuration time. If you do not call this function you can select exactly + * which formats you want to support, by using the individual registration + * functions. + * + * @see avcodec_register + * @see av_register_codec_parser + * @see av_register_bitstream_filter + */ +void avcodec_register_all(void); + +/** + * Allocate an AVCodecContext and set its fields to default values. The + * resulting struct should be freed with avcodec_free_context(). + * + * @param codec if non-NULL, allocate private data and initialize defaults + * for the given codec. It is illegal to then call avcodec_open2() + * with a different codec. + * If NULL, then the codec-specific defaults won't be initialized, + * which may result in suboptimal default settings (this is + * important mainly for encoders, e.g. libx264). + * + * @return An AVCodecContext filled with default values or NULL on failure. + * @see avcodec_get_context_defaults + */ +AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); + +/** + * Free the codec context and everything associated with it and write NULL to + * the provided pointer. + */ +void avcodec_free_context(AVCodecContext **avctx); + +/** + * Set the fields of the given AVCodecContext to default values corresponding + * to the given codec (defaults may be codec-dependent). + * + * Do not call this function if a non-NULL codec has been passed + * to avcodec_alloc_context3() that allocated this AVCodecContext. + * If codec is non-NULL, it is illegal to call avcodec_open2() with a + * different codec on this AVCodecContext. + */ +int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); + +/** + * Get the AVClass for AVCodecContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_class(void); + +/** + * Copy the settings of the source AVCodecContext into the destination + * AVCodecContext. The resulting destination codec context will be + * unopened, i.e. you are required to call avcodec_open2() before you + * can use this AVCodecContext to decode/encode video/audio data. + * + * @param dest target codec context, should be initialized with + * avcodec_alloc_context3(), but otherwise uninitialized + * @param src source codec context + * @return AVERROR() on error (e.g. memory allocation error), 0 on success + */ +int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); + +#if FF_API_AVFRAME_LAVC +/** + * @deprecated use av_frame_alloc() + */ +attribute_deprecated +AVFrame *avcodec_alloc_frame(void); + +/** + * Set the fields of the given AVFrame to default values. + * + * @param frame The AVFrame of which the fields should be set to default values. + * + * @deprecated use av_frame_unref() + */ +attribute_deprecated +void avcodec_get_frame_defaults(AVFrame *frame); + +/** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. + * + * @param frame frame to be freed. The pointer will be set to NULL. + * + * @warning this function does NOT free the data buffers themselves + * (it does not know how, since they might have been allocated with + * a custom get_buffer()). + * + * @deprecated use av_frame_free() + */ +attribute_deprecated +void avcodec_free_frame(AVFrame **frame); +#endif + +/** + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this + * function the context has to be allocated with avcodec_alloc_context3(). + * + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for + * retrieving a codec. + * + * @warning This function is not thread safe! + * + * @code + * avcodec_register_all(); + * av_dict_set(&opts, "b", "2.5M", 0); + * codec = avcodec_find_decoder(AV_CODEC_ID_H264); + * if (!codec) + * exit(1); + * + * context = avcodec_alloc_context3(codec); + * + * if (avcodec_open2(context, codec, opts) < 0) + * exit(1); + * @endcode + * + * @param avctx The context to initialize. + * @param codec The codec to open this context for. If a non-NULL codec has been + * previously passed to avcodec_alloc_context3() or + * avcodec_get_context_defaults3() for this context, then this + * parameter MUST be either NULL or equal to the previously passed + * codec. + * @param options A dictionary filled with AVCodecContext and codec-private options. + * On return this object will be filled with options that were not found. + * + * @return zero on success, a negative value on error + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), + * av_dict_set(), av_opt_find(). + */ +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); + +/** + * Close a given AVCodecContext and free all the data associated with it + * (but not the AVCodecContext itself). + * + * Calling this function on an AVCodecContext that hasn't been opened will free + * the codec-specific data allocated in avcodec_alloc_context3() / + * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will + * do nothing. + */ +int avcodec_close(AVCodecContext *avctx); + +/** + * Free all allocated data in the given subtitle struct. + * + * @param sub AVSubtitle to free. + */ +void avsubtitle_free(AVSubtitle *sub); + +/** + * @} + */ + +/** + * @addtogroup lavc_packet + * @{ + */ + +#if FF_API_DESTRUCT_PACKET +/** + * Default packet destructor. + * @deprecated use the AVBuffer API instead + */ +attribute_deprecated +void av_destruct_packet(AVPacket *pkt); +#endif + +/** + * Initialize optional fields of a packet with default values. + * + * Note, this does not touch the data and size members, which have to be + * initialized separately. + * + * @param pkt packet + */ +void av_init_packet(AVPacket *pkt); + +/** + * Allocate the payload of a packet and initialize its fields with + * default values. + * + * @param pkt packet + * @param size wanted payload size + * @return 0 if OK, AVERROR_xxx otherwise + */ +int av_new_packet(AVPacket *pkt, int size); + +/** + * Reduce packet size, correctly zeroing padding + * + * @param pkt packet + * @param size new size + */ +void av_shrink_packet(AVPacket *pkt, int size); + +/** + * Increase packet size, correctly zeroing padding + * + * @param pkt packet + * @param grow_by number of bytes by which to increase the size of the packet + */ +int av_grow_packet(AVPacket *pkt, int grow_by); + +/** + * Initialize a reference-counted packet from av_malloc()ed data. + * + * @param pkt packet to be initialized. This function will set the data, size, + * buf and destruct fields, all others are left untouched. + * @param data Data allocated by av_malloc() to be used as packet data. If this + * function returns successfully, the data is owned by the underlying AVBuffer. + * The caller may not access the data through other means. + * @param size size of data in bytes, without the padding. I.e. the full buffer + * size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); + +/** + * @warning This is a hack - the packet memory allocation stuff is broken. The + * packet is allocated if it was not really allocated. + */ +int av_dup_packet(AVPacket *pkt); + +/** + * Free a packet. + * + * @param pkt packet to free + */ +void av_free_packet(AVPacket *pkt); + +/** + * Allocate new information of a packet. + * + * @param pkt packet + * @param type side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Shrink the already allocated side data buffer + * + * @param pkt packet + * @param type side information type + * @param size new side information size + * @return 0 on success, < 0 on failure + */ +int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Get side information from packet. + * + * @param pkt packet + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int *size); + +/** + * Convenience function to free all the side data stored. + * All the other fields stay untouched. + * + * @param pkt packet + */ +void av_packet_free_side_data(AVPacket *pkt); + +/** + * Setup a new reference to the data described by a given packet + * + * If src is reference-counted, setup dst as a new reference to the + * buffer in src. Otherwise allocate a new buffer in dst and copy the + * data from src into it. + * + * All the other fields are copied from src. + * + * @see av_packet_unref + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_packet_ref(AVPacket *dst, AVPacket *src); + +/** + * Wipe the packet. + * + * Unreference the buffer referenced by the packet and reset the + * remaining packet fields to their default values. + * + * @param pkt The packet to be unreferenced. + */ +void av_packet_unref(AVPacket *pkt); + +/** + * Move every field in src to dst and reset src. + * + * @see av_packet_unref + * + * @param src Source packet, will be reset + * @param dst Destination packet + */ +void av_packet_move_ref(AVPacket *dst, AVPacket *src); + +/** + * Copy only "properties" fields from src to dst. + * + * Properties for the purpose of this function are all the fields + * beside those related to the packet data (buf, data, size) + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success AVERROR on failure. + * + */ +int av_packet_copy_props(AVPacket *dst, const AVPacket *src); + +/** + * Convert valid timing fields (timestamps / durations) in a packet from one + * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be + * ignored. + * + * @param pkt packet on which the conversion will be performed + * @param tb_src source timebase, in which the timing fields in pkt are + * expressed + * @param tb_dst destination timebase, to which the timing fields will be + * converted + */ +void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst); + +/** + * @} + */ + +/** + * @addtogroup lavc_decoding + * @{ + */ + +/** + * Find a registered decoder with a matching codec ID. + * + * @param id AVCodecID of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_decoder(enum AVCodecID id); + +/** + * Find a registered decoder with the specified name. + * + * @param name name of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_decoder_by_name(const char *name); + +#if FF_API_GET_BUFFER +attribute_deprecated int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); +attribute_deprecated void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); +attribute_deprecated int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); +#endif + +/** + * The default callback for AVCodecContext.get_buffer2(). It is made public so + * it can be called by custom get_buffer2() implementations for decoders without + * CODEC_CAP_DR1 set. + */ +int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); + +#if FF_API_EMU_EDGE +/** + * Return the amount of padding in pixels which the get_buffer callback must + * provide around the edge of the image for codecs which do not have the + * CODEC_FLAG_EMU_EDGE flag. + * + * @return Required padding in pixels. + * + * @deprecated CODEC_FLAG_EMU_EDGE is deprecated, so this function is no longer + * needed + */ +attribute_deprecated +unsigned avcodec_get_edge_width(void); +#endif + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you do not use any horizontal + * padding. + * + * May only be used if a codec with CODEC_CAP_DR1 has been opened. + */ +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you also ensure that all + * line sizes are a multiple of the respective linesize_align[i]. + * + * May only be used if a codec with CODEC_CAP_DR1 has been opened. + */ +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, + int linesize_align[AV_NUM_DATA_POINTERS]); + +/** + * Decode the audio frame of size avpkt->size from avpkt->data into frame. + * + * Some decoders may support multiple frames in a single AVPacket. Such + * decoders would then just decode the first frame and the return value would be + * less than the packet size. In this case, avcodec_decode_audio4 has to be + * called again with an AVPacket containing the remaining data in order to + * decode the second frame, etc... Even if no frames are returned, the packet + * needs to be fed to the decoder with remaining data until it is completely + * consumed or an error occurs. + * + * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input + * and output. This means that for some packets they will not immediately + * produce decoded output and need to be flushed at the end of decoding to get + * all the decoded data. Flushing is done by calling this function with packets + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops + * returning samples. It is safe to flush even those decoders that are not + * marked with CODEC_CAP_DELAY, then no samples will be returned. + * + * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE + * larger than the actual read bytes because some optimized bitstream + * readers read 32 or 64 bits at once and could read over the end. + * + * @param avctx the codec context + * @param[out] frame The AVFrame in which to store decoded audio samples. + * The decoder will allocate a buffer for the decoded frame by + * calling the AVCodecContext.get_buffer2() callback. + * When AVCodecContext.refcounted_frames is set to 1, the frame is + * reference counted and the returned reference belongs to the + * caller. The caller must release the frame using av_frame_unref() + * when the frame is no longer needed. The caller may safely write + * to the frame if av_frame_is_writable() returns 1. + * When AVCodecContext.refcounted_frames is set to 0, the returned + * reference belongs to the decoder and is valid only until the + * next call to this function or until closing or flushing the + * decoder. The caller may not write to it. + * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is + * non-zero. Note that this field being set to zero + * does not mean that an error has occurred. For + * decoders with CODEC_CAP_DELAY set, no given decode + * call is guaranteed to produce a frame. + * @param[in] avpkt The input AVPacket containing the input buffer. + * At least avpkt->data and avpkt->size should be set. Some + * decoders might also require additional fields to be set. + * @return A negative error code is returned if an error occurred during + * decoding, otherwise the number of bytes consumed from the input + * AVPacket is returned. + */ +int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, + int *got_frame_ptr, AVPacket *avpkt); + +/** + * Decode the video frame of size avpkt->size from avpkt->data into picture. + * Some decoders may support multiple frames in a single AVPacket, such + * decoders would then just decode the first frame. + * + * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer buf should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay + * between input and output, these need to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to return the remaining frames. + * + * @param avctx the codec context + * @param[out] picture The AVFrame in which the decoded video frame will be stored. + * Use av_frame_alloc() to get an AVFrame. The codec will + * allocate memory for the actual bitmap by calling the + * AVCodecContext.get_buffer2() callback. + * When AVCodecContext.refcounted_frames is set to 1, the frame is + * reference counted and the returned reference belongs to the + * caller. The caller must release the frame using av_frame_unref() + * when the frame is no longer needed. The caller may safely write + * to the frame if av_frame_is_writable() returns 1. + * When AVCodecContext.refcounted_frames is set to 0, the returned + * reference belongs to the decoder and is valid only until the + * next call to this function or until closing or flushing the + * decoder. The caller may not write to it. + * + * @param[in] avpkt The input AVpacket containing the input buffer. + * You can create such packet with av_init_packet() and by then setting + * data and size, some decoders might in addition need other fields like + * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least + * fields possible. + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + */ +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, + int *got_picture_ptr, + AVPacket *avpkt); + +/** + * Decode a subtitle message. + * Return a negative value on error, otherwise return the number of bytes used. + * If no subtitle could be decompressed, got_sub_ptr is zero. + * Otherwise, the subtitle is stored in *sub. + * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for + * simplicity, because the performance difference is expect to be negligible + * and reusing a get_buffer written for video codecs would probably perform badly + * due to a potentially very different allocation pattern. + * + * @param avctx the codec context + * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be + freed with avsubtitle_free if *got_sub_ptr is set. + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. + * @param[in] avpkt The input AVPacket containing the input buffer. + */ +int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, + int *got_sub_ptr, + AVPacket *avpkt); + +/** + * @defgroup lavc_parsing Frame parsing + * @{ + */ + +enum AVPictureStructure { + AV_PICTURE_STRUCTURE_UNKNOWN, //< unknown + AV_PICTURE_STRUCTURE_TOP_FIELD, //< coded as top field + AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field + AV_PICTURE_STRUCTURE_FRAME, //< coded as frame +}; + +typedef struct AVCodecParserContext { + void *priv_data; + struct AVCodecParser *parser; + int64_t frame_offset; /* offset of the current frame */ + int64_t cur_offset; /* current offset + (incremented by each av_parser_parse()) */ + int64_t next_frame_offset; /* offset of the next frame */ + /* video info */ + int pict_type; /* XXX: Put it back in AVCodecContext. */ + /** + * This field is used for proper frame duration computation in lavf. + * It signals, how much longer the frame duration of the current frame + * is compared to normal frame duration. + * + * frame_duration = (1 + repeat_pict) * time_base + * + * It is used by codecs like H.264 to display telecined material. + */ + int repeat_pict; /* XXX: Put it back in AVCodecContext. */ + int64_t pts; /* pts of the current frame */ + int64_t dts; /* dts of the current frame */ + + /* private data */ + int64_t last_pts; + int64_t last_dts; + int fetch_timestamp; + +#define AV_PARSER_PTS_NB 4 + int cur_frame_start_index; + int64_t cur_frame_offset[AV_PARSER_PTS_NB]; + int64_t cur_frame_pts[AV_PARSER_PTS_NB]; + int64_t cur_frame_dts[AV_PARSER_PTS_NB]; + + int flags; +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 +#define PARSER_FLAG_ONCE 0x0002 +/// Set if the parser has a valid file offset +#define PARSER_FLAG_FETCHED_OFFSET 0x0004 + + int64_t offset; ///< byte offset from starting packet start + int64_t cur_frame_end[AV_PARSER_PTS_NB]; + + /** + * Set by parser to 1 for key frames and 0 for non-key frames. + * It is initialized to -1, so if the parser doesn't set this flag, + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames + * will be used. + */ + int key_frame; + + /** + * Time difference in stream time base units from the pts of this + * packet to the point at which the output from the decoder has converged + * independent from the availability of previous frames. That is, the + * frames are virtually identical no matter if decoding started from + * the very first frame or from this keyframe. + * Is AV_NOPTS_VALUE if unknown. + * This field is not the display duration of the current frame. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. + * + * The purpose of this field is to allow seeking in streams that have no + * keyframes in the conventional sense. It corresponds to the + * recovery point SEI in H.264 and match_time_delta in NUT. It is also + * essential for some types of subtitle streams to ensure that all + * subtitles are correctly displayed after seeking. + */ + int64_t convergence_duration; + + // Timestamp generation support: + /** + * Synchronization point for start of timestamp generation. + * + * Set to >0 for sync point, 0 for no sync point and <0 for undefined + * (default). + * + * For example, this corresponds to presence of H.264 buffering period + * SEI message. + */ + int dts_sync_point; + + /** + * Offset of the current timestamp against last timestamp sync point in + * units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain a valid timestamp offset. + * + * Note that the timestamp of sync point has usually a nonzero + * dts_ref_dts_delta, which refers to the previous sync point. Offset of + * the next frame after timestamp sync point will be usually 1. + * + * For example, this corresponds to H.264 cpb_removal_delay. + */ + int dts_ref_dts_delta; + + /** + * Presentation delay of current frame in units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain valid non-negative timestamp delta (presentation time of a frame + * must not lie in the past). + * + * This delay represents the difference between decoding and presentation + * time of the frame. + * + * For example, this corresponds to H.264 dpb_output_delay. + */ + int pts_dts_delta; + + /** + * Position of the packet in file. + * + * Analogous to cur_frame_pts/dts + */ + int64_t cur_frame_pos[AV_PARSER_PTS_NB]; + + /** + * Byte position of currently parsed frame in stream. + */ + int64_t pos; + + /** + * Previous frame byte position. + */ + int64_t last_pos; + + /** + * Duration of the current frame. + * For audio, this is in units of 1 / AVCodecContext.sample_rate. + * For all other types, this is in units of AVCodecContext.time_base. + */ + int duration; + + enum AVFieldOrder field_order; + + /** + * Indicate whether a picture is coded as a frame, top field or bottom field. + * + * For example, H.264 field_pic_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag + * equal to 1 and bottom_field_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_TOP_FIELD. + */ + enum AVPictureStructure picture_structure; + + /** + * Picture number incremented in presentation or output order. + * This field may be reinitialized at the first picture of a new sequence. + * + * For example, this corresponds to H.264 PicOrderCnt. + */ + int output_picture_number; +} AVCodecParserContext; + +typedef struct AVCodecParser { + int codec_ids[5]; /* several codec IDs are permitted */ + int priv_data_size; + int (*parser_init)(AVCodecParserContext *s); + int (*parser_parse)(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size); + void (*parser_close)(AVCodecParserContext *s); + int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); + struct AVCodecParser *next; +} AVCodecParser; + +AVCodecParser *av_parser_next(const AVCodecParser *c); + +void av_register_codec_parser(AVCodecParser *parser); +AVCodecParserContext *av_parser_init(int codec_id); + +/** + * Parse a packet. + * + * @param s parser context. + * @param avctx codec context. + * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished. + * @param poutbuf_size set to size of parsed buffer or zero if not yet finished. + * @param buf input buffer. + * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output). + * @param pts input presentation timestamp. + * @param dts input decoding timestamp. + * @param pos input byte position in stream. + * @return the number of bytes of the input bitstream used. + * + * Example: + * @code + * while(in_len){ + * len = av_parser_parse2(myparser, AVCodecContext, &data, &size, + * in_data, in_len, + * pts, dts, pos); + * in_data += len; + * in_len -= len; + * + * if(size) + * decode_frame(data, size); + * } + * @endcode + */ +int av_parser_parse2(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, + int64_t pts, int64_t dts, + int64_t pos); + +/** + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed + * @deprecated use AVBitstreamFilter + */ +int av_parser_change(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); +void av_parser_close(AVCodecParserContext *s); + +/** + * @} + * @} + */ + +/** + * @addtogroup lavc_encoding + * @{ + */ + +/** + * Find a registered encoder with a matching codec ID. + * + * @param id AVCodecID of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_encoder(enum AVCodecID id); + +/** + * Find a registered encoder with the specified name. + * + * @param name name of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_encoder_by_name(const char *name); + +/** + * Encode a frame of audio. + * + * Takes input samples from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay, split, and combine input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. All other AVPacket fields + * will be reset by the encoder using av_init_packet(). If + * avpkt->data is NULL, the encoder will allocate it. + * The encoder will set avpkt->size to the size of the + * output packet. + * + * If this function fails or produces no output, avpkt will be + * freed using av_free_packet() (i.e. avpkt->destruct will be + * called to free the user supplied buffer). + * @param[in] frame AVFrame containing the raw audio data to be encoded. + * May be NULL when flushing an encoder that has the + * CODEC_CAP_DELAY capability set. + * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * can have any number of samples. + * If it is not set, frame->nb_samples must be equal to + * avctx->frame_size for all frames except the last. + * The final frame may be smaller than avctx->frame_size. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + */ +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +/** + * Encode a frame of video. + * + * Takes input raw video data from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay and reorder input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. All other AVPacket fields + * will be reset by the encoder using av_init_packet(). If + * avpkt->data is NULL, the encoder will allocate it. + * The encoder will set avpkt->size to the size of the + * output packet. The returned data (if any) belongs to the + * caller, he is responsible for freeing it. + * + * If this function fails or produces no output, avpkt will be + * freed using av_free_packet() (i.e. avpkt->destruct will be + * called to free the user supplied buffer). + * @param[in] frame AVFrame containing the raw video data to be encoded. + * May be NULL when flushing an encoder that has the + * CODEC_CAP_DELAY capability set. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + */ +int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, + const AVSubtitle *sub); + + +/** + * @} + */ + +/** + * @addtogroup lavc_picture + * @{ + */ + +/** + * Allocate memory for a picture. Call avpicture_free() to free it. + * + * @see avpicture_fill() + * + * @param picture the picture to be filled in + * @param pix_fmt the format of the picture + * @param width the width of the picture + * @param height the height of the picture + * @return zero if successful, a negative value if not + */ +int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Free a picture previously allocated by avpicture_alloc(). + * The data buffer used by the AVPicture is freed, but the AVPicture structure + * itself is not. + * + * @param picture the AVPicture to be freed + */ +void avpicture_free(AVPicture *picture); + +/** + * Fill in the AVPicture fields. + * The fields of the given AVPicture are filled in by using the 'ptr' address + * which points to the image data buffer. Depending on the specified picture + * format, one or multiple image data pointers and line sizes will be set. + * If a planar format is specified, several pointers will be set pointing to + * the different picture planes and the line sizes of the different planes + * will be stored in the lines_sizes array. + * Call with ptr == NULL to get the required size for the ptr buffer. + * + * To allocate the buffer and fill in the AVPicture fields in one call, + * use avpicture_alloc(). + * + * @param picture AVPicture whose fields are to be filled in + * @param ptr Buffer which will contain or contains the actual image data + * @param pix_fmt The format in which the picture data is stored. + * @param width the width of the image in pixels + * @param height the height of the image in pixels + * @return size of the image data in bytes + */ +int avpicture_fill(AVPicture *picture, uint8_t *ptr, + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Copy pixel data from an AVPicture into a buffer. + * The data is stored compactly, without any gaps for alignment or padding + * which may be applied by avpicture_fill(). + * + * @see avpicture_get_size() + * + * @param[in] src AVPicture containing image data + * @param[in] pix_fmt The format in which the picture data is stored. + * @param[in] width the width of the image in pixels. + * @param[in] height the height of the image in pixels. + * @param[out] dest A buffer into which picture data will be copied. + * @param[in] dest_size The size of 'dest'. + * @return The number of bytes written to dest, or a negative value (error code) on error. + */ +int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, + int width, int height, + unsigned char *dest, int dest_size); + +/** + * Calculate the size in bytes that a picture of the given width and height + * would occupy if stored in the given picture format. + * Note that this returns the size of a compact representation as generated + * by avpicture_layout(), which can be smaller than the size required for e.g. + * avpicture_fill(). + * + * @param pix_fmt the given picture format + * @param width the width of the image + * @param height the height of the image + * @return Image data size in bytes or -1 on error (e.g. too large dimensions). + */ +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); + +#if FF_API_DEINTERLACE +/** + * deinterlace - if not supported return -1 + * + * @deprecated - use yadif (in libavfilter) instead + */ +attribute_deprecated +int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int width, int height); +#endif +/** + * Copy image src to dst. Wraps av_picture_data_copy() above. + */ +void av_picture_copy(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Crop image top and left side. + */ +int av_picture_crop(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int top_band, int left_band); + +/** + * Pad image. + */ +int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, + int padtop, int padbottom, int padleft, int padright, int *color); + +/** + * @} + */ + +/** + * @defgroup lavc_misc Utility functions + * @ingroup libavc + * + * Miscellaneous utility functions related to both encoding and decoding + * (or neither). + * @{ + */ + +/** + * @defgroup lavc_misc_pixfmt Pixel formats + * + * Functions for working with pixel formats. + * @{ + */ + +/** + * @deprecated Use av_pix_fmt_get_chroma_sub_sample + */ + +void attribute_deprecated avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); + +/** + * Return a value representing the fourCC code associated to the + * pixel format pix_fmt, or 0 if no associated fourCC code can be + * found. + */ +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); + +#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ +#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ +#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ +#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ +#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ +#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ + +/** + * Compute what kind of losses will occur when converting from one specific + * pixel format to another. + * When converting from one pixel format to another, information loss may occur. + * For example, when converting from RGB24 to GRAY, the color information will + * be lost. Similarly, other losses occur when converting from some formats to + * other formats. These losses can involve loss of chroma, but also loss of + * resolution, loss of color depth, loss due to the color space conversion, loss + * of the alpha bits or loss due to color quantization. + * avcodec_get_fix_fmt_loss() informs you about the various types of losses + * which will occur when converting from one pixel format to another. + * + * @param[in] dst_pix_fmt destination pixel format + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @return Combination of flags informing you what kind of losses will occur. + */ +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, + int has_alpha); + +/** + * Find the best pixel format to convert to given a certain source pixel + * format. When converting from one pixel format to another, information loss + * may occur. For example, when converting from RGB24 to GRAY, the color + * information will be lost. Similarly, other losses occur when converting from + * some formats to other formats. avcodec_find_best_pix_fmt2() searches which of + * the given pixel formats should be used to suffer the least amount of loss. + * The pixel formats from which it chooses one, are determined by the + * pix_fmt_list parameter. + * + * + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. + * @return The best pixel format to convert to or -1 if none was found. + */ +enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list, + enum AVPixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr); + +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); + +/** + * @} + */ + +#if FF_API_SET_DIMENSIONS +/** + * @deprecated this function is not supposed to be used from outside of lavc + */ +attribute_deprecated +void avcodec_set_dimensions(AVCodecContext *s, int width, int height); +#endif + +/** + * Put a string representing the codec tag codec_tag in buf. + * + * @param buf buffer to place codec tag in + * @param buf_size size in bytes of buf + * @param codec_tag codec tag to assign + * @return the length of the string that would have been generated if + * enough space had been available, excluding the trailing null + */ +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); + +void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); + +/** + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + +int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); +int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); +//FIXME func typedef + +/** + * Fill audio frame data and linesize. + * AVFrame extended_data channel pointers are allocated if necessary for + * planar audio. + * + * @param frame the AVFrame + * frame->nb_samples must be set prior to calling the + * function. This function fills in frame->data, + * frame->extended_data, frame->linesize[0]. + * @param nb_channels channel count + * @param sample_fmt sample format + * @param buf buffer to use for frame data + * @param buf_size size of buffer + * @param align plane size sample alignment (0 = default) + * @return 0 on success, negative error code on failure + */ +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, + enum AVSampleFormat sample_fmt, const uint8_t *buf, + int buf_size, int align); + +/** + * Reset the internal decoder state / flush internal buffers. Should be called + * e.g. when seeking or when switching to a different stream. + * + * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0), + * this invalidates the frames previously returned from the decoder. When + * refcounted frames are used, the decoder just releases any references it might + * keep internally, but the caller's reference remains valid. + */ +void avcodec_flush_buffers(AVCodecContext *avctx); + +/** + * Return codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return codec bits per sample. + * Only return non-zero if the bits per sample is exactly correct, not an + * approximation. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_exact_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return audio frame duration. + * + * @param avctx codec context + * @param frame_bytes size of the frame, or 0 if unknown + * @return frame duration, in samples, if known. 0 if not able to + * determine. + */ +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); + + +typedef struct AVBitStreamFilterContext { + void *priv_data; + struct AVBitStreamFilter *filter; + AVCodecParserContext *parser; + struct AVBitStreamFilterContext *next; +} AVBitStreamFilterContext; + + +typedef struct AVBitStreamFilter { + const char *name; + int priv_data_size; + int (*filter)(AVBitStreamFilterContext *bsfc, + AVCodecContext *avctx, const char *args, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); + void (*close)(AVBitStreamFilterContext *bsfc); + struct AVBitStreamFilter *next; +} AVBitStreamFilter; + +void av_register_bitstream_filter(AVBitStreamFilter *bsf); +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); +int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, + AVCodecContext *avctx, const char *args, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); +void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); + +AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); + +/* memory */ + +/** + * Allocate a buffer with padding, reusing the given one if large enough. + * + * Same behaviour av_fast_malloc but the buffer has additional + * FF_INPUT_PADDING_SIZE at the end which will always memset to 0. + * + */ +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ +unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + +#if FF_API_MISSING_SAMPLE +/** + * Log a generic warning message about a missing feature. This function is + * intended to be used internally by Libav (libavcodec, libavformat, etc.) + * only, and would normally not be used by applications. + * @param[in] avc a pointer to an arbitrary struct of which the first field is + * a pointer to an AVClass struct + * @param[in] feature string containing the name of the missing feature + * @param[in] want_sample indicates if samples are wanted which exhibit this feature. + * If want_sample is non-zero, additional verbage will be added to the log + * message which tells the user how to report samples to the development + * mailing list. + * @deprecated Use avpriv_report_missing_feature() instead. + */ +attribute_deprecated +void av_log_missing_feature(void *avc, const char *feature, int want_sample); + +/** + * Log a generic warning message asking for a sample. This function is + * intended to be used internally by Libav (libavcodec, libavformat, etc.) + * only, and would normally not be used by applications. + * @param[in] avc a pointer to an arbitrary struct of which the first field is + * a pointer to an AVClass struct + * @param[in] msg string containing an optional message, or NULL if no message + * @deprecated Use avpriv_request_sample() instead. + */ +attribute_deprecated +void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3); +#endif /* FF_API_MISSING_SAMPLE */ + +/** + * Register the hardware accelerator hwaccel. + */ +void av_register_hwaccel(AVHWAccel *hwaccel); + +/** + * If hwaccel is NULL, returns the first registered hardware accelerator, + * if hwaccel is non-NULL, returns the next registered hardware accelerator + * after hwaccel, or NULL if hwaccel is the last one. + */ +AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel); + + +/** + * Lock operation used by lockmgr + */ +enum AVLockOp { + AV_LOCK_CREATE, ///< Create a mutex + AV_LOCK_OBTAIN, ///< Lock the mutex + AV_LOCK_RELEASE, ///< Unlock the mutex + AV_LOCK_DESTROY, ///< Free mutex resources +}; + +/** + * Register a user provided lock manager supporting the operations + * specified by AVLockOp. mutex points to a (void *) where the + * lockmgr should store/get a pointer to a user allocated mutex. It's + * NULL upon AV_LOCK_CREATE and != NULL for all other ops. + * + * @param cb User defined callback. Note: Libav may invoke calls to this + * callback during the call to av_lockmgr_register(). + * Thus, the application must be prepared to handle that. + * If cb is set to NULL the lockmgr will be unregistered. + * Also note that during unregistration the previously registered + * lockmgr callback may also be invoked. + */ +int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); + +/** + * Get the type of the given codec. + */ +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); + +/** + * @return a positive value if s is open (i.e. avcodec_open2() was called on it + * with no corresponding avcodec_close()), 0 otherwise. + */ +int avcodec_is_open(AVCodecContext *s); + +/** + * @return a non-zero number if codec is an encoder, zero otherwise + */ +int av_codec_is_encoder(const AVCodec *codec); + +/** + * @return a non-zero number if codec is a decoder, zero otherwise + */ +int av_codec_is_decoder(const AVCodec *codec); + +/** + * @return descriptor for given codec ID or NULL if no descriptor exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id); + +/** + * Iterate over all codec descriptors known to libavcodec. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); + +/** + * @return codec descriptor with the given name or NULL if no such descriptor + * exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); + +/** + * @} + */ + +#endif /* AVCODEC_AVCODEC_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/avfft.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/avfft.h new file mode 100644 index 000000000..e2e727da9 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/avfft.h @@ -0,0 +1,118 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVFFT_H +#define AVCODEC_AVFFT_H + +/** + * @file + * @ingroup lavc_fft + * FFT functions + */ + +/** + * @defgroup lavc_fft FFT functions + * @ingroup lavc_misc + * + * @{ + */ + +typedef float FFTSample; + +typedef struct FFTComplex { + FFTSample re, im; +} FFTComplex; + +typedef struct FFTContext FFTContext; + +/** + * Set up a complex FFT. + * @param nbits log2 of the length of the input array + * @param inverse if 0 perform the forward transform, if 1 perform the inverse + */ +FFTContext *av_fft_init(int nbits, int inverse); + +/** + * Do the permutation needed BEFORE calling ff_fft_calc(). + */ +void av_fft_permute(FFTContext *s, FFTComplex *z); + +/** + * Do a complex FFT with the parameters defined in av_fft_init(). The + * input data must be permuted before. No 1.0/sqrt(n) normalization is done. + */ +void av_fft_calc(FFTContext *s, FFTComplex *z); + +void av_fft_end(FFTContext *s); + +FFTContext *av_mdct_init(int nbits, int inverse, double scale); +void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_mdct_end(FFTContext *s); + +/* Real Discrete Fourier Transform */ + +enum RDFTransformType { + DFT_R2C, + IDFT_C2R, + IDFT_R2C, + DFT_C2R, +}; + +typedef struct RDFTContext RDFTContext; + +/** + * Set up a real FFT. + * @param nbits log2 of the length of the input array + * @param trans the type of transform + */ +RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); +void av_rdft_calc(RDFTContext *s, FFTSample *data); +void av_rdft_end(RDFTContext *s); + +/* Discrete Cosine Transform */ + +typedef struct DCTContext DCTContext; + +enum DCTTransformType { + DCT_II = 0, + DCT_III, + DCT_I, + DST_I, +}; + +/** + * Set up DCT. + * + * @param nbits size of the input array: + * (1 << nbits) for DCT-II, DCT-III and DST-I + * (1 << nbits) + 1 for DCT-I + * @param type the type of transform + * + * @note the first element of the input of DST-I is ignored + */ +DCTContext *av_dct_init(int nbits, enum DCTTransformType type); +void av_dct_calc(DCTContext *s, FFTSample *data); +void av_dct_end (DCTContext *s); + +/** + * @} + */ + +#endif /* AVCODEC_AVFFT_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/dxva2.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/dxva2.h new file mode 100644 index 000000000..78939be96 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/dxva2.h @@ -0,0 +1,89 @@ +/* + * DXVA2 HW acceleration + * + * copyright (c) 2009 Laurent Aimar + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DXVA_H +#define AVCODEC_DXVA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_dxva2 + * Public libavcodec DXVA2 header. + */ + +#define _WIN32_WINNT 0x0600 +#include <stdint.h> +#include <d3d9.h> +#include <dxva2api.h> + +/** + * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards +#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface + +/** + * This structure is used to provides the necessary configurations and data + * to the DXVA2 Libav HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct dxva_context { + /** + * DXVA2 decoder object + */ + IDirectXVideoDecoder *decoder; + + /** + * DXVA2 configuration used to create the decoder + */ + const DXVA2_ConfigPictureDecode *cfg; + + /** + * The number of surface in the surface array + */ + unsigned surface_count; + + /** + * The array of Direct3D surfaces used to create the decoder + */ + LPDIRECT3DSURFACE9 *surface; + + /** + * A bit field configuring the workarounds needed for using the decoder + */ + uint64_t workaround; + + /** + * Private to the Libav AVHWAccel implementation + */ + unsigned report_id; +}; + +/** + * @} + */ + +#endif /* AVCODEC_DXVA_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/vaapi.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/vaapi.h new file mode 100644 index 000000000..39e88259d --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/vaapi.h @@ -0,0 +1,173 @@ +/* + * Video Acceleration API (shared data between Libav and the video player) + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 + * + * Copyright (C) 2008-2009 Splitted-Desktop Systems + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VAAPI_H +#define AVCODEC_VAAPI_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vaapi + * Public libavcodec VA API header. + */ + +#include <stdint.h> + +/** + * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding + * @ingroup lavc_codec_hwaccel + * @{ + */ + +/** + * This structure is used to share data between the Libav library and + * the client video application. + * This shall be zero-allocated and available as + * AVCodecContext.hwaccel_context. All user members can be set once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + */ +struct vaapi_context { + /** + * Window system dependent data + * + * - encoding: unused + * - decoding: Set by user + */ + void *display; + + /** + * Configuration ID + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t config_id; + + /** + * Context ID (video decode pipeline) + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t context_id; + + /** + * VAPictureParameterBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t pic_param_buf_id; + + /** + * VAIQMatrixBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t iq_matrix_buf_id; + + /** + * VABitPlaneBuffer ID (for VC-1 decoding) + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t bitplane_buf_id; + + /** + * Slice parameter/data buffer IDs + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t *slice_buf_ids; + + /** + * Number of effective slice buffer IDs to send to the HW + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int n_slice_buf_ids; + + /** + * Size of pre-allocated slice_buf_ids + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_buf_ids_alloc; + + /** + * Pointer to VASliceParameterBuffers + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + void *slice_params; + + /** + * Size of a VASliceParameterBuffer element + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_param_size; + + /** + * Size of pre-allocated slice_params + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_params_alloc; + + /** + * Number of slices currently filled in + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_count; + + /** + * Pointer to slice data buffer base + * - encoding: unused + * - decoding: Set by libavcodec + */ + const uint8_t *slice_data; + + /** + * Current size of slice data + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t slice_data_size; +}; + +/* @} */ + +#endif /* AVCODEC_VAAPI_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/vda.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/vda.h new file mode 100644 index 000000000..9aa5d297f --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/vda.h @@ -0,0 +1,195 @@ +/* + * VDA HW acceleration + * + * copyright (c) 2011 Sebastien Zwickert + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDA_H +#define AVCODEC_VDA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vda + * Public libavcodec VDA header. + */ + +#include "libavcodec/avcodec.h" +#include "libavcodec/version.h" + +#include <stdint.h> + +// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes +// http://openradar.appspot.com/8026390 +#undef __GNUC_STDC_INLINE__ + +#define Picture QuickdrawPicture +#include <VideoDecodeAcceleration/VDADecoder.h> +#undef Picture + +/** + * @defgroup lavc_codec_hwaccel_vda VDA + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +/** + * This structure is used to provide the necessary configurations and data + * to the VDA Libav HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct vda_context { + /** + * VDA decoder object. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + VDADecoder decoder; + + /** + * The Core Video pixel buffer that contains the current image data. + * + * encoding: unused + * decoding: Set by libavcodec. Unset by user. + */ + CVPixelBufferRef cv_buffer; + + /** + * Use the hardware decoder in synchronous mode. + * + * encoding: unused + * decoding: Set by user. + */ + int use_sync_decoding; + + /** + * The frame width. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int width; + + /** + * The frame height. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int height; + + /** + * The frame format. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int format; + + /** + * The pixel format for output image buffers. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + OSType cv_pix_fmt_type; + + /** + * unused + */ + uint8_t *priv_bitstream; + + /** + * unused + */ + int priv_bitstream_size; + + /** + * unused + */ + int priv_allocated_size; +}; + +/** Create the video decoder. */ +int ff_vda_create_decoder(struct vda_context *vda_ctx, + uint8_t *extradata, + int extradata_size); + +/** Destroy the video decoder. */ +int ff_vda_destroy_decoder(struct vda_context *vda_ctx); + +/** + * This struct holds all the information that needs to be passed + * between the caller and libavcodec for initializing VDA decoding. + * Its size is not a part of the public ABI, it must be allocated with + * av_vda_alloc_context() and freed with av_free(). + */ +typedef struct AVVDAContext { + /** + * VDA decoder object. Created and freed by the caller. + */ + VDADecoder decoder; + + /** + * The output callback that must be passed to VDADecoderCreate. + * Set by av_vda_alloc_context(). + */ + VDADecoderOutputCallback output_callback; +} AVVDAContext; + +/** + * Allocate and initialize a VDA context. + * + * This function should be called from the get_format() callback when the caller + * selects the AV_PIX_FMT_VDA format. The caller must then create the decoder + * object (using the output callback provided by libavcodec) that will be used + * for VDA-accelerated decoding. + * + * When decoding with VDA is finished, the caller must destroy the decoder + * object and free the VDA context using av_free(). + * + * @return the newly allocated context or NULL on failure + */ +AVVDAContext *av_vda_alloc_context(void); + +/** + * This is a convenience function that creates and sets up the VDA context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_vda_default_init(AVCodecContext *avctx); + +/** + * This function must be called to free the VDA context initialized with + * av_vda_default_init(). + * + * @param avctx the corresponding codec context + */ +void av_vda_default_free(AVCodecContext *avctx); + +/** + * @} + */ + +#endif /* AVCODEC_VDA_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/vdpau.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/vdpau.h new file mode 100644 index 000000000..75cb1bf7a --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/vdpau.h @@ -0,0 +1,189 @@ +/* + * The Video Decode and Presentation API for UNIX (VDPAU) is used for + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. + * + * Copyright (C) 2008 NVIDIA + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDPAU_H +#define AVCODEC_VDPAU_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vdpau + * Public libavcodec VDPAU header. + */ + + +/** + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer + * @ingroup lavc_codec_hwaccel + * + * VDPAU hardware acceleration has two modules + * - VDPAU decoding + * - VDPAU presentation + * + * The VDPAU decoding module parses all headers using Libav + * parsing mechanisms and uses VDPAU for the actual decoding. + * + * As per the current implementation, the actual decoding + * and rendering (API calls) are done as part of the VDPAU + * presentation (vo_vdpau.c) module. + * + * @{ + */ + +#include <vdpau/vdpau.h> +#include <vdpau/vdpau_x11.h> + +#include "libavutil/attributes.h" + +#include "avcodec.h" +#include "version.h" + +#if FF_API_BUFS_VDPAU +union AVVDPAUPictureInfo { + VdpPictureInfoH264 h264; + VdpPictureInfoMPEG1Or2 mpeg; + VdpPictureInfoVC1 vc1; + VdpPictureInfoMPEG4Part2 mpeg4; +}; +#endif + +/** + * This structure is used to share data between the libavcodec library and + * the client video application. + * The user shall zero-allocate the structure and make it available as + * AVCodecContext.hwaccel_context. Members can be set by the user once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + * + * The size of this structure is not a part of the public ABI and must not + * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an + * AVVDPAUContext. + */ +typedef struct AVVDPAUContext { + /** + * VDPAU decoder handle + * + * Set by user. + */ + VdpDecoder decoder; + + /** + * VDPAU decoder render callback + * + * Set by the user. + */ + VdpDecoderRender *render; + +#if FF_API_BUFS_VDPAU + /** + * VDPAU picture information + * + * Set by libavcodec. + */ + attribute_deprecated + union AVVDPAUPictureInfo info; + + /** + * Allocated size of the bitstream_buffers table. + * + * Set by libavcodec. + */ + attribute_deprecated + int bitstream_buffers_allocated; + + /** + * Useful bitstream buffers in the bitstream buffers table. + * + * Set by libavcodec. + */ + attribute_deprecated + int bitstream_buffers_used; + + /** + * Table of bitstream buffers. + * The user is responsible for freeing this buffer using av_freep(). + * + * Set by libavcodec. + */ + attribute_deprecated + VdpBitstreamBuffer *bitstream_buffers; +#endif +} AVVDPAUContext; + +/** + * Allocate an AVVDPAUContext. + * + * @return Newly-allocated AVVDPAUContext or NULL on failure. + */ +AVVDPAUContext *av_vdpau_alloc_context(void); + +/** + * Get a decoder profile that should be used for initializing a VDPAU decoder. + * Should be called from the AVCodecContext.get_format() callback. + * + * @param avctx the codec context being used for decoding the stream + * @param profile a pointer into which the result will be written on success. + * The contents of profile are undefined if this function returns + * an error. + * + * @return 0 on success (non-negative), a negative AVERROR on failure. + */ +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); + +#if FF_API_CAP_VDPAU +/** @brief The videoSurface is used for rendering. */ +#define FF_VDPAU_STATE_USED_FOR_RENDER 1 + +/** + * @brief The videoSurface is needed for reference/prediction. + * The codec manipulates this. + */ +#define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 + +/** + * @brief This structure is used as a callback between the Libav + * decoder (vd_) and presentation (vo_) module. + * This is used for defining a video frame containing surface, + * picture parameter, bitstream information etc which are passed + * between the Libav decoder and its clients. + */ +struct vdpau_render_state { + VdpVideoSurface surface; ///< Used as rendered surface, never changed. + + int state; ///< Holds FF_VDPAU_STATE_* values. + + /** picture parameter information for all supported codecs */ + union AVVDPAUPictureInfo info; + + /** Describe size/location of the compressed video data. + Set to 0 when freeing bitstream_buffers. */ + int bitstream_buffers_allocated; + int bitstream_buffers_used; + /** The user is responsible for freeing this buffer using av_freep(). */ + VdpBitstreamBuffer *bitstream_buffers; +}; +#endif + +/* @}*/ + +#endif /* AVCODEC_VDPAU_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/version.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/version.h new file mode 100644 index 000000000..8cc2fb031 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/version.h @@ -0,0 +1,157 @@ +/* + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VERSION_H +#define AVCODEC_VERSION_H + +/** + * @file + * @ingroup libavc + * Libavcodec version macros. + */ + +#include "libavutil/version.h" + +#define LIBAVCODEC_VERSION_MAJOR 56 +#define LIBAVCODEC_VERSION_MINOR 1 +#define LIBAVCODEC_VERSION_MICRO 0 + +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_REQUEST_CHANNELS +#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_DEINTERLACE +#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_DESTRUCT_PACKET +#define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_GET_BUFFER +#define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_MISSING_SAMPLE +#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_LOWRES +#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_CAP_VDPAU +#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_BUFS_VDPAU +#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_VOXWARE +#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_SET_DIMENSIONS +#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_DEBUG_MV +#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_AC_VLC +#define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_OLD_MSMPEG4 +#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ASPECT_EXTENDED +#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_THREAD_OPAQUE +#define FF_API_THREAD_OPAQUE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_CODEC_PKT +#define FF_API_CODEC_PKT (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ARCH_ALPHA +#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_XVMC +#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ERROR_RATE +#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_QSCALE_TYPE +#define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_MB_TYPE +#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_MAX_BFRAMES +#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_FAST_MALLOC +#define FF_API_FAST_MALLOC (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_NEG_LINESIZES +#define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_EMU_EDGE +#define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ARCH_SH4 +#define FF_API_ARCH_SH4 (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ARCH_SPARC +#define FF_API_ARCH_SPARC (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_UNUSED_MEMBERS +#define FF_API_UNUSED_MEMBERS (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_IDCT_XVIDMMX +#define FF_API_IDCT_XVIDMMX (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_INPUT_PRESERVED +#define FF_API_INPUT_PRESERVED (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_NORMALIZE_AQP +#define FF_API_NORMALIZE_AQP (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_GMC +#define FF_API_GMC (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_MV0 +#define FF_API_MV0 (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_CODEC_NAME +#define FF_API_CODEC_NAME (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_AFD +#define FF_API_AFD (LIBAVCODEC_VERSION_MAJOR < 57) +#endif + +#endif /* AVCODEC_VERSION_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/xvmc.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/xvmc.h new file mode 100644 index 000000000..950ed1827 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavcodec/xvmc.h @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2003 Ivan Kalvachev + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_XVMC_H +#define AVCODEC_XVMC_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_xvmc + * Public libavcodec XvMC header. + */ + +#include <X11/extensions/XvMC.h> + +#include "libavutil/attributes.h" +#include "version.h" +#include "avcodec.h" + +#if FF_API_XVMC + +/** + * @defgroup lavc_codec_hwaccel_xvmc XvMC + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct + the number is 1337 speak for the letters IDCT MCo (motion compensation) */ + +attribute_deprecated struct xvmc_pix_fmt { + /** The field contains the special constant value AV_XVMC_ID. + It is used as a test that the application correctly uses the API, + and that there is no corruption caused by pixel routines. + - application - set during initialization + - libavcodec - unchanged + */ + int xvmc_id; + + /** Pointer to the block array allocated by XvMCCreateBlocks(). + The array has to be freed by XvMCDestroyBlocks(). + Each group of 64 values represents one data block of differential + pixel information (in MoCo mode) or coefficients for IDCT. + - application - set the pointer during initialization + - libavcodec - fills coefficients/pixel data into the array + */ + short* data_blocks; + + /** Pointer to the macroblock description array allocated by + XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). + - application - set the pointer during initialization + - libavcodec - fills description data into the array + */ + XvMCMacroBlock* mv_blocks; + + /** Number of macroblock descriptions that can be stored in the mv_blocks + array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_mv_blocks; + + /** Number of blocks that can be stored at once in the data_blocks array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_data_blocks; + + /** Indicate that the hardware would interpret data_blocks as IDCT + coefficients and perform IDCT on them. + - application - set during initialization + - libavcodec - unchanged + */ + int idct; + + /** In MoCo mode it indicates that intra macroblocks are assumed to be in + unsigned format; same as the XVMC_INTRA_UNSIGNED flag. + - application - set during initialization + - libavcodec - unchanged + */ + int unsigned_intra; + + /** Pointer to the surface allocated by XvMCCreateSurface(). + It has to be freed by XvMCDestroySurface() on application exit. + It identifies the frame and its state on the video hardware. + - application - set during initialization + - libavcodec - unchanged + */ + XvMCSurface* p_surface; + +/** Set by the decoder before calling ff_draw_horiz_band(), + needed by the XvMCRenderSurface function. */ +//@{ + /** Pointer to the surface used as past reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface* p_past_surface; + + /** Pointer to the surface used as future reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface* p_future_surface; + + /** top/bottom field or frame + - application - unchanged + - libavcodec - set + */ + unsigned int picture_structure; + + /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence + - application - unchanged + - libavcodec - set + */ + unsigned int flags; +//}@ + + /** Number of macroblock descriptions in the mv_blocks array + that have already been passed to the hardware. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may increment it + with filled_mb_block_num or zero both. + - libavcodec - unchanged + */ + int start_mv_blocks_num; + + /** Number of new macroblock descriptions in the mv_blocks array (after + start_mv_blocks_num) that are filled by libavcodec and have to be + passed to the hardware. + - application - zeroes it on get_buffer() or after successful + ff_draw_horiz_band(). + - libavcodec - increment with one of each stored MB + */ + int filled_mv_blocks_num; + + /** Number of the next free data block; one data block consists of + 64 short values in the data_blocks array. + All blocks before this one have already been claimed by placing their + position into the corresponding block description structure field, + that are part of the mv_blocks array. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may zero it together + with start_mb_blocks_num. + - libavcodec - each decoded macroblock increases it by the number + of coded blocks it contains. + */ + int next_free_data_block_num; +}; + +/** + * @} + */ + +#endif /* FF_API_XVMC */ + +#endif /* AVCODEC_XVMC_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavformat/avformat.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavformat/avformat.h new file mode 100644 index 000000000..5b29145a0 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavformat/avformat.h @@ -0,0 +1,1971 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_AVFORMAT_H +#define AVFORMAT_AVFORMAT_H + +/** + * @file + * @ingroup libavf + * Main libavformat public API header + */ + +/** + * @defgroup libavf I/O and Muxing/Demuxing Library + * @{ + * + * Libavformat (lavf) is a library for dealing with various media container + * formats. Its main two purposes are demuxing - i.e. splitting a media file + * into component streams, and the reverse process of muxing - writing supplied + * data in a specified container format. It also has an @ref lavf_io + * "I/O module" which supports a number of protocols for accessing the data (e.g. + * file, tcp, http and others). Before using lavf, you need to call + * av_register_all() to register all compiled muxers, demuxers and protocols. + * Unless you are absolutely sure you won't use libavformat's network + * capabilities, you should also call avformat_network_init(). + * + * A supported input format is described by an AVInputFormat struct, conversely + * an output format is described by AVOutputFormat. You can iterate over all + * registered input/output formats using the av_iformat_next() / + * av_oformat_next() functions. The protocols layer is not part of the public + * API, so you can only get the names of supported protocols with the + * avio_enum_protocols() function. + * + * Main lavf structure used for both muxing and demuxing is AVFormatContext, + * which exports all information about the file being read or written. As with + * most Libav structures, its size is not part of public ABI, so it cannot be + * allocated on stack or directly with av_malloc(). To create an + * AVFormatContext, use avformat_alloc_context() (some functions, like + * avformat_open_input() might do that for you). + * + * Most importantly an AVFormatContext contains: + * @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat + * "output" format. It is either autodetected or set by user for input; + * always set by user for output. + * @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all + * elementary streams stored in the file. AVStreams are typically referred to + * using their index in this array. + * @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or + * set by user for input, always set by user for output (unless you are dealing + * with an AVFMT_NOFILE format). + * + * @section lavf_options Passing options to (de)muxers + * Lavf allows to configure muxers and demuxers using the @ref avoptions + * mechanism. Generic (format-independent) libavformat options are provided by + * AVFormatContext, they can be examined from a user program by calling + * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass + * from avformat_get_class()). Private (format-specific) options are provided by + * AVFormatContext.priv_data if and only if AVInputFormat.priv_class / + * AVOutputFormat.priv_class of the corresponding format struct is non-NULL. + * Further options may be provided by the @ref AVFormatContext.pb "I/O context", + * if its AVClass is non-NULL, and the protocols layer. See the discussion on + * nesting in @ref avoptions documentation to learn how to access those. + * + * @defgroup lavf_decoding Demuxing + * @{ + * Demuxers read a media file and split it into chunks of data (@em packets). A + * @ref AVPacket "packet" contains one or more encoded frames which belongs to a + * single elementary stream. In the lavf API this process is represented by the + * avformat_open_input() function for opening a file, av_read_frame() for + * reading a single packet and finally avformat_close_input(), which does the + * cleanup. + * + * @section lavf_decoding_open Opening a media file + * The minimum information required to open a file is its URL or filename, which + * is passed to avformat_open_input(), as in the following code: + * @code + * const char *url = "in.mp3"; + * AVFormatContext *s = NULL; + * int ret = avformat_open_input(&s, url, NULL, NULL); + * if (ret < 0) + * abort(); + * @endcode + * The above code attempts to allocate an AVFormatContext, open the + * specified file (autodetecting the format) and read the header, exporting the + * information stored there into s. Some formats do not have a header or do not + * store enough information there, so it is recommended that you call the + * avformat_find_stream_info() function which tries to read and decode a few + * frames to find missing information. + * + * In some cases you might want to preallocate an AVFormatContext yourself with + * avformat_alloc_context() and do some tweaking on it before passing it to + * avformat_open_input(). One such case is when you want to use custom functions + * for reading input data instead of lavf internal I/O layer. + * To do that, create your own AVIOContext with avio_alloc_context(), passing + * your reading callbacks to it. Then set the @em pb field of your + * AVFormatContext to newly created AVIOContext. + * + * Since the format of the opened file is in general not known until after + * avformat_open_input() has returned, it is not possible to set demuxer private + * options on a preallocated context. Instead, the options should be passed to + * avformat_open_input() wrapped in an AVDictionary: + * @code + * AVDictionary *options = NULL; + * av_dict_set(&options, "video_size", "640x480", 0); + * av_dict_set(&options, "pixel_format", "rgb24", 0); + * + * if (avformat_open_input(&s, url, NULL, &options) < 0) + * abort(); + * av_dict_free(&options); + * @endcode + * This code passes the private options 'video_size' and 'pixel_format' to the + * demuxer. They would be necessary for e.g. the rawvideo demuxer, since it + * cannot know how to interpret raw video data otherwise. If the format turns + * out to be something different than raw video, those options will not be + * recognized by the demuxer and therefore will not be applied. Such unrecognized + * options are then returned in the options dictionary (recognized options are + * consumed). The calling program can handle such unrecognized options as it + * wishes, e.g. + * @code + * AVDictionaryEntry *e; + * if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) { + * fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key); + * abort(); + * } + * @endcode + * + * After you have finished reading the file, you must close it with + * avformat_close_input(). It will free everything associated with the file. + * + * @section lavf_decoding_read Reading from an opened file + * Reading data from an opened AVFormatContext is done by repeatedly calling + * av_read_frame() on it. Each call, if successful, will return an AVPacket + * containing encoded data for one AVStream, identified by + * AVPacket.stream_index. This packet may be passed straight into the libavcodec + * decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or + * avcodec_decode_subtitle2() if the caller wishes to decode the data. + * + * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be + * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for + * pts/dts, 0 for duration) if the stream does not provide them. The timing + * information will be in AVStream.time_base units, i.e. it has to be + * multiplied by the timebase to convert them to seconds. + * + * If AVPacket.buf is set on the returned packet, then the packet is + * allocated dynamically and the user may keep it indefinitely. + * Otherwise, if AVPacket.buf is NULL, the packet data is backed by a + * static storage somewhere inside the demuxer and the packet is only valid + * until the next av_read_frame() call or closing the file. If the caller + * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy + * of it. + * In both cases, the packet must be freed with av_free_packet() when it is no + * longer needed. + * + * @section lavf_decoding_seek Seeking + * @} + * + * @defgroup lavf_encoding Muxing + * @{ + * Muxers take encoded data in the form of @ref AVPacket "AVPackets" and write + * it into files or other output bytestreams in the specified container format. + * + * The main API functions for muxing are avformat_write_header() for writing the + * file header, av_write_frame() / av_interleaved_write_frame() for writing the + * packets and av_write_trailer() for finalizing the file. + * + * At the beginning of the muxing process, the caller must first call + * avformat_alloc_context() to create a muxing context. The caller then sets up + * the muxer by filling the various fields in this context: + * + * - The @ref AVFormatContext.oformat "oformat" field must be set to select the + * muxer that will be used. + * - Unless the format is of the AVFMT_NOFILE type, the @ref AVFormatContext.pb + * "pb" field must be set to an opened IO context, either returned from + * avio_open2() or a custom one. + * - Unless the format is of the AVFMT_NOSTREAMS type, at least one stream must + * be created with the avformat_new_stream() function. The caller should fill + * the @ref AVStream.codec "stream codec context" information, such as the + * codec @ref AVCodecContext.codec_type "type", @ref AVCodecContext.codec_id + * "id" and other parameters (e.g. width / height, the pixel or sample format, + * etc.) as known. The @ref AVStream.time_base "stream timebase" should + * be set to the timebase that the caller desires to use for this stream (note + * that the timebase actually used by the muxer can be different, as will be + * described later). + * - The caller may fill in additional information, such as @ref + * AVFormatContext.metadata "global" or @ref AVStream.metadata "per-stream" + * metadata, @ref AVFormatContext.chapters "chapters", @ref + * AVFormatContext.programs "programs", etc. as described in the + * AVFormatContext documentation. Whether such information will actually be + * stored in the output depends on what the container format and the muxer + * support. + * + * When the muxing context is fully set up, the caller must call + * avformat_write_header() to initialize the muxer internals and write the file + * header. Whether anything actually is written to the IO context at this step + * depends on the muxer, but this function must always be called. Any muxer + * private options must be passed in the options parameter to this function. + * + * The data is then sent to the muxer by repeatedly calling av_write_frame() or + * av_interleaved_write_frame() (consult those functions' documentation for + * discussion on the difference between them; only one of them may be used with + * a single muxing context, they should not be mixed). Do note that the timing + * information on the packets sent to the muxer must be in the corresponding + * AVStream's timebase. That timebase is set by the muxer (in the + * avformat_write_header() step) and may be different from the timebase + * requested by the caller. + * + * Once all the data has been written, the caller must call av_write_trailer() + * to flush any buffered packets and finalize the output file, then close the IO + * context (if any) and finally free the muxing context with + * avformat_free_context(). + * @} + * + * @defgroup lavf_io I/O Read/Write + * @{ + * @} + * + * @defgroup lavf_codec Demuxers + * @{ + * @defgroup lavf_codec_native Native Demuxers + * @{ + * @} + * @defgroup lavf_codec_wrappers External library wrappers + * @{ + * @} + * @} + * @defgroup lavf_protos I/O Protocols + * @{ + * @} + * @defgroup lavf_internal Internal + * @{ + * @} + * @} + * + */ + +#include <time.h> +#include <stdio.h> /* FILE */ +#include "libavcodec/avcodec.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "avio.h" +#include "libavformat/version.h" + +struct AVFormatContext; + + +/** + * @defgroup metadata_api Public Metadata API + * @{ + * @ingroup libavf + * The metadata API allows libavformat to export metadata tags to a client + * application when demuxing. Conversely it allows a client application to + * set metadata when muxing. + * + * Metadata is exported or set as pairs of key/value strings in the 'metadata' + * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs + * using the @ref lavu_dict "AVDictionary" API. Like all strings in Libav, + * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata + * exported by demuxers isn't checked to be valid UTF-8 in most cases. + * + * Important concepts to keep in mind: + * - Keys are unique; there can never be 2 tags with the same key. This is + * also meant semantically, i.e., a demuxer should not knowingly produce + * several keys that are literally different but semantically identical. + * E.g., key=Author5, key=Author6. In this example, all authors must be + * placed in the same tag. + * - Metadata is flat, not hierarchical; there are no subtags. If you + * want to store, e.g., the email address of the child of producer Alice + * and actor Bob, that could have key=alice_and_bobs_childs_email_address. + * - Several modifiers can be applied to the tag name. This is done by + * appending a dash character ('-') and the modifier name in the order + * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng. + * - language -- a tag whose value is localized for a particular language + * is appended with the ISO 639-2/B 3-letter language code. + * For example: Author-ger=Michael, Author-eng=Mike + * The original/default language is in the unqualified "Author" tag. + * A demuxer should set a default if it sets any translated tag. + * - sorting -- a modified version of a tag that should be used for + * sorting will have '-sort' appended. E.g. artist="The Beatles", + * artist-sort="Beatles, The". + * - Some protocols and demuxers support metadata updates. After a successful + * call to av_read_packet(), AVFormatContext.event_flags or AVStream.event_flags + * will be updated to indicate if metadata changed. In order to detect metadata + * changes on a stream, you need to loop through all streams in the AVFormatContext + * and check their individual event_flags. + * + * - Demuxers attempt to export metadata in a generic format, however tags + * with no generic equivalents are left as they are stored in the container. + * Follows a list of generic tag names: + * + @verbatim + album -- name of the set this work belongs to + album_artist -- main creator of the set/album, if different from artist. + e.g. "Various Artists" for compilation albums. + artist -- main creator of the work + comment -- any additional description of the file. + composer -- who composed the work, if different from artist. + copyright -- name of copyright holder. + creation_time-- date when the file was created, preferably in ISO 8601. + date -- date when the work was created, preferably in ISO 8601. + disc -- number of a subset, e.g. disc in a multi-disc collection. + encoder -- name/settings of the software/hardware that produced the file. + encoded_by -- person/group who created the file. + filename -- original name of the file. + genre -- <self-evident>. + language -- main language in which the work is performed, preferably + in ISO 639-2 format. Multiple languages can be specified by + separating them with commas. + performer -- artist who performed the work, if different from artist. + E.g for "Also sprach Zarathustra", artist would be "Richard + Strauss" and performer "London Philharmonic Orchestra". + publisher -- name of the label/publisher. + service_name -- name of the service in broadcasting (channel name). + service_provider -- name of the service provider in broadcasting. + title -- name of the work. + track -- number of this work in the set, can be in form current/total. + variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of + @endverbatim + * + * Look in the examples section for an application example how to use the Metadata API. + * + * @} + */ + +/* packet functions */ + + +/** + * Allocate and read the payload of a packet and initialize its + * fields with default values. + * + * @param s associated IO context + * @param pkt packet + * @param size desired payload size + * @return >0 (read size) if OK, AVERROR_xxx otherwise + */ +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); + + +/** + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. + * + * @param s associated IO context + * @param pkt packet + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. + */ +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); + +#if FF_API_LAVF_FRAC +/*************************************************/ +/* fractional numbers for exact pts handling */ + +/** + * The exact value of the fractional number is: 'val + num / den'. + * num is assumed to be 0 <= num < den. + */ +typedef struct AVFrac { + int64_t val, num, den; +} AVFrac; +#endif + +/*************************************************/ +/* input/output formats */ + +struct AVCodecTag; + +/** + * This structure contains the data a format has to probe a file. + */ +typedef struct AVProbeData { + const char *filename; + unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ + int buf_size; /**< Size of buf except extra allocated bytes */ + uint8_t *mime_type; /**< mime_type, when known. */ +} AVProbeData; + +#define AVPROBE_SCORE_EXTENSION 50 ///< score for file extension +#define AVPROBE_SCORE_MIME 75 ///< score for file mime type +#define AVPROBE_SCORE_MAX 100 ///< maximum score + +#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer + +/// Demuxer will use avio_open, no opened file should be provided by the caller. +#define AVFMT_NOFILE 0x0001 +#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ +#define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ +#define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for + raw picture data. */ +#define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ +#define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ +#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ +#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */ +#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ +#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ +#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ +#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fall back on binary search via read_timestamp */ +#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fall back on generic search */ +#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ +#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ +#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly + increasing timestamps, but they must + still be monotonic */ +#define AVFMT_TS_NEGATIVE 0x40000 /**< Format allows muxing negative + timestamps. If not set the timestamp + will be shifted in av_write_frame and + av_interleaved_write_frame so they + start from 0. */ + +/** + * @addtogroup lavf_encoding + * @{ + */ +typedef struct AVOutputFormat { + const char *name; + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + const char *mime_type; + const char *extensions; /**< comma-separated filename extensions */ + /* output support */ + enum AVCodecID audio_codec; /**< default audio codec */ + enum AVCodecID video_codec; /**< default video codec */ + enum AVCodecID subtitle_codec; /**< default subtitle codec */ + /** + * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, + * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, + * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, + * AVFMT_TS_NONSTRICT + */ + int flags; + + /** + * List of supported codec_id-codec_tag pairs, ordered by "better + * choice first". The arrays are all terminated by AV_CODEC_ID_NONE. + */ + const struct AVCodecTag * const *codec_tag; + + + const AVClass *priv_class; ///< AVClass for the private context + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVOutputFormat *next; + /** + * size of private data so that it can be allocated in the wrapper + */ + int priv_data_size; + + int (*write_header)(struct AVFormatContext *); + /** + * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags, + * pkt can be NULL in order to flush data buffered in the muxer. + * When flushing, return 0 if there still is more data to flush, + * or 1 if everything was flushed and there is no more buffered + * data. + */ + int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); + int (*write_trailer)(struct AVFormatContext *); + /** + * Currently only used to set pixel format if not YUV420P. + */ + int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, + AVPacket *in, int flush); + /** + * Test if the given codec can be stored in this container. + * + * @return 1 if the codec is supported, 0 if it is not. + * A negative number if unknown. + */ + int (*query_codec)(enum AVCodecID id, int std_compliance); +} AVOutputFormat; +/** + * @} + */ + +/** + * @addtogroup lavf_decoding + * @{ + */ +typedef struct AVInputFormat { + /** + * A comma separated list of short names for the format. New names + * may be appended with a minor bump. + */ + const char *name; + + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + + /** + * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, + * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, + * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK. + */ + int flags; + + /** + * If extensions are defined, then no probe is done. You should + * usually not use extension format guessing because it is not + * reliable enough + */ + const char *extensions; + + const struct AVCodecTag * const *codec_tag; + + const AVClass *priv_class; ///< AVClass for the private context + + /** + * Comma-separated list of mime types. + * It is used check for matching mime types while probing. + * @see av_probe_input_format2 + */ + const char *mime_type; + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVInputFormat *next; + + /** + * Raw demuxers store their codec ID here. + */ + int raw_codec_id; + + /** + * Size of private data so that it can be allocated in the wrapper. + */ + int priv_data_size; + + /** + * Tell if a given file has a chance of being parsed as this format. + * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes + * big so you do not have to check for that unless you need more. + */ + int (*read_probe)(AVProbeData *); + + /** + * Read the format header and initialize the AVFormatContext + * structure. Return 0 if OK. Only used in raw format right + * now. 'avformat_new_stream' should be called to create new streams. + */ + int (*read_header)(struct AVFormatContext *); + + /** + * Read one packet and put it in 'pkt'. pts and flags are also + * set. 'avformat_new_stream' can be called only if the flag + * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a + * background thread). + * @return 0 on success, < 0 on error. + * When returning an error, pkt must not have been allocated + * or must be freed before returning + */ + int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); + + /** + * Close the stream. The AVFormatContext and AVStreams are not + * freed by this function + */ + int (*read_close)(struct AVFormatContext *); + + /** + * Seek to a given timestamp relative to the frames in + * stream component stream_index. + * @param stream_index Must not be -1. + * @param flags Selects which direction should be preferred if no exact + * match is available. + * @return >= 0 on success (but not necessarily the new offset) + */ + int (*read_seek)(struct AVFormatContext *, + int stream_index, int64_t timestamp, int flags); + + /** + * Get the next timestamp in stream[stream_index].time_base units. + * @return the timestamp or AV_NOPTS_VALUE if an error occurred + */ + int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, + int64_t *pos, int64_t pos_limit); + + /** + * Start/resume playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_play)(struct AVFormatContext *); + + /** + * Pause playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_pause)(struct AVFormatContext *); + + /** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + */ + int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); +} AVInputFormat; +/** + * @} + */ + +enum AVStreamParseType { + AVSTREAM_PARSE_NONE, + AVSTREAM_PARSE_FULL, /**< full parsing and repack */ + AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ + AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */ + AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */ +}; + +typedef struct AVIndexEntry { + int64_t pos; + int64_t timestamp; +#define AVINDEX_KEYFRAME 0x0001 + int flags:2; + int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). + int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ +} AVIndexEntry; + +#define AV_DISPOSITION_DEFAULT 0x0001 +#define AV_DISPOSITION_DUB 0x0002 +#define AV_DISPOSITION_ORIGINAL 0x0004 +#define AV_DISPOSITION_COMMENT 0x0008 +#define AV_DISPOSITION_LYRICS 0x0010 +#define AV_DISPOSITION_KARAOKE 0x0020 + +/** + * Track should be used during playback by default. + * Useful for subtitle track that should be displayed + * even when user did not explicitly ask for subtitles. + */ +#define AV_DISPOSITION_FORCED 0x0040 +#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ +#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ +#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ +/** + * The stream is stored in the file as an attached picture/"cover art" (e.g. + * APIC frame in ID3v2). The single packet associated with it will be returned + * among the first few packets read from the file unless seeking takes place. + * It can also be accessed at any time in AVStream.attached_pic. + */ +#define AV_DISPOSITION_ATTACHED_PIC 0x0400 + +/** + * Stream structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVStream) must not be used outside libav*. + */ +typedef struct AVStream { + int index; /**< stream index in AVFormatContext */ + /** + * Format-specific stream ID. + * decoding: set by libavformat + * encoding: set by the user, replaced by libavformat if left unset + */ + int id; + /** + * Codec context associated with this stream. Allocated and freed by + * libavformat. + * + * - decoding: The demuxer exports codec information stored in the headers + * here. + * - encoding: The user sets codec information, the muxer writes it to the + * output. Mandatory fields as specified in AVCodecContext + * documentation must be set even if this AVCodecContext is + * not actually used for encoding. + */ + AVCodecContext *codec; + void *priv_data; + +#if FF_API_LAVF_FRAC + /** + * @deprecated this field is unused + */ + attribute_deprecated + struct AVFrac pts; +#endif + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. + * + * decoding: set by libavformat + * encoding: May be set by the caller before avformat_write_header() to + * provide a hint to the muxer about the desired timebase. In + * avformat_write_header(), the muxer will overwrite this field + * with the timebase that will actually be used for the timestamps + * written into the file (which may or may not be related to the + * user-provided one, depending on the format). + */ + AVRational time_base; + + /** + * Decoding: pts of the first frame of the stream, in stream time base. + * Only set this if you are absolutely 100% sure that the value you set + * it to really is the pts of the first frame. + * This may be undefined (AV_NOPTS_VALUE). + */ + int64_t start_time; + + /** + * Decoding: duration of the stream, in stream time base. + * If a source file does not specify a duration, but does specify + * a bitrate, this value will be estimated from bitrate and file size. + */ + int64_t duration; + + int64_t nb_frames; ///< number of frames in this stream if known or 0 + + int disposition; /**< AV_DISPOSITION_* bit field */ + + enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. + + /** + * sample aspect ratio (0 if unknown) + * - encoding: Set by user. + * - decoding: Set by libavformat. + */ + AVRational sample_aspect_ratio; + + AVDictionary *metadata; + + /** + * Average framerate + * + * - demuxing: May be set by libavformat when creating the stream or in + * avformat_find_stream_info(). + * - muxing: May be set by the caller before avformat_write_header(). + */ + AVRational avg_frame_rate; + + /** + * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet + * will contain the attached picture. + * + * decoding: set by libavformat, must not be modified by the caller. + * encoding: unused + */ + AVPacket attached_pic; + + /** + * An array of side data that applies to the whole stream (i.e. the + * container does not allow it to change between packets). + * + * There may be no overlap between the side data in this array and side data + * in the packets. I.e. a given side data is either exported by the muxer + * (demuxing) / set by the caller (muxing) in this array, then it never + * appears in the packets, or the side data is exported / sent through + * the packets (always in the first packet where the value becomes known or + * changes), then it does not appear in this array. + * + * - demuxing: Set by libavformat when the stream is created. + * - muxing: May be set by the caller before avformat_write_header(). + * + * Freed by libavformat in avformat_free_context(). + */ + AVPacketSideData *side_data; + /** + * The number of elements in the AVStream.side_data array. + */ + int nb_side_data; + + /** + * Flags for the user to detect events happening on the stream. Flags must + * be cleared by the user once the event has been handled. + * A combination of AVSTREAM_EVENT_FLAG_*. + */ + int event_flags; +#define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * Stream information used internally by av_find_stream_info() + */ +#define MAX_STD_TIMEBASES (60*12+5) + struct { + int nb_decoded_frames; + int found_decoder; + + /** + * Those are used for average framerate estimation. + */ + int64_t fps_first_dts; + int fps_first_dts_idx; + int64_t fps_last_dts; + int fps_last_dts_idx; + + } *info; + + int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ + + // Timestamp generation support: + int64_t first_dts; + int64_t cur_dts; + int64_t last_IP_pts; + int last_IP_duration; + + /** + * Number of packets to buffer for codec probing + */ +#define MAX_PROBE_PACKETS 2500 + int probe_packets; + + /** + * Number of frames that have been demuxed during av_find_stream_info() + */ + int codec_info_nb_frames; + + /* av_read_frame() support */ + enum AVStreamParseType need_parsing; + struct AVCodecParserContext *parser; + + /** + * last packet in packet_buffer for this stream when muxing. + */ + struct AVPacketList *last_in_packet_buffer; + AVProbeData probe_data; +#define MAX_REORDER_DELAY 16 + int64_t pts_buffer[MAX_REORDER_DELAY+1]; + + AVIndexEntry *index_entries; /**< Only used if the format does not + support seeking natively. */ + int nb_index_entries; + unsigned int index_entries_allocated_size; +} AVStream; + +#define AV_PROGRAM_RUNNING 1 + +/** + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVProgram) must not be used outside libav*. + */ +typedef struct AVProgram { + int id; + int flags; + enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller + unsigned int *stream_index; + unsigned int nb_stream_indexes; + AVDictionary *metadata; +} AVProgram; + +#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present + (streams are added dynamically) */ + +typedef struct AVChapter { + int id; ///< unique ID to identify the chapter + AVRational time_base; ///< time base in which the start/end timestamps are specified + int64_t start, end; ///< chapter start/end time in time_base units + AVDictionary *metadata; +} AVChapter; + +typedef struct AVFormatInternal AVFormatInternal; + +/** + * Format I/O context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVFormatContext) must not be used outside libav*, use + * avformat_alloc_context() to create an AVFormatContext. + */ +typedef struct AVFormatContext { + /** + * A class for logging and @ref avoptions. Set by avformat_alloc_context(). + * Exports (de)muxer private options if they exist. + */ + const AVClass *av_class; + + /** + * The input container format. + * + * Demuxing only, set by avformat_open_input(). + */ + struct AVInputFormat *iformat; + + /** + * The output container format. + * + * Muxing only, must be set by the caller before avformat_write_header(). + */ + struct AVOutputFormat *oformat; + + /** + * Format private data. This is an AVOptions-enabled struct + * if and only if iformat/oformat.priv_class is not NULL. + * + * - muxing: set by avformat_write_header() + * - demuxing: set by avformat_open_input() + */ + void *priv_data; + + /** + * I/O context. + * + * - demuxing: either set by the user before avformat_open_input() (then + * the user must close it manually) or set by avformat_open_input(). + * - muxing: set by the user before avformat_write_header(). The caller must + * take care of closing / freeing the IO context. + * + * Do NOT set this field if AVFMT_NOFILE flag is set in + * iformat/oformat.flags. In such a case, the (de)muxer will handle + * I/O in some other way and this field will be NULL. + */ + AVIOContext *pb; + + /* stream info */ + /** + * Flags signalling stream properties. A combination of AVFMTCTX_*. + * Set by libavformat. + */ + int ctx_flags; + + /** + * Number of elements in AVFormatContext.streams. + * + * Set by avformat_new_stream(), must not be modified by any other code. + */ + unsigned int nb_streams; + /** + * A list of all streams in the file. New streams are created with + * avformat_new_stream(). + * + * - demuxing: streams are created by libavformat in avformat_open_input(). + * If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also + * appear in av_read_frame(). + * - muxing: streams are created by the user before avformat_write_header(). + * + * Freed by libavformat in avformat_free_context(). + */ + AVStream **streams; + + /** + * input or output filename + * + * - demuxing: set by avformat_open_input() + * - muxing: may be set by the caller before avformat_write_header() + */ + char filename[1024]; + + /** + * Position of the first frame of the component, in + * AV_TIME_BASE fractional seconds. NEVER set this value directly: + * It is deduced from the AVStream values. + * + * Demuxing only, set by libavformat. + */ + int64_t start_time; + + /** + * Duration of the stream, in AV_TIME_BASE fractional + * seconds. Only set this value if you know none of the individual stream + * durations and also do not set any of them. This is deduced from the + * AVStream values if not set. + * + * Demuxing only, set by libavformat. + */ + int64_t duration; + + /** + * Total stream bitrate in bit/s, 0 if not + * available. Never set it directly if the file_size and the + * duration are known as Libav can compute it automatically. + */ + int bit_rate; + + unsigned int packet_size; + int max_delay; + + /** + * Flags modifying the (de)muxer behaviour. A combination of AVFMT_FLAG_*. + * Set by the user before avformat_open_input() / avformat_write_header(). + */ + int flags; +#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. +#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. +#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. +#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS +#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container +#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled +#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible +#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. +#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted +#define AVFMT_FLAG_FLUSH_PACKETS 0x0200 ///< Flush the AVIOContext every packet. +/** + * When muxing, try to avoid writing any random/volatile data to the output. + * This includes any random IDs, real-time timestamps/dates, muxer version, etc. + * + * This flag is mainly intended for testing. + */ +#define AVFMT_FLAG_BITEXACT 0x0400 + + /** + * Maximum size of the data read from input for determining + * the input container format. + * Demuxing only, set by the caller before avformat_open_input(). + */ + unsigned int probesize; + + /** + * Maximum duration (in AV_TIME_BASE units) of the data read + * from input in avformat_find_stream_info(). + * Demuxing only, set by the caller before avformat_find_stream_info(). + */ + int max_analyze_duration; + + const uint8_t *key; + int keylen; + + unsigned int nb_programs; + AVProgram **programs; + + /** + * Forced video codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID video_codec_id; + + /** + * Forced audio codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID audio_codec_id; + + /** + * Forced subtitle codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID subtitle_codec_id; + + /** + * Maximum amount of memory in bytes to use for the index of each stream. + * If the index exceeds this size, entries will be discarded as + * needed to maintain a smaller size. This can lead to slower or less + * accurate seeking (depends on demuxer). + * Demuxers for which a full in-memory index is mandatory will ignore + * this. + * - muxing: unused + * - demuxing: set by user + */ + unsigned int max_index_size; + + /** + * Maximum amount of memory in bytes to use for buffering frames + * obtained from realtime capture devices. + */ + unsigned int max_picture_buffer; + + /** + * Number of chapters in AVChapter array. + * When muxing, chapters are normally written in the file header, + * so nb_chapters should normally be initialized before write_header + * is called. Some muxers (e.g. mov and mkv) can also write chapters + * in the trailer. To write chapters in the trailer, nb_chapters + * must be zero when write_header is called and non-zero when + * write_trailer is called. + * - muxing: set by user + * - demuxing: set by libavformat + */ + unsigned int nb_chapters; + AVChapter **chapters; + + /** + * Metadata that applies to the whole file. + * + * - demuxing: set by libavformat in avformat_open_input() + * - muxing: may be set by the caller before avformat_write_header() + * + * Freed by libavformat in avformat_free_context(). + */ + AVDictionary *metadata; + + /** + * Start time of the stream in real world time, in microseconds + * since the Unix epoch (00:00 1st January 1970). That is, pts=0 in the + * stream was captured at this real world time. + * Muxing only, set by the caller before avformat_write_header(). + */ + int64_t start_time_realtime; + + /** + * The number of frames used for determining the framerate in + * avformat_find_stream_info(). + * Demuxing only, set by the caller before avformat_find_stream_info(). + */ + int fps_probe_size; + + /** + * Error recognition; higher values will detect more errors but may + * misdetect some more or less valid parts as errors. + * Demuxing only, set by the caller before avformat_open_input(). + */ + int error_recognition; + + /** + * Custom interrupt callbacks for the I/O layer. + * + * demuxing: set by the user before avformat_open_input(). + * muxing: set by the user before avformat_write_header() + * (mainly useful for AVFMT_NOFILE formats). The callback + * should also be passed to avio_open2() if it's used to + * open the file. + */ + AVIOInterruptCB interrupt_callback; + + /** + * Flags to enable debugging. + */ + int debug; +#define FF_FDEBUG_TS 0x0001 + + /** + * Maximum buffering duration for interleaving. + * + * To ensure all the streams are interleaved correctly, + * av_interleaved_write_frame() will wait until it has at least one packet + * for each stream before actually writing any packets to the output file. + * When some streams are "sparse" (i.e. there are large gaps between + * successive packets), this can result in excessive buffering. + * + * This field specifies the maximum difference between the timestamps of the + * first and the last packet in the muxing queue, above which libavformat + * will output a packet regardless of whether it has queued a packet for all + * the streams. + * + * Muxing only, set by the caller before avformat_write_header(). + */ + int64_t max_interleave_delta; + + /** + * Allow non-standard and experimental extension + * @see AVCodecContext.strict_std_compliance + */ + int strict_std_compliance; + + /** + * Flags for the user to detect events happening on the file. Flags must + * be cleared by the user once the event has been handled. + * A combination of AVFMT_EVENT_FLAG_*. + */ + int event_flags; +#define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * This buffer is only needed when packets were already buffered but + * not decoded, for example to get the codec parameters in MPEG + * streams. + */ + struct AVPacketList *packet_buffer; + struct AVPacketList *packet_buffer_end; + + /* av_seek_frame() support */ + int64_t data_offset; /**< offset of the first packet */ + + /** + * Raw packets from the demuxer, prior to parsing and decoding. + * This buffer is used for buffering packets until the codec can + * be identified, as parsing cannot be done without knowing the + * codec. + */ + struct AVPacketList *raw_packet_buffer; + struct AVPacketList *raw_packet_buffer_end; + /** + * Packets split by the parser get queued here. + */ + struct AVPacketList *parse_queue; + struct AVPacketList *parse_queue_end; + /** + * Remaining size available for raw_packet_buffer, in bytes. + */ +#define RAW_PACKET_BUFFER_SIZE 2500000 + int raw_packet_buffer_remaining_size; + + /** + * Offset to remap timestamps to be non-negative. + * Expressed in timebase units. + */ + int64_t offset; + + /** + * Timebase for the timestamp offset. + */ + AVRational offset_timebase; + + /** + * An opaque field for libavformat internal usage. + * Must not be accessed in any way by callers. + */ + AVFormatInternal *internal; +} AVFormatContext; + +typedef struct AVPacketList { + AVPacket pkt; + struct AVPacketList *next; +} AVPacketList; + + +/** + * @defgroup lavf_core Core functions + * @ingroup libavf + * + * Functions for querying libavformat capabilities, allocating core structures, + * etc. + * @{ + */ + +/** + * Return the LIBAVFORMAT_VERSION_INT constant. + */ +unsigned avformat_version(void); + +/** + * Return the libavformat build-time configuration. + */ +const char *avformat_configuration(void); + +/** + * Return the libavformat license. + */ +const char *avformat_license(void); + +/** + * Initialize libavformat and register all the muxers, demuxers and + * protocols. If you do not call this function, then you can select + * exactly which formats you want to support. + * + * @see av_register_input_format() + * @see av_register_output_format() + * @see av_register_protocol() + */ +void av_register_all(void); + +void av_register_input_format(AVInputFormat *format); +void av_register_output_format(AVOutputFormat *format); + +/** + * Do global initialization of network components. This is optional, + * but recommended, since it avoids the overhead of implicitly + * doing the setup for each session. + * + * Calling this function will become mandatory if using network + * protocols at some major version bump. + */ +int avformat_network_init(void); + +/** + * Undo the initialization done by avformat_network_init. + */ +int avformat_network_deinit(void); + +/** + * If f is NULL, returns the first registered input format, + * if f is non-NULL, returns the next registered input format after f + * or NULL if f is the last one. + */ +AVInputFormat *av_iformat_next(const AVInputFormat *f); + +/** + * If f is NULL, returns the first registered output format, + * if f is non-NULL, returns the next registered output format after f + * or NULL if f is the last one. + */ +AVOutputFormat *av_oformat_next(const AVOutputFormat *f); + +/** + * Allocate an AVFormatContext. + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. + */ +AVFormatContext *avformat_alloc_context(void); + +/** + * Free an AVFormatContext and all its streams. + * @param s context to free + */ +void avformat_free_context(AVFormatContext *s); + +/** + * Get the AVClass for AVFormatContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avformat_get_class(void); + +/** + * Add a new stream to a media file. + * + * When demuxing, it is called by the demuxer in read_header(). If the + * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also + * be called in read_packet(). + * + * When muxing, should be called by the user before avformat_write_header(). + * + * @param s media file handle + * @param c If non-NULL, the AVCodecContext corresponding to the new stream + * will be initialized to use this codec. This is needed for e.g. codec-specific + * defaults to be set, so codec should be provided if it is known. + * + * @return newly created stream or NULL on error. + */ +AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c); + +/** + * Get side information from stream. + * + * @param stream stream + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t *av_stream_get_side_data(AVStream *stream, + enum AVPacketSideDataType type, int *size); + +AVProgram *av_new_program(AVFormatContext *s, int id); + +/** + * @} + */ + + +/** + * @addtogroup lavf_decoding + * @{ + */ + +/** + * Find AVInputFormat based on the short name of the input format. + */ +AVInputFormat *av_find_input_format(const char *short_name); + +/** + * Guess the file format. + * + * @param pd data to be probed + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + */ +AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); + +/** + * Guess the file format. + * + * @param pd data to be probed + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + * @param score_max A probe score larger that this is required to accept a + * detection, the variable is set to the actual detection + * score afterwards. + * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended + * to retry with a larger probe buffer. + */ +AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); + +/** + * Probe a bytestream to determine the input format. Each time a probe returns + * with a score that is too low, the probe buffer size is increased and another + * attempt is made. When the maximum probe size is reached, the input format + * with the highest score is returned. + * + * @param pb the bytestream to probe + * @param fmt the input format is put here + * @param filename the filename of the stream + * @param logctx the log context + * @param offset the offset within the bytestream to probe from + * @param max_probe_size the maximum probe buffer size (zero for default) + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, + const char *filename, void *logctx, + unsigned int offset, unsigned int max_probe_size); + +/** + * Open an input stream and read the header. The codecs are not opened. + * The stream must be closed with avformat_close_input(). + * + * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). + * May be a pointer to NULL, in which case an AVFormatContext is allocated by this + * function and written into ps. + * Note that a user-supplied AVFormatContext will be freed on failure. + * @param filename Name of the stream to open. + * @param fmt If non-NULL, this parameter forces a specific input format. + * Otherwise the format is autodetected. + * @param options A dictionary filled with AVFormatContext and demuxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @note If you want to use custom IO, preallocate the format context and set its pb field. + */ +int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options); + +/** + * Read packets of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also computes the real framerate in case of MPEG-2 repeat + * frame mode. + * The logical file position is not changed by this function; + * examined packets may be buffered for later processing. + * + * @param ic media file handle + * @param options If non-NULL, an ic.nb_streams long array of pointers to + * dictionaries, where i-th member contains options for + * codec corresponding to i-th stream. + * On return each dictionary will be filled with options that were not found. + * @return >=0 if OK, AVERROR_xxx on error + * + * @note this function isn't guaranteed to open all the codecs, so + * options being non-empty at return is a perfectly normal behavior. + * + * @todo Let the user decide somehow what information is needed so that + * we do not waste time getting stuff the user does not need. + */ +int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); + +/** + * Find the "best" stream in the file. + * The best stream is determined according to various heuristics as the most + * likely to be what the user expects. + * If the decoder parameter is non-NULL, av_find_best_stream will find the + * default decoder for the stream's codec; streams for which no decoder can + * be found are ignored. + * + * @param ic media file handle + * @param type stream type: video, audio, subtitles, etc. + * @param wanted_stream_nb user-requested stream number, + * or -1 for automatic selection + * @param related_stream try to find a stream related (eg. in the same + * program) to this one, or -1 if none + * @param decoder_ret if non-NULL, returns the decoder for the + * selected stream + * @param flags flags; none are currently defined + * @return the non-negative stream number in case of success, + * AVERROR_STREAM_NOT_FOUND if no stream with the requested type + * could be found, + * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder + * @note If av_find_best_stream returns successfully and decoder_ret is not + * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec. + */ +int av_find_best_stream(AVFormatContext *ic, + enum AVMediaType type, + int wanted_stream_nb, + int related_stream, + AVCodec **decoder_ret, + int flags); + +/** + * Return the next frame of a stream. + * This function returns what is stored in the file, and does not validate + * that what is there are valid frames for the decoder. It will split what is + * stored in the file into frames and return one for each call. It will not + * omit invalid data between valid frames so as to give the decoder the maximum + * information possible for decoding. + * + * If pkt->buf is NULL, then the packet is valid until the next + * av_read_frame() or until avformat_close_input(). Otherwise the packet + * is valid indefinitely. In both cases the packet must be freed with + * av_free_packet when it is no longer needed. For video, the packet contains + * exactly one frame. For audio, it contains an integer number of frames if each + * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames + * have a variable size (e.g. MPEG audio), then it contains one frame. + * + * pkt->pts, pkt->dts and pkt->duration are always set to correct + * values in AVStream.time_base units (and guessed if the format cannot + * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format + * has B-frames, so it is better to rely on pkt->dts if you do not + * decompress the payload. + * + * @return 0 if OK, < 0 on error or end of file + */ +int av_read_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Seek to the keyframe at timestamp. + * 'timestamp' in 'stream_index'. + * + * @param s media file handle + * @param stream_index If stream_index is (-1), a default + * stream is selected, and timestamp is automatically converted + * from AV_TIME_BASE units to the stream specific time_base. + * @param timestamp Timestamp in AVStream.time_base units + * or, if no stream is specified, in AV_TIME_BASE units. + * @param flags flags which select direction and seeking mode + * @return >= 0 on success + */ +int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, + int flags); + +/** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + * + * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and + * are the file position (this may not be supported by all demuxers). + * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames + * in the stream with stream_index (this may not be supported by all demuxers). + * Otherwise all timestamps are in units of the stream selected by stream_index + * or if stream_index is -1, in AV_TIME_BASE units. + * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as + * keyframes (this may not be supported by all demuxers). + * + * @param s media file handle + * @param stream_index index of the stream which is used as time base reference + * @param min_ts smallest acceptable timestamp + * @param ts target timestamp + * @param max_ts largest acceptable timestamp + * @param flags flags + * @return >=0 on success, error code otherwise + * + * @note This is part of the new seek API which is still under construction. + * Thus do not use this yet. It may change at any time, do not expect + * ABI compatibility yet! + */ +int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); + +/** + * Start playing a network-based stream (e.g. RTSP stream) at the + * current position. + */ +int av_read_play(AVFormatContext *s); + +/** + * Pause a network-based stream (e.g. RTSP stream). + * + * Use av_read_play() to resume it. + */ +int av_read_pause(AVFormatContext *s); + +/** + * Close an opened input AVFormatContext. Free it and all its contents + * and set *s to NULL. + */ +void avformat_close_input(AVFormatContext **s); +/** + * @} + */ + +#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward +#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes +#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes +#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number + +/** + * @addtogroup lavf_encoding + * @{ + */ +/** + * Allocate the stream private data and write the stream header to + * an output media file. + * + * @param s Media file handle, must be allocated with avformat_alloc_context(). + * Its oformat field must be set to the desired output format; + * Its pb field must be set to an already opened AVIOContext. + * @param options An AVDictionary filled with AVFormatContext and muxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, negative AVERROR on failure. + * + * @see av_opt_find, av_dict_set, avio_open, av_oformat_next. + */ +int avformat_write_header(AVFormatContext *s, AVDictionary **options); + +/** + * Write a packet to an output media file. + * + * This function passes the packet directly to the muxer, without any buffering + * or reordering. The caller is responsible for correctly interleaving the + * packets if the format requires it. Callers that want libavformat to handle + * the interleaving should call av_interleaved_write_frame() instead of this + * function. + * + * @param s media file handle + * @param pkt The packet containing the data to be written. Note that unlike + * av_interleaved_write_frame(), this function does not take + * ownership of the packet passed to it (though some muxers may make + * an internal reference to the input packet). + * <br> + * This parameter can be NULL (at any time, not just at the end), in + * order to immediately flush data buffered within the muxer, for + * muxers that buffer up data internally before writing it to the + * output. + * <br> + * Packet's @ref AVPacket.stream_index "stream_index" field must be + * set to the index of the corresponding stream in @ref + * AVFormatContext.streams "s->streams". It is very strongly + * recommended that timing information (@ref AVPacket.pts "pts", @ref + * AVPacket.dts "dts", @ref AVPacket.duration "duration") is set to + * correct values. + * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush + * + * @see av_interleaved_write_frame() + */ +int av_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Write a packet to an output media file ensuring correct interleaving. + * + * This function will buffer the packets internally as needed to make sure the + * packets in the output file are properly interleaved in the order of + * increasing dts. Callers doing their own interleaving should call + * av_write_frame() instead of this function. + * + * @param s media file handle + * @param pkt The packet containing the data to be written. + * <br> + * If the packet is reference-counted, this function will take + * ownership of this reference and unreference it later when it sees + * fit. + * The caller must not access the data through this reference after + * this function returns. If the packet is not reference-counted, + * libavformat will make a copy. + * <br> + * This parameter can be NULL (at any time, not just at the end), to + * flush the interleaving queues. + * <br> + * Packet's @ref AVPacket.stream_index "stream_index" field must be + * set to the index of the corresponding stream in @ref + * AVFormatContext.streams "s->streams". It is very strongly + * recommended that timing information (@ref AVPacket.pts "pts", @ref + * AVPacket.dts "dts", @ref AVPacket.duration "duration") is set to + * correct values. + * + * @return 0 on success, a negative AVERROR on error. Libavformat will always + * take care of freeing the packet, even if this function fails. + * + * @see av_write_frame(), AVFormatContext.max_interleave_delta + */ +int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Write the stream trailer to an output media file and free the + * file private data. + * + * May only be called after a successful call to avformat_write_header. + * + * @param s media file handle + * @return 0 if OK, AVERROR_xxx on error + */ +int av_write_trailer(AVFormatContext *s); + +/** + * Return the output format in the list of registered output formats + * which best matches the provided parameters, or return NULL if + * there is no match. + * + * @param short_name if non-NULL checks if short_name matches with the + * names of the registered formats + * @param filename if non-NULL checks if filename terminates with the + * extensions of the registered formats + * @param mime_type if non-NULL checks if mime_type matches with the + * MIME type of the registered formats + */ +AVOutputFormat *av_guess_format(const char *short_name, + const char *filename, + const char *mime_type); + +/** + * Guess the codec ID based upon muxer and filename. + */ +enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, + const char *filename, const char *mime_type, + enum AVMediaType type); + +/** + * @} + */ + + +/** + * @defgroup lavf_misc Utility functions + * @ingroup libavf + * @{ + * + * Miscellaneous utility functions related to both muxing and demuxing + * (or neither). + */ + +/** + * Send a nice hexadecimal dump of a buffer to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump(FILE *f, const uint8_t *buf, int size); + +/** + * Send a nice hexadecimal dump of a buffer to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size); + +/** + * Send a nice dump of a packet to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); + + +/** + * Send a nice dump of a packet to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st); + +/** + * Get the AVCodecID for the given codec tag tag. + * If no codec id is found returns AV_CODEC_ID_NONE. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + * @param tag codec tag to match to a codec ID + */ +enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); + +/** + * Get the codec tag for the given codec id id. + * If no codec tag is found returns 0. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + * @param id codec ID to match to a codec tag + */ +unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id); + +int av_find_default_stream_index(AVFormatContext *s); + +/** + * Get the index for a specific timestamp. + * + * @param st stream that the timestamp belongs to + * @param timestamp timestamp to retrieve the index for + * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond + * to the timestamp which is <= the requested one, if backward + * is 0, then it will be >= + * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise + * @return < 0 if no such timestamp could be found + */ +int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); + +/** + * Add an index entry into a sorted list. Update the entry if the list + * already contains it. + * + * @param timestamp timestamp in the time base of the given stream + */ +int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, + int size, int distance, int flags); + + +/** + * Split a URL string into components. + * + * The pointers to buffers for storing individual components may be null, + * in order to ignore that component. Buffers for components not found are + * set to empty strings. If the port is not found, it is set to a negative + * value. + * + * @param proto the buffer for the protocol + * @param proto_size the size of the proto buffer + * @param authorization the buffer for the authorization + * @param authorization_size the size of the authorization buffer + * @param hostname the buffer for the host name + * @param hostname_size the size of the hostname buffer + * @param port_ptr a pointer to store the port number in + * @param path the buffer for the path + * @param path_size the size of the path buffer + * @param url the URL to split + */ +void av_url_split(char *proto, int proto_size, + char *authorization, int authorization_size, + char *hostname, int hostname_size, + int *port_ptr, + char *path, int path_size, + const char *url); + + +/** + * Print detailed information about the input or output format, such as + * duration, bitrate, streams, container, programs, metadata, side data, + * codec and time base. + * + * @param ic the context to analyze + * @param index the index to print, if you have multiple inputs or outputs + * @param url the URL to print, such as source or destination file + * @param is_output whether the context is input or ouput + */ +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); + +/** + * Return in 'buf' the path with '%d' replaced by a number. + * + * Also handles the '%0nd' format where 'n' is the total number + * of digits and '%%'. + * + * @param buf destination buffer + * @param buf_size destination buffer size + * @param path numbered sequence string + * @param number frame number + * @return 0 if OK, -1 on format error + */ +int av_get_frame_filename(char *buf, int buf_size, + const char *path, int number); + +/** + * Check whether filename actually is a numbered sequence generator. + * + * @param filename possible numbered sequence string + * @return 1 if a valid numbered sequence string, 0 otherwise + */ +int av_filename_number_test(const char *filename); + +/** + * Generate an SDP for an RTP session. + * + * Note, this overwrites the id values of AVStreams in the muxer contexts + * for getting unique dynamic payload types. + * + * @param ac array of AVFormatContexts describing the RTP streams. If the + * array is composed by only one context, such context can contain + * multiple AVStreams (one AVStream per RTP stream). Otherwise, + * all the contexts in the array (an AVCodecContext per RTP stream) + * must contain only one AVStream. + * @param n_files number of AVCodecContexts contained in ac + * @param buf buffer where the SDP will be stored (must be allocated by + * the caller) + * @param size the size of the buffer + * @return 0 if OK, AVERROR_xxx on error + */ +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); + +/** + * Return a positive value if the given filename has one of the given + * extensions, 0 otherwise. + * + * @param filename file name to check against the given extensions + * @param extensions a comma-separated list of filename extensions + */ +int av_match_ext(const char *filename, const char *extensions); + +/** + * Test if the given container can store a codec. + * + * @param ofmt container to check for compatibility + * @param codec_id codec to potentially store in container + * @param std_compliance standards compliance level, one of FF_COMPLIANCE_* + * + * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. + * A negative number if this information is not available. + */ +int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, + int std_compliance); + +/** + * @defgroup riff_fourcc RIFF FourCCs + * @{ + * Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are + * meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the + * following code: + * @code + * uint32_t tag = MKTAG('H', '2', '6', '4'); + * const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 }; + * enum AVCodecID id = av_codec_get_id(table, tag); + * @endcode + */ +/** + * @return the table mapping RIFF FourCCs for video to libavcodec AVCodecID. + */ +const struct AVCodecTag *avformat_get_riff_video_tags(void); +/** + * @return the table mapping RIFF FourCCs for audio to AVCodecID. + */ +const struct AVCodecTag *avformat_get_riff_audio_tags(void); +/** + * @} + */ + +/** + * @} + */ + +#endif /* AVFORMAT_AVFORMAT_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavformat/avio.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavformat/avio.h new file mode 100644 index 000000000..3360e8296 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavformat/avio.h @@ -0,0 +1,439 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef AVFORMAT_AVIO_H +#define AVFORMAT_AVIO_H + +/** + * @file + * @ingroup lavf_io + * Buffered I/O operations + */ + +#include <stdint.h> + +#include "libavutil/common.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "libavformat/version.h" + + +#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ + +/** + * Callback for checking whether to abort blocking functions. + * AVERROR_EXIT is returned in this case by the interrupted + * function. During blocking operations, callback is called with + * opaque as parameter. If the callback returns 1, the + * blocking operation will be aborted. + * + * No members can be added to this struct without a major bump, if + * new elements have been added after this struct in AVFormatContext + * or AVIOContext. + */ +typedef struct AVIOInterruptCB { + int (*callback)(void*); + void *opaque; +} AVIOInterruptCB; + +/** + * Bytestream IO Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVIOContext) must not be used outside libav*. + * + * @note None of the function pointers in AVIOContext should be called + * directly, they should only be set by the client application + * when implementing custom I/O. Normally these are set to the + * function pointers specified in avio_alloc_context() + */ +typedef struct AVIOContext { + /** + * A class for private options. + * + * If this AVIOContext is created by avio_open2(), av_class is set and + * passes the options down to protocols. + * + * If this AVIOContext is manually allocated, then av_class may be set by + * the caller. + * + * warning -- this field can be NULL, be sure to not pass this AVIOContext + * to any av_opt_* functions in that case. + */ + const AVClass *av_class; + unsigned char *buffer; /**< Start of the buffer. */ + int buffer_size; /**< Maximum buffer size */ + unsigned char *buf_ptr; /**< Current position in the buffer */ + unsigned char *buf_end; /**< End of the data, may be less than + buffer+buffer_size if the read function returned + less data than requested, e.g. for streams where + no more data has been received yet. */ + void *opaque; /**< A private pointer, passed to the read/write/seek/... + functions. */ + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); + int64_t (*seek)(void *opaque, int64_t offset, int whence); + int64_t pos; /**< position in the file of the current buffer */ + int must_flush; /**< true if the next seek should flush */ + int eof_reached; /**< true if eof reached */ + int write_flag; /**< true if open for writing */ + int max_packet_size; + unsigned long checksum; + unsigned char *checksum_ptr; + unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); + int error; /**< contains the error code or 0 if no error happened */ + /** + * Pause or resume playback for network streaming protocols - e.g. MMS. + */ + int (*read_pause)(void *opaque, int pause); + /** + * Seek to a given timestamp in stream with the specified stream_index. + * Needed for some network streaming protocols which don't support seeking + * to byte position. + */ + int64_t (*read_seek)(void *opaque, int stream_index, + int64_t timestamp, int flags); + /** + * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. + */ + int seekable; +} AVIOContext; + +/* unbuffered I/O */ + +/** + * Return AVIO_FLAG_* access flags corresponding to the access permissions + * of the resource in url, or a negative value corresponding to an + * AVERROR code in case of failure. The returned access flags are + * masked by the value in flags. + * + * @note This function is intrinsically unsafe, in the sense that the + * checked resource may change its existence or permission status from + * one call to another. Thus you should not trust the returned value, + * unless you are sure that no other processes are accessing the + * checked resource. + */ +int avio_check(const char *url, int flags); + +/** + * Allocate and initialize an AVIOContext for buffered I/O. It must be later + * freed with av_free(). + * + * @param buffer Memory block for input/output operations via AVIOContext. + * The buffer must be allocated with av_malloc() and friends. + * @param buffer_size The buffer size is very important for performance. + * For protocols with fixed blocksize it should be set to this blocksize. + * For others a typical size is a cache page, e.g. 4kb. + * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. + * @param opaque An opaque pointer to user-specific data. + * @param read_packet A function for refilling the buffer, may be NULL. + * @param write_packet A function for writing the buffer contents, may be NULL. + * @param seek A function for seeking to specified byte position, may be NULL. + * + * @return Allocated AVIOContext or NULL on failure. + */ +AVIOContext *avio_alloc_context( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +void avio_w8(AVIOContext *s, int b); +void avio_write(AVIOContext *s, const unsigned char *buf, int size); +void avio_wl64(AVIOContext *s, uint64_t val); +void avio_wb64(AVIOContext *s, uint64_t val); +void avio_wl32(AVIOContext *s, unsigned int val); +void avio_wb32(AVIOContext *s, unsigned int val); +void avio_wl24(AVIOContext *s, unsigned int val); +void avio_wb24(AVIOContext *s, unsigned int val); +void avio_wl16(AVIOContext *s, unsigned int val); +void avio_wb16(AVIOContext *s, unsigned int val); + +/** + * Write a NULL-terminated string. + * @return number of bytes written. + */ +int avio_put_str(AVIOContext *s, const char *str); + +/** + * Convert an UTF-8 string to UTF-16LE and write it. + * @return number of bytes written. + */ +int avio_put_str16le(AVIOContext *s, const char *str); + +/** + * Passing this as the "whence" parameter to a seek function causes it to + * return the filesize without seeking anywhere. Supporting this is optional. + * If it is not supported then the seek function will return <0. + */ +#define AVSEEK_SIZE 0x10000 + +/** + * Oring this flag as into the "whence" parameter to a seek function causes it to + * seek by any means (like reopening and linear reading) or other normally unreasonble + * means that can be extreemly slow. + * This may be ignored by the seek code. + */ +#define AVSEEK_FORCE 0x20000 + +/** + * fseek() equivalent for AVIOContext. + * @return new position or AVERROR. + */ +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); + +/** + * Skip given number of bytes forward + * @return new position or AVERROR. + */ +static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset) +{ + return avio_seek(s, offset, SEEK_CUR); +} + +/** + * ftell() equivalent for AVIOContext. + * @return position or AVERROR. + */ +static av_always_inline int64_t avio_tell(AVIOContext *s) +{ + return avio_seek(s, 0, SEEK_CUR); +} + +/** + * Get the filesize. + * @return filesize or AVERROR + */ +int64_t avio_size(AVIOContext *s); + +/** @warning currently size is limited */ +int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); + +void avio_flush(AVIOContext *s); + + +/** + * Read size bytes from AVIOContext into buf. + * @return number of bytes read or AVERROR + */ +int avio_read(AVIOContext *s, unsigned char *buf, int size); + +/** + * @name Functions for reading from AVIOContext + * @{ + * + * @note return 0 if EOF, so you cannot use it if EOF handling is + * necessary + */ +int avio_r8 (AVIOContext *s); +unsigned int avio_rl16(AVIOContext *s); +unsigned int avio_rl24(AVIOContext *s); +unsigned int avio_rl32(AVIOContext *s); +uint64_t avio_rl64(AVIOContext *s); +unsigned int avio_rb16(AVIOContext *s); +unsigned int avio_rb24(AVIOContext *s); +unsigned int avio_rb32(AVIOContext *s); +uint64_t avio_rb64(AVIOContext *s); +/** + * @} + */ + +/** + * Read a string from pb into buf. The reading will terminate when either + * a NULL character was encountered, maxlen bytes have been read, or nothing + * more can be read from pb. The result is guaranteed to be NULL-terminated, it + * will be truncated if buf is too small. + * Note that the string is not interpreted or validated in any way, it + * might get truncated in the middle of a sequence for multi-byte encodings. + * + * @return number of bytes read (is always <= maxlen). + * If reading ends on EOF or error, the return value will be one more than + * bytes actually read. + */ +int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); + +/** + * Read a UTF-16 string from pb and convert it to UTF-8. + * The reading will terminate when either a null or invalid character was + * encountered or maxlen bytes have been read. + * @return number of bytes read (is always <= maxlen) + */ +int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); + + +/** + * @name URL open modes + * The flags argument to avio_open must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define AVIO_FLAG_READ 1 /**< read-only */ +#define AVIO_FLAG_WRITE 2 /**< write-only */ +#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define AVIO_FLAG_NONBLOCK 8 + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param url resource to access + * @param flags flags which control how the resource indicated by url + * is to be opened + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open(AVIOContext **s, const char *url, int flags); + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param url resource to access + * @param flags flags which control how the resource indicated by url + * is to be opened + * @param int_cb an interrupt callback to be used at the protocols level + * @param options A dictionary filled with protocol-private options. On return + * this parameter will be destroyed and replaced with a dict containing options + * that were not found. May be NULL. + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open2(AVIOContext **s, const char *url, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options); + +/** + * Close the resource accessed by the AVIOContext s and free it. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_closep + */ +int avio_close(AVIOContext *s); + +/** + * Close the resource accessed by the AVIOContext *s, free it + * and set the pointer pointing to it to NULL. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_close + */ +int avio_closep(AVIOContext **s); + + +/** + * Open a write only memory stream. + * + * @param s new IO context + * @return zero if no error. + */ +int avio_open_dyn_buf(AVIOContext **s); + +/** + * Return the written size and a pointer to the buffer. The buffer + * must be freed with av_free(). + * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * + * @param s IO context + * @param pbuffer pointer to a byte buffer + * @return the length of the byte buffer + */ +int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); + +/** + * Iterate through names of available protocols. + * + * @param opaque A private pointer representing current protocol. + * It must be a pointer to NULL on first iteration and will + * be updated by successive calls to avio_enum_protocols. + * @param output If set to 1, iterate over output protocols, + * otherwise over input protocols. + * + * @return A static string containing the name of current protocol or NULL + */ +const char *avio_enum_protocols(void **opaque, int output); + +/** + * Pause and resume playing - only meaningful if using a network streaming + * protocol (e.g. MMS). + * + * @param h IO context from which to call the read_pause function pointer + * @param pause 1 for pause, 0 for resume + */ +int avio_pause(AVIOContext *h, int pause); + +/** + * Seek to a given timestamp relative to some component stream. + * Only meaningful if using a network streaming protocol (e.g. MMS.). + * + * @param h IO context from which to call the seek function pointers + * @param stream_index The stream index that the timestamp is relative to. + * If stream_index is (-1) the timestamp should be in AV_TIME_BASE + * units from the beginning of the presentation. + * If a stream_index >= 0 is used and the protocol does not support + * seeking based on component streams, the call will fail with ENOTSUP. + * @param timestamp timestamp in AVStream.time_base units + * or if there is no stream specified then in AV_TIME_BASE units. + * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE + * and AVSEEK_FLAG_ANY. The protocol may silently ignore + * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will + * fail with ENOTSUP if used and not supported. + * @return >= 0 on success + * @see AVInputFormat::read_seek + */ +int64_t avio_seek_time(AVIOContext *h, int stream_index, + int64_t timestamp, int flags); + +#endif /* AVFORMAT_AVIO_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavformat/version.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavformat/version.h new file mode 100644 index 000000000..181d2689b --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavformat/version.h @@ -0,0 +1,61 @@ +/* + * Version macros. + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_VERSION_H +#define AVFORMAT_VERSION_H + +/** + * @file + * @ingroup libavf + * Libavformat version macros + */ + +#include "libavutil/version.h" + +#define LIBAVFORMAT_VERSION_MAJOR 56 +#define LIBAVFORMAT_VERSION_MINOR 1 +#define LIBAVFORMAT_VERSION_MICRO 0 + +#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT + +#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ +#ifndef FF_API_LAVF_BITEXACT +#define FF_API_LAVF_BITEXACT (LIBAVFORMAT_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_LAVF_FRAC +#define FF_API_LAVF_FRAC (LIBAVFORMAT_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_LAVF_CODEC_TB +#define FF_API_LAVF_CODEC_TB (LIBAVFORMAT_VERSION_MAJOR < 57) +#endif + +#endif /* AVFORMAT_VERSION_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavresample/avresample.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavresample/avresample.h new file mode 100644 index 000000000..b705a45cd --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavresample/avresample.h @@ -0,0 +1,498 @@ +/* + * Copyright (c) 2012 Justin Ruggles <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVRESAMPLE_AVRESAMPLE_H +#define AVRESAMPLE_AVRESAMPLE_H + +/** + * @file + * @ingroup lavr + * external API header + */ + +/** + * @defgroup lavr Libavresample + * @{ + * + * Libavresample (lavr) is a library that handles audio resampling, sample + * format conversion and mixing. + * + * Interaction with lavr is done through AVAudioResampleContext, which is + * allocated with avresample_alloc_context(). It is opaque, so all parameters + * must be set with the @ref avoptions API. + * + * For example the following code will setup conversion from planar float sample + * format to interleaved signed 16-bit integer, downsampling from 48kHz to + * 44.1kHz and downmixing from 5.1 channels to stereo (using the default mixing + * matrix): + * @code + * AVAudioResampleContext *avr = avresample_alloc_context(); + * av_opt_set_int(avr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0); + * av_opt_set_int(avr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0); + * av_opt_set_int(avr, "in_sample_rate", 48000, 0); + * av_opt_set_int(avr, "out_sample_rate", 44100, 0); + * av_opt_set_int(avr, "in_sample_fmt", AV_SAMPLE_FMT_FLTP, 0); + * av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); + * @endcode + * + * Once the context is initialized, it must be opened with avresample_open(). If + * you need to change the conversion parameters, you must close the context with + * avresample_close(), change the parameters as described above, then reopen it + * again. + * + * The conversion itself is done by repeatedly calling avresample_convert(). + * Note that the samples may get buffered in two places in lavr. The first one + * is the output FIFO, where the samples end up if the output buffer is not + * large enough. The data stored in there may be retrieved at any time with + * avresample_read(). The second place is the resampling delay buffer, + * applicable only when resampling is done. The samples in it require more input + * before they can be processed. Their current amount is returned by + * avresample_get_delay(). At the end of conversion the resampling buffer can be + * flushed by calling avresample_convert() with NULL input. + * + * The following code demonstrates the conversion loop assuming the parameters + * from above and caller-defined functions get_input() and handle_output(): + * @code + * uint8_t **input; + * int in_linesize, in_samples; + * + * while (get_input(&input, &in_linesize, &in_samples)) { + * uint8_t *output + * int out_linesize; + * int out_samples = avresample_get_out_samples(avr, in_samples); + * + * av_samples_alloc(&output, &out_linesize, 2, out_samples, + * AV_SAMPLE_FMT_S16, 0); + * out_samples = avresample_convert(avr, &output, out_linesize, out_samples, + * input, in_linesize, in_samples); + * handle_output(output, out_linesize, out_samples); + * av_freep(&output); + * } + * @endcode + * + * When the conversion is finished and the FIFOs are flushed if required, the + * conversion context and everything associated with it must be freed with + * avresample_free(). + */ + +#include "libavutil/avutil.h" +#include "libavutil/channel_layout.h" +#include "libavutil/dict.h" +#include "libavutil/frame.h" +#include "libavutil/log.h" +#include "libavutil/mathematics.h" + +#include "libavresample/version.h" + +#define AVRESAMPLE_MAX_CHANNELS 32 + +typedef struct AVAudioResampleContext AVAudioResampleContext; + +/** Mixing Coefficient Types */ +enum AVMixCoeffType { + AV_MIX_COEFF_TYPE_Q8, /** 16-bit 8.8 fixed-point */ + AV_MIX_COEFF_TYPE_Q15, /** 32-bit 17.15 fixed-point */ + AV_MIX_COEFF_TYPE_FLT, /** floating-point */ + AV_MIX_COEFF_TYPE_NB, /** Number of coeff types. Not part of ABI */ +}; + +/** Resampling Filter Types */ +enum AVResampleFilterType { + AV_RESAMPLE_FILTER_TYPE_CUBIC, /**< Cubic */ + AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL, /**< Blackman Nuttall Windowed Sinc */ + AV_RESAMPLE_FILTER_TYPE_KAISER, /**< Kaiser Windowed Sinc */ +}; + +enum AVResampleDitherMethod { + AV_RESAMPLE_DITHER_NONE, /**< Do not use dithering */ + AV_RESAMPLE_DITHER_RECTANGULAR, /**< Rectangular Dither */ + AV_RESAMPLE_DITHER_TRIANGULAR, /**< Triangular Dither*/ + AV_RESAMPLE_DITHER_TRIANGULAR_HP, /**< Triangular Dither with High Pass */ + AV_RESAMPLE_DITHER_TRIANGULAR_NS, /**< Triangular Dither with Noise Shaping */ + AV_RESAMPLE_DITHER_NB, /**< Number of dither types. Not part of ABI. */ +}; + +/** + * Return the LIBAVRESAMPLE_VERSION_INT constant. + */ +unsigned avresample_version(void); + +/** + * Return the libavresample build-time configuration. + * @return configure string + */ +const char *avresample_configuration(void); + +/** + * Return the libavresample license. + */ +const char *avresample_license(void); + +/** + * Get the AVClass for AVAudioResampleContext. + * + * Can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options + * without allocating a context. + * + * @see av_opt_find(). + * + * @return AVClass for AVAudioResampleContext + */ +const AVClass *avresample_get_class(void); + +/** + * Allocate AVAudioResampleContext and set options. + * + * @return allocated audio resample context, or NULL on failure + */ +AVAudioResampleContext *avresample_alloc_context(void); + +/** + * Initialize AVAudioResampleContext. + * @note The context must be configured using the AVOption API. + * + * @see av_opt_set_int() + * @see av_opt_set_dict() + * + * @param avr audio resample context + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_open(AVAudioResampleContext *avr); + +/** + * Check whether an AVAudioResampleContext is open or closed. + * + * @param avr AVAudioResampleContext to check + * @return 1 if avr is open, 0 if avr is closed. + */ +int avresample_is_open(AVAudioResampleContext *avr); + +/** + * Close AVAudioResampleContext. + * + * This closes the context, but it does not change the parameters. The context + * can be reopened with avresample_open(). It does, however, clear the output + * FIFO and any remaining leftover samples in the resampling delay buffer. If + * there was a custom matrix being used, that is also cleared. + * + * @see avresample_convert() + * @see avresample_set_matrix() + * + * @param avr audio resample context + */ +void avresample_close(AVAudioResampleContext *avr); + +/** + * Free AVAudioResampleContext and associated AVOption values. + * + * This also calls avresample_close() before freeing. + * + * @param avr audio resample context + */ +void avresample_free(AVAudioResampleContext **avr); + +/** + * Generate a channel mixing matrix. + * + * This function is the one used internally by libavresample for building the + * default mixing matrix. It is made public just as a utility function for + * building custom matrices. + * + * @param in_layout input channel layout + * @param out_layout output channel layout + * @param center_mix_level mix level for the center channel + * @param surround_mix_level mix level for the surround channel(s) + * @param lfe_mix_level mix level for the low-frequency effects channel + * @param normalize if 1, coefficients will be normalized to prevent + * overflow. if 0, coefficients will not be + * normalized. + * @param[out] matrix mixing coefficients; matrix[i + stride * o] is + * the weight of input channel i in output channel o. + * @param stride distance between adjacent input channels in the + * matrix array + * @param matrix_encoding matrixed stereo downmix mode (e.g. dplii) + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout, + double center_mix_level, double surround_mix_level, + double lfe_mix_level, int normalize, double *matrix, + int stride, enum AVMatrixEncoding matrix_encoding); + +/** + * Get the current channel mixing matrix. + * + * If no custom matrix has been previously set or the AVAudioResampleContext is + * not open, an error is returned. + * + * @param avr audio resample context + * @param matrix mixing coefficients; matrix[i + stride * o] is the weight of + * input channel i in output channel o. + * @param stride distance between adjacent input channels in the matrix array + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_get_matrix(AVAudioResampleContext *avr, double *matrix, + int stride); + +/** + * Set channel mixing matrix. + * + * Allows for setting a custom mixing matrix, overriding the default matrix + * generated internally during avresample_open(). This function can be called + * anytime on an allocated context, either before or after calling + * avresample_open(), as long as the channel layouts have been set. + * avresample_convert() always uses the current matrix. + * Calling avresample_close() on the context will clear the current matrix. + * + * @see avresample_close() + * + * @param avr audio resample context + * @param matrix mixing coefficients; matrix[i + stride * o] is the weight of + * input channel i in output channel o. + * @param stride distance between adjacent input channels in the matrix array + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix, + int stride); + +/** + * Set a customized input channel mapping. + * + * This function can only be called when the allocated context is not open. + * Also, the input channel layout must have already been set. + * + * Calling avresample_close() on the context will clear the channel mapping. + * + * The map for each input channel specifies the channel index in the source to + * use for that particular channel, or -1 to mute the channel. Source channels + * can be duplicated by using the same index for multiple input channels. + * + * Examples: + * + * Reordering 5.1 AAC order (C,L,R,Ls,Rs,LFE) to Libav order (L,R,C,LFE,Ls,Rs): + * { 1, 2, 0, 5, 3, 4 } + * + * Muting the 3rd channel in 4-channel input: + * { 0, 1, -1, 3 } + * + * Duplicating the left channel of stereo input: + * { 0, 0 } + * + * @param avr audio resample context + * @param channel_map customized input channel mapping + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_set_channel_mapping(AVAudioResampleContext *avr, + const int *channel_map); + +/** + * Set compensation for resampling. + * + * This can be called anytime after avresample_open(). If resampling is not + * automatically enabled because of a sample rate conversion, the + * "force_resampling" option must have been set to 1 when opening the context + * in order to use resampling compensation. + * + * @param avr audio resample context + * @param sample_delta compensation delta, in samples + * @param compensation_distance compensation distance, in samples + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta, + int compensation_distance); + +/** + * Provide the upper bound on the number of samples the configured + * conversion would output. + * + * @param avr audio resample context + * @param in_nb_samples number of input samples + * + * @return number of samples or AVERROR(EINVAL) if the value + * would exceed INT_MAX + */ + +int avresample_get_out_samples(AVAudioResampleContext *avr, int in_nb_samples); + +/** + * Convert input samples and write them to the output FIFO. + * + * The upper bound on the number of output samples can be obtained through + * avresample_get_out_samples(). + * + * The output data can be NULL or have fewer allocated samples than required. + * In this case, any remaining samples not written to the output will be added + * to an internal FIFO buffer, to be returned at the next call to this function + * or to avresample_read(). + * + * If converting sample rate, there may be data remaining in the internal + * resampling delay buffer. avresample_get_delay() tells the number of remaining + * samples. To get this data as output, call avresample_convert() with NULL + * input. + * + * At the end of the conversion process, there may be data remaining in the + * internal FIFO buffer. avresample_available() tells the number of remaining + * samples. To get this data as output, either call avresample_convert() with + * NULL input or call avresample_read(). + * + * @see avresample_get_out_samples() + * @see avresample_read() + * @see avresample_get_delay() + * + * @param avr audio resample context + * @param output output data pointers + * @param out_plane_size output plane size, in bytes. + * This can be 0 if unknown, but that will lead to + * optimized functions not being used directly on the + * output, which could slow down some conversions. + * @param out_samples maximum number of samples that the output buffer can hold + * @param input input data pointers + * @param in_plane_size input plane size, in bytes + * This can be 0 if unknown, but that will lead to + * optimized functions not being used directly on the + * input, which could slow down some conversions. + * @param in_samples number of input samples to convert + * @return number of samples written to the output buffer, + * not including converted samples added to the internal + * output FIFO + */ +int avresample_convert(AVAudioResampleContext *avr, uint8_t **output, + int out_plane_size, int out_samples, uint8_t **input, + int in_plane_size, int in_samples); + +/** + * Return the number of samples currently in the resampling delay buffer. + * + * When resampling, there may be a delay between the input and output. Any + * unconverted samples in each call are stored internally in a delay buffer. + * This function allows the user to determine the current number of samples in + * the delay buffer, which can be useful for synchronization. + * + * @see avresample_convert() + * + * @param avr audio resample context + * @return number of samples currently in the resampling delay buffer + */ +int avresample_get_delay(AVAudioResampleContext *avr); + +/** + * Return the number of available samples in the output FIFO. + * + * During conversion, if the user does not specify an output buffer or + * specifies an output buffer that is smaller than what is needed, remaining + * samples that are not written to the output are stored to an internal FIFO + * buffer. The samples in the FIFO can be read with avresample_read() or + * avresample_convert(). + * + * @see avresample_read() + * @see avresample_convert() + * + * @param avr audio resample context + * @return number of samples available for reading + */ +int avresample_available(AVAudioResampleContext *avr); + +/** + * Read samples from the output FIFO. + * + * During conversion, if the user does not specify an output buffer or + * specifies an output buffer that is smaller than what is needed, remaining + * samples that are not written to the output are stored to an internal FIFO + * buffer. This function can be used to read samples from that internal FIFO. + * + * @see avresample_available() + * @see avresample_convert() + * + * @param avr audio resample context + * @param output output data pointers. May be NULL, in which case + * nb_samples of data is discarded from output FIFO. + * @param nb_samples number of samples to read from the FIFO + * @return the number of samples written to output + */ +int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples); + +/** + * Convert the samples in the input AVFrame and write them to the output AVFrame. + * + * Input and output AVFrames must have channel_layout, sample_rate and format set. + * + * The upper bound on the number of output samples is obtained through + * avresample_get_out_samples(). + * + * If the output AVFrame does not have the data pointers allocated the nb_samples + * field will be set using avresample_get_out_samples() and av_frame_get_buffer() + * is called to allocate the frame. + * + * The output AVFrame can be NULL or have fewer allocated samples than required. + * In this case, any remaining samples not written to the output will be added + * to an internal FIFO buffer, to be returned at the next call to this function + * or to avresample_convert() or to avresample_read(). + * + * If converting sample rate, there may be data remaining in the internal + * resampling delay buffer. avresample_get_delay() tells the number of + * remaining samples. To get this data as output, call this function or + * avresample_convert() with NULL input. + * + * At the end of the conversion process, there may be data remaining in the + * internal FIFO buffer. avresample_available() tells the number of remaining + * samples. To get this data as output, either call this function or + * avresample_convert() with NULL input or call avresample_read(). + * + * If the AVAudioResampleContext configuration does not match the output and + * input AVFrame settings the conversion does not take place and depending on + * which AVFrame is not matching AVERROR_OUTPUT_CHANGED, AVERROR_INPUT_CHANGED + * or AVERROR_OUTPUT_CHANGED|AVERROR_INPUT_CHANGED is returned. + * + * @see avresample_get_out_samples() + * @see avresample_available() + * @see avresample_convert() + * @see avresample_read() + * @see avresample_get_delay() + * + * @param avr audio resample context + * @param output output AVFrame + * @param input input AVFrame + * @return 0 on success, AVERROR on failure or nonmatching + * configuration. + */ +int avresample_convert_frame(AVAudioResampleContext *avr, + AVFrame *output, AVFrame *input); + +/** + * Configure or reconfigure the AVAudioResampleContext using the information + * provided by the AVFrames. + * + * The original resampling context is reset even on failure. + * The function calls avresample_close() internally if the context is open. + * + * @see avresample_open(); + * @see avresample_close(); + * + * @param avr audio resample context + * @param output output AVFrame + * @param input input AVFrame + * @return 0 on success, AVERROR on failure. + */ +int avresample_config(AVAudioResampleContext *avr, AVFrame *out, AVFrame *in); + +/** + * @} + */ + +#endif /* AVRESAMPLE_AVRESAMPLE_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavresample/version.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavresample/version.h new file mode 100644 index 000000000..34623a138 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavresample/version.h @@ -0,0 +1,54 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVRESAMPLE_VERSION_H +#define AVRESAMPLE_VERSION_H + +/** + * @file + * @ingroup lavr + * Libavresample version macros. + */ + +#include "libavutil/version.h" + +#define LIBAVRESAMPLE_VERSION_MAJOR 2 +#define LIBAVRESAMPLE_VERSION_MINOR 1 +#define LIBAVRESAMPLE_VERSION_MICRO 0 + +#define LIBAVRESAMPLE_VERSION_INT AV_VERSION_INT(LIBAVRESAMPLE_VERSION_MAJOR, \ + LIBAVRESAMPLE_VERSION_MINOR, \ + LIBAVRESAMPLE_VERSION_MICRO) +#define LIBAVRESAMPLE_VERSION AV_VERSION(LIBAVRESAMPLE_VERSION_MAJOR, \ + LIBAVRESAMPLE_VERSION_MINOR, \ + LIBAVRESAMPLE_VERSION_MICRO) +#define LIBAVRESAMPLE_BUILD LIBAVRESAMPLE_VERSION_INT + +#define LIBAVRESAMPLE_IDENT "Lavr" AV_STRINGIFY(LIBAVRESAMPLE_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_RESAMPLE_CLOSE_OPEN +#define FF_API_RESAMPLE_CLOSE_OPEN (LIBAVRESAMPLE_VERSION_MAJOR < 3) +#endif + +#endif /* AVRESAMPLE_VERSION_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/adler32.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/adler32.h new file mode 100644 index 000000000..53e3dbf51 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/adler32.h @@ -0,0 +1,55 @@ +/* + * copyright (c) 2006 Mans Rullgard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_ADLER32_H +#define AVUTIL_ADLER32_H + +#include <stdint.h> +#include "attributes.h" + +/** + * @file + * Public header for libavutil Adler32 hasher + * + * @defgroup lavu_adler32 Adler32 + * @ingroup lavu_crypto + * @{ + */ + +/** + * Calculate the Adler32 checksum of a buffer. + * + * Passing the return value to a subsequent av_adler32_update() call + * allows the checksum of multiple buffers to be calculated as though + * they were concatenated. + * + * @param adler initial checksum value + * @param buf pointer to input buffer + * @param len size of input buffer + * @return updated checksum + */ +unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, + unsigned int len) av_pure; + +/** + * @} + */ + +#endif /* AVUTIL_ADLER32_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/aes.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/aes.h new file mode 100644 index 000000000..edff275b7 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/aes.h @@ -0,0 +1,67 @@ +/* + * copyright (c) 2007 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_H +#define AVUTIL_AES_H + +#include <stdint.h> + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_aes AES + * @ingroup lavu_crypto + * @{ + */ + +#if FF_API_CONTEXT_SIZE +extern attribute_deprecated const int av_aes_size; +#endif + +struct AVAES; + +/** + * Allocate an AVAES context. + */ +struct AVAES *av_aes_alloc(void); + +/** + * Initialize an AVAES context. + * @param key_bits 128, 192 or 256 + * @param decrypt 0 for encryption, 1 for decryption + */ +int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * @param count number of 16 byte blocks + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_AES_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/attributes.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/attributes.h new file mode 100644 index 000000000..d7f2bb5c6 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/attributes.h @@ -0,0 +1,126 @@ +/* + * copyright (c) 2006 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Macro definitions for various function/variable attributes + */ + +#ifndef AVUTIL_ATTRIBUTES_H +#define AVUTIL_ATTRIBUTES_H + +#ifdef __GNUC__ +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) +#else +# define AV_GCC_VERSION_AT_LEAST(x,y) 0 +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_always_inline __attribute__((always_inline)) inline +#elif defined(_MSC_VER) +# define av_always_inline __forceinline +#else +# define av_always_inline inline +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_noinline __attribute__((noinline)) +#elif defined(_MSC_VER) +# define av_noinline __declspec(noinline) +#else +# define av_noinline +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_pure __attribute__((pure)) +#else +# define av_pure +#endif + +#if AV_GCC_VERSION_AT_LEAST(2,6) +# define av_const __attribute__((const)) +#else +# define av_const +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,3) +# define av_cold __attribute__((cold)) +#else +# define av_cold +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__) +# define av_flatten __attribute__((flatten)) +#else +# define av_flatten +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define attribute_deprecated __attribute__((deprecated)) +#elif defined(_MSC_VER) +# define attribute_deprecated __declspec(deprecated) +#else +# define attribute_deprecated +#endif + +#if defined(__GNUC__) +# define av_unused __attribute__((unused)) +#else +# define av_unused +#endif + +/** + * Mark a variable as used and prevent the compiler from optimizing it + * away. This is useful for variables accessed only from inline + * assembler without the compiler being aware. + */ +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_used __attribute__((used)) +#else +# define av_used +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,3) +# define av_alias __attribute__((may_alias)) +#else +# define av_alias +#endif + +#if defined(__GNUC__) && !defined(__ICC) +# define av_uninit(x) x=x +#else +# define av_uninit(x) x +#endif + +#ifdef __GNUC__ +# define av_builtin_constant_p __builtin_constant_p +# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) +#else +# define av_builtin_constant_p(x) 0 +# define av_printf_format(fmtpos, attrpos) +#endif + +#if AV_GCC_VERSION_AT_LEAST(2,5) +# define av_noreturn __attribute__((noreturn)) +#else +# define av_noreturn +#endif + +#endif /* AVUTIL_ATTRIBUTES_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/audio_fifo.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/audio_fifo.h new file mode 100644 index 000000000..e73123d86 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/audio_fifo.h @@ -0,0 +1,150 @@ +/* + * Audio FIFO + * Copyright (c) 2012 Justin Ruggles <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Audio FIFO Buffer + */ + +#ifndef AVUTIL_AUDIO_FIFO_H +#define AVUTIL_AUDIO_FIFO_H + +#include "avutil.h" +#include "fifo.h" +#include "samplefmt.h" + +/** + * @addtogroup lavu_audio + * @{ + * + * @defgroup lavu_audiofifo Audio FIFO Buffer + * @{ + */ + +/** + * Context for an Audio FIFO Buffer. + * + * - Operates at the sample level rather than the byte level. + * - Supports multiple channels with either planar or packed sample format. + * - Automatic reallocation when writing to a full buffer. + */ +typedef struct AVAudioFifo AVAudioFifo; + +/** + * Free an AVAudioFifo. + * + * @param af AVAudioFifo to free + */ +void av_audio_fifo_free(AVAudioFifo *af); + +/** + * Allocate an AVAudioFifo. + * + * @param sample_fmt sample format + * @param channels number of channels + * @param nb_samples initial allocation size, in samples + * @return newly allocated AVAudioFifo, or NULL on error + */ +AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, + int nb_samples); + +/** + * Reallocate an AVAudioFifo. + * + * @param af AVAudioFifo to reallocate + * @param nb_samples new allocation size, in samples + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); + +/** + * Write data to an AVAudioFifo. + * + * The AVAudioFifo will be reallocated automatically if the available space + * is less than nb_samples. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to write to + * @param data audio data plane pointers + * @param nb_samples number of samples to write + * @return number of samples actually written, or negative AVERROR + * code on failure. + */ +int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Read data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to read + * @return number of samples actually read, or negative AVERROR code + * on failure. + */ +int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Drain data from an AVAudioFifo. + * + * Removes the data without reading it. + * + * @param af AVAudioFifo to drain + * @param nb_samples number of samples to drain + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples); + +/** + * Reset the AVAudioFifo buffer. + * + * This empties all data in the buffer. + * + * @param af AVAudioFifo to reset + */ +void av_audio_fifo_reset(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for reading. + * + * @param af the AVAudioFifo to query + * @return number of samples available for reading + */ +int av_audio_fifo_size(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for writing. + * + * @param af the AVAudioFifo to query + * @return number of samples available for writing + */ +int av_audio_fifo_space(AVAudioFifo *af); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_AUDIO_FIFO_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/audioconvert.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/audioconvert.h new file mode 100644 index 000000000..300a67cd3 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/audioconvert.h @@ -0,0 +1,6 @@ + +#include "version.h" + +#if FF_API_AUDIOCONVERT +#include "channel_layout.h" +#endif diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avassert.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avassert.h new file mode 100644 index 000000000..b223d26e8 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avassert.h @@ -0,0 +1,66 @@ +/* + * copyright (c) 2010 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple assert() macros that are a bit more flexible than ISO C assert(). + * @author Michael Niedermayer <[email protected]> + */ + +#ifndef AVUTIL_AVASSERT_H +#define AVUTIL_AVASSERT_H + +#include <stdlib.h> +#include "avutil.h" +#include "log.h" + +/** + * assert() equivalent, that is always enabled. + */ +#define av_assert0(cond) do { \ + if (!(cond)) { \ + av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \ + AV_STRINGIFY(cond), __FILE__, __LINE__); \ + abort(); \ + } \ +} while (0) + + +/** + * assert() equivalent, that does not lie in speed critical code. + * These asserts() thus can be enabled without fearing speedloss. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 +#define av_assert1(cond) av_assert0(cond) +#else +#define av_assert1(cond) ((void)0) +#endif + + +/** + * assert() equivalent, that does lie in speed critical code. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 +#define av_assert2(cond) av_assert0(cond) +#else +#define av_assert2(cond) ((void)0) +#endif + +#endif /* AVUTIL_AVASSERT_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avconfig.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avconfig.h new file mode 100644 index 000000000..f10aa6186 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avconfig.h @@ -0,0 +1,6 @@ +/* Generated by ffconf */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +#define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 1 +#endif /* AVUTIL_AVCONFIG_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avstring.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avstring.h new file mode 100644 index 000000000..9a18ddd89 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avstring.h @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2007 Mans Rullgard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVSTRING_H +#define AVUTIL_AVSTRING_H + +#include <stddef.h> +#include "attributes.h" + +/** + * @addtogroup lavu_string + * @{ + */ + +/** + * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to + * the address of the first character in str after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_strstart(const char *str, const char *pfx, const char **ptr); + +/** + * Return non-zero if pfx is a prefix of str independent of case. If + * it is, *ptr is set to the address of the first character in str + * after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_stristart(const char *str, const char *pfx, const char **ptr); + +/** + * Locate the first case-independent occurrence in the string haystack + * of the string needle. A zero-length string needle is considered to + * match at the start of haystack. + * + * This function is a case-insensitive version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_stristr(const char *haystack, const char *needle); + +/** + * Locate the first occurrence of the string needle in the string haystack + * where not more than hay_length characters are searched. A zero-length + * string needle is considered to match at the start of haystack. + * + * This function is a length-limited version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @param hay_length length of string to search in + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_strnstr(const char *haystack, const char *needle, size_t hay_length); + +/** + * Copy the string src to dst, but no more than size - 1 bytes, and + * null-terminate dst. + * + * This function is the same as BSD strlcpy(). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the length of src + * + * @warning since the return value is the length of src, src absolutely + * _must_ be a properly 0-terminated string, otherwise this will read beyond + * the end of the buffer and possibly crash. + */ +size_t av_strlcpy(char *dst, const char *src, size_t size); + +/** + * Append the string src to the string dst, but to a total length of + * no more than size - 1 bytes, and null-terminate dst. + * + * This function is similar to BSD strlcat(), but differs when + * size <= strlen(dst). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the total length of src and dst + * + * @warning since the return value use the length of src and dst, these + * absolutely _must_ be a properly 0-terminated strings, otherwise this + * will read beyond the end of the buffer and possibly crash. + */ +size_t av_strlcat(char *dst, const char *src, size_t size); + +/** + * Append output to a string, according to a format. Never write out of + * the destination buffer, and always put a terminating 0 within + * the buffer. + * @param dst destination buffer (string to which the output is + * appended) + * @param size total size of the destination buffer + * @param fmt printf-compatible format string, specifying how the + * following parameters are used + * @return the length of the string that would have been generated + * if enough space had been available + */ +size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4); + +/** + * Convert a number to a av_malloced string. + */ +char *av_d2str(double d); + +/** + * Unescape the given string until a non escaped terminating char, + * and return the token corresponding to the unescaped string. + * + * The normal \ and ' escaping is supported. Leading and trailing + * whitespaces are removed, unless they are escaped with '\' or are + * enclosed between ''. + * + * @param buf the buffer to parse, buf will be updated to point to the + * terminating char + * @param term a 0-terminated list of terminating chars + * @return the malloced unescaped string, which must be av_freed by + * the user, NULL in case of allocation failure + */ +char *av_get_token(const char **buf, const char *term); + +/** + * Locale-independent conversion of ASCII isdigit. + */ +int av_isdigit(int c); + +/** + * Locale-independent conversion of ASCII isgraph. + */ +int av_isgraph(int c); + +/** + * Locale-independent conversion of ASCII isspace. + */ +int av_isspace(int c); + +/** + * Locale-independent conversion of ASCII characters to uppercase. + */ +static inline int av_toupper(int c) +{ + if (c >= 'a' && c <= 'z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent conversion of ASCII characters to lowercase. + */ +static inline int av_tolower(int c) +{ + if (c >= 'A' && c <= 'Z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent conversion of ASCII isxdigit. + */ +int av_isxdigit(int c); + +/* + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strcasecmp(const char *a, const char *b); + +/** + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strncasecmp(const char *a, const char *b, size_t n); + + +/** + * Thread safe basename. + * @param path the path, on DOS both \ and / are considered separators. + * @return pointer to the basename substring. + */ +const char *av_basename(const char *path); + +/** + * Thread safe dirname. + * @param path the path, on DOS both \ and / are considered separators. + * @return the path with the separator replaced by the string terminator or ".". + * @note the function may change the input string. + */ +const char *av_dirname(char *path); + + +/** + * Match instances of a name in a comma-separated list of names. + * @param name Name to look for. + * @param names List of names. + * @return 1 on match, 0 otherwise. + */ +int av_match_name(const char *name, const char *names); + +/** + * @} + */ + +#endif /* AVUTIL_AVSTRING_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avutil.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avutil.h new file mode 100644 index 000000000..f056415f0 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/avutil.h @@ -0,0 +1,290 @@ +/* + * copyright (c) 2006 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVUTIL_H +#define AVUTIL_AVUTIL_H + +/** + * @file + * external API header + */ + +/** + * @mainpage + * + * @section libav_intro Introduction + * + * This document describes the usage of the different libraries + * provided by Libav. + * + * @li @ref libavc "libavcodec" encoding/decoding library + * @li @ref lavfi "libavfilter" graph-based frame editing library + * @li @ref libavf "libavformat" I/O and muxing/demuxing library + * @li @ref lavd "libavdevice" special devices muxing/demuxing library + * @li @ref lavu "libavutil" common utility library + * @li @ref lavr "libavresample" audio resampling, format conversion and mixing + * @li @ref libsws "libswscale" color conversion and scaling library + * + * @section libav_versioning Versioning and compatibility + * + * Each of the Libav libraries contains a version.h header, which defines a + * major, minor and micro version number with the + * <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version + * number is incremented with backward incompatible changes - e.g. removing + * parts of the public API, reordering public struct members, etc. The minor + * version number is incremented for backward compatible API changes or major + * new features - e.g. adding a new public function or a new decoder. The micro + * version number is incremented for smaller changes that a calling program + * might still want to check for - e.g. changing behavior in a previously + * unspecified situation. + * + * Libav guarantees backward API and ABI compatibility for each library as long + * as its major version number is unchanged. This means that no public symbols + * will be removed or renamed. Types and names of the public struct members and + * values of public macros and enums will remain the same (unless they were + * explicitly declared as not part of the public API). Documented behavior will + * not change. + * + * In other words, any correct program that works with a given Libav snapshot + * should work just as well without any changes with any later snapshot with the + * same major versions. This applies to both rebuilding the program against new + * Libav versions or to replacing the dynamic Libav libraries that a program + * links against. + * + * However, new public symbols may be added and new members may be appended to + * public structs whose size is not part of public ABI (most public structs in + * Libav). New macros and enum values may be added. Behavior in undocumented + * situations may change slightly (and be documented). All those are accompanied + * by an entry in doc/APIchanges and incrementing either the minor or micro + * version number. + */ + +/** + * @defgroup lavu Common utility functions + * + * @brief + * libavutil contains the code shared across all the other Libav + * libraries + * + * @note In order to use the functions provided by avutil you must include + * the specific header. + * + * @{ + * + * @defgroup lavu_crypto Crypto and Hashing + * + * @{ + * @} + * + * @defgroup lavu_math Maths + * @{ + * + * @} + * + * @defgroup lavu_string String Manipulation + * + * @{ + * + * @} + * + * @defgroup lavu_mem Memory Management + * + * @{ + * + * @} + * + * @defgroup lavu_data Data Structures + * @{ + * + * @} + * + * @defgroup lavu_audio Audio related + * + * @{ + * + * @} + * + * @defgroup lavu_error Error Codes + * + * @{ + * + * @} + * + * @defgroup lavu_log Logging Facility + * + * @{ + * + * @} + * + * @defgroup lavu_misc Other + * + * @{ + * + * @defgroup lavu_internal Internal + * + * Not exported functions, for internal usage only + * + * @{ + * + * @} + * + * @defgroup preproc_misc Preprocessor String Macros + * + * @{ + * + * @} + */ + + +/** + * @addtogroup lavu_ver + * @{ + */ + +/** + * Return the LIBAVUTIL_VERSION_INT constant. + */ +unsigned avutil_version(void); + +/** + * Return the libavutil build-time configuration. + */ +const char *avutil_configuration(void); + +/** + * Return the libavutil license. + */ +const char *avutil_license(void); + +/** + * @} + */ + +/** + * @addtogroup lavu_media Media Type + * @brief Media Type + */ + +enum AVMediaType { + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA + AVMEDIA_TYPE_VIDEO, + AVMEDIA_TYPE_AUDIO, + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous + AVMEDIA_TYPE_SUBTITLE, + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse + AVMEDIA_TYPE_NB +}; + +/** + * @defgroup lavu_const Constants + * @{ + * + * @defgroup lavu_enc Encoding specific + * + * @note those definition should move to avcodec + * @{ + */ + +#define FF_LAMBDA_SHIFT 7 +#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT) +#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda +#define FF_LAMBDA_MAX (256*128-1) + +#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove + +/** + * @} + * @defgroup lavu_time Timestamp specific + * + * Libav internal timebase and timestamp definitions + * + * @{ + */ + +/** + * @brief Undefined timestamp value + * + * Usually reported by demuxer that work on containers that do not provide + * either pts or dts. + */ + +#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) + +/** + * Internal time base represented as integer + */ + +#define AV_TIME_BASE 1000000 + +/** + * Internal time base represented as fractional value + */ + +#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} + +/** + * @} + * @} + * @defgroup lavu_picture Image related + * + * AVPicture types, pixel formats and basic image planes manipulation. + * + * @{ + */ + +enum AVPictureType { + AV_PICTURE_TYPE_I = 1, ///< Intra + AV_PICTURE_TYPE_P, ///< Predicted + AV_PICTURE_TYPE_B, ///< Bi-dir predicted + AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG4 + AV_PICTURE_TYPE_SI, ///< Switching Intra + AV_PICTURE_TYPE_SP, ///< Switching Predicted + AV_PICTURE_TYPE_BI, ///< BI type +}; + +/** + * Return a single letter to describe the given picture type + * pict_type. + * + * @param[in] pict_type the picture type @return a single character + * representing the picture type, '?' if pict_type is unknown + */ +char av_get_picture_type_char(enum AVPictureType pict_type); + +/** + * @} + */ + +#include "error.h" +#include "rational.h" +#include "version.h" +#include "macros.h" + +/** + * Return the fractional representation of the internal time base. + */ +AVRational av_get_time_base_q(void); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_AVUTIL_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/base64.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/base64.h new file mode 100644 index 000000000..4750cf5c7 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/base64.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2006 Ryan Martell. ([email protected]) + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BASE64_H +#define AVUTIL_BASE64_H + +#include <stdint.h> + +/** + * @defgroup lavu_base64 Base64 + * @ingroup lavu_crypto + * @{ + */ + + +/** + * Decode a base64-encoded string. + * + * @param out buffer for decoded data + * @param in null-terminated input string + * @param out_size size in bytes of the out buffer, must be at + * least 3/4 of the length of in + * @return number of bytes written, or a negative value in case of + * invalid input + */ +int av_base64_decode(uint8_t *out, const char *in, int out_size); + +/** + * Encode data to base64 and null-terminate. + * + * @param out buffer for encoded data + * @param out_size size in bytes of the output buffer, must be at + * least AV_BASE64_SIZE(in_size) + * @param in_size size in bytes of the 'in' buffer + * @return 'out' or NULL in case of error + */ +char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); + +/** + * Calculate the output size needed to base64-encode x bytes. + */ +#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) + + /** + * @} + */ + +#endif /* AVUTIL_BASE64_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/blowfish.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/blowfish.h new file mode 100644 index 000000000..8c29536cf --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/blowfish.h @@ -0,0 +1,76 @@ +/* + * Blowfish algorithm + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BLOWFISH_H +#define AVUTIL_BLOWFISH_H + +#include <stdint.h> + +/** + * @defgroup lavu_blowfish Blowfish + * @ingroup lavu_crypto + * @{ + */ + +#define AV_BF_ROUNDS 16 + +typedef struct AVBlowfish { + uint32_t p[AV_BF_ROUNDS + 2]; + uint32_t s[4][256]; +} AVBlowfish; + +/** + * Initialize an AVBlowfish context. + * + * @param ctx an AVBlowfish context + * @param key a key + * @param key_len length of the key + */ +void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param xl left four bytes halves of input to be encrypted + * @param xr right four bytes halves of input to be encrypted + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, + int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_BLOWFISH_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/bswap.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/bswap.h new file mode 100644 index 000000000..93a6016b8 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/bswap.h @@ -0,0 +1,111 @@ +/* + * copyright (c) 2006 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * byte swapping routines + */ + +#ifndef AVUTIL_BSWAP_H +#define AVUTIL_BSWAP_H + +#include <stdint.h> +#include "libavutil/avconfig.h" +#include "attributes.h" + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_AARCH64 +# include "aarch64/bswap.h" +#elif ARCH_ARM +# include "arm/bswap.h" +#elif ARCH_AVR32 +# include "avr32/bswap.h" +#elif ARCH_BFIN +# include "bfin/bswap.h" +#elif ARCH_SH4 +# include "sh4/bswap.h" +#elif ARCH_X86 +# include "x86/bswap.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) +#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) +#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) + +#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) + +#ifndef av_bswap16 +static av_always_inline av_const uint16_t av_bswap16(uint16_t x) +{ + x= (x>>8) | (x<<8); + return x; +} +#endif + +#ifndef av_bswap32 +static av_always_inline av_const uint32_t av_bswap32(uint32_t x) +{ + return AV_BSWAP32C(x); +} +#endif + +#ifndef av_bswap64 +static inline uint64_t av_const av_bswap64(uint64_t x) +{ + return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); +} +#endif + +// be2ne ... big-endian to native-endian +// le2ne ... little-endian to native-endian + +#if AV_HAVE_BIGENDIAN +#define av_be2ne16(x) (x) +#define av_be2ne32(x) (x) +#define av_be2ne64(x) (x) +#define av_le2ne16(x) av_bswap16(x) +#define av_le2ne32(x) av_bswap32(x) +#define av_le2ne64(x) av_bswap64(x) +#define AV_BE2NEC(s, x) (x) +#define AV_LE2NEC(s, x) AV_BSWAPC(s, x) +#else +#define av_be2ne16(x) av_bswap16(x) +#define av_be2ne32(x) av_bswap32(x) +#define av_be2ne64(x) av_bswap64(x) +#define av_le2ne16(x) (x) +#define av_le2ne32(x) (x) +#define av_le2ne64(x) (x) +#define AV_BE2NEC(s, x) AV_BSWAPC(s, x) +#define AV_LE2NEC(s, x) (x) +#endif + +#define AV_BE2NE16C(x) AV_BE2NEC(16, x) +#define AV_BE2NE32C(x) AV_BE2NEC(32, x) +#define AV_BE2NE64C(x) AV_BE2NEC(64, x) +#define AV_LE2NE16C(x) AV_LE2NEC(16, x) +#define AV_LE2NE32C(x) AV_LE2NEC(32, x) +#define AV_LE2NE64C(x) AV_LE2NEC(64, x) + +#endif /* AVUTIL_BSWAP_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/buffer.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/buffer.h new file mode 100644 index 000000000..56b4d020e --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/buffer.h @@ -0,0 +1,267 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_buffer + * refcounted data buffer API + */ + +#ifndef AVUTIL_BUFFER_H +#define AVUTIL_BUFFER_H + +#include <stdint.h> + +/** + * @defgroup lavu_buffer AVBuffer + * @ingroup lavu_data + * + * @{ + * AVBuffer is an API for reference-counted data buffers. + * + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer + * represents the data buffer itself; it is opaque and not meant to be accessed + * by the caller directly, but only through AVBufferRef. However, the caller may + * e.g. compare two AVBuffer pointers to check whether two different references + * are describing the same data buffer. AVBufferRef represents a single + * reference to an AVBuffer and it is the object that may be manipulated by the + * caller directly. + * + * There are two functions provided for creating a new AVBuffer with a single + * reference -- av_buffer_alloc() to just allocate a new buffer, and + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing + * reference, additional references may be created with av_buffer_ref(). + * Use av_buffer_unref() to free a reference (this will automatically free the + * data once all the references are freed). + * + * The convention throughout this API and the rest of Libav is such that the + * buffer is considered writable if there exists only one reference to it (and + * it has not been marked as read-only). The av_buffer_is_writable() function is + * provided to check whether this is true and av_buffer_make_writable() will + * automatically create a new writable buffer when necessary. + * Of course nothing prevents the calling code from violating this convention, + * however that is safe only when all the existing references are under its + * control. + * + * @note Referencing and unreferencing the buffers is thread-safe and thus + * may be done from multiple threads simultaneously without any need for + * additional locking. + * + * @note Two different references to the same buffer can point to different + * parts of the buffer (i.e. their AVBufferRef.data will not be equal). + */ + +/** + * A reference counted buffer type. It is opaque and is meant to be used through + * references (AVBufferRef). + */ +typedef struct AVBuffer AVBuffer; + +/** + * A reference to a data buffer. + * + * The size of this struct is not a part of the public ABI and it is not meant + * to be allocated directly. + */ +typedef struct AVBufferRef { + AVBuffer *buffer; + + /** + * The data buffer. It is considered writable if and only if + * this is the only reference to the buffer, in which case + * av_buffer_is_writable() returns 1. + */ + uint8_t *data; + /** + * Size of data in bytes. + */ + int size; +} AVBufferRef; + +/** + * Allocate an AVBuffer of the given size using av_malloc(). + * + * @return an AVBufferRef of given size or NULL when out of memory + */ +AVBufferRef *av_buffer_alloc(int size); + +/** + * Same as av_buffer_alloc(), except the returned buffer will be initialized + * to zero. + */ +AVBufferRef *av_buffer_allocz(int size); + +/** + * Always treat the buffer as read-only, even when it has only one + * reference. + */ +#define AV_BUFFER_FLAG_READONLY (1 << 0) + +/** + * Create an AVBuffer from an existing array. + * + * If this function is successful, data is owned by the AVBuffer. The caller may + * only access data through the returned AVBufferRef and references derived from + * it. + * If this function fails, data is left untouched. + * @param data data array + * @param size size of data in bytes + * @param free a callback for freeing this buffer's data + * @param opaque parameter to be passed to free + * @param flags a combination of AV_BUFFER_FLAG_* + * + * @return an AVBufferRef referring to data on success, NULL on failure. + */ +AVBufferRef *av_buffer_create(uint8_t *data, int size, + void (*free)(void *opaque, uint8_t *data), + void *opaque, int flags); + +/** + * Default free callback, which calls av_free() on the buffer data. + * This function is meant to be passed to av_buffer_create(), not called + * directly. + */ +void av_buffer_default_free(void *opaque, uint8_t *data); + +/** + * Create a new reference to an AVBuffer. + * + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on + * failure. + */ +AVBufferRef *av_buffer_ref(AVBufferRef *buf); + +/** + * Free a given reference and automatically free the buffer if there are no more + * references to it. + * + * @param buf the reference to be freed. The pointer is set to NULL on return. + */ +void av_buffer_unref(AVBufferRef **buf); + +/** + * @return 1 if the caller may write to the data referred to by buf (which is + * true if and only if buf is the only reference to the underlying AVBuffer). + * Return 0 otherwise. + * A positive answer is valid until av_buffer_ref() is called on buf. + */ +int av_buffer_is_writable(const AVBufferRef *buf); + +/** + * Create a writable reference from a given buffer reference, avoiding data copy + * if possible. + * + * @param buf buffer reference to make writable. On success, buf is either left + * untouched, or it is unreferenced and a new writable AVBufferRef is + * written in its place. On failure, buf is left untouched. + * @return 0 on success, a negative AVERROR on failure. + */ +int av_buffer_make_writable(AVBufferRef **buf); + +/** + * Reallocate a given buffer. + * + * @param buf a buffer reference to reallocate. On success, buf will be + * unreferenced and a new reference with the required size will be + * written in its place. On failure buf will be left untouched. *buf + * may be NULL, then a new buffer is allocated. + * @param size required new buffer size. + * @return 0 on success, a negative AVERROR on failure. + * + * @note the buffer is actually reallocated with av_realloc() only if it was + * initially allocated through av_buffer_realloc(NULL) and there is only one + * reference to it (i.e. the one passed to this function). In all other cases + * a new buffer is allocated and the data is copied. + */ +int av_buffer_realloc(AVBufferRef **buf, int size); + +/** + * @} + */ + +/** + * @defgroup lavu_bufferpool AVBufferPool + * @ingroup lavu_data + * + * @{ + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers. + * + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is + * meant to solve this in cases when the caller needs a set of buffers of the + * same size (the most obvious use case being buffers for raw video or audio + * frames). + * + * At the beginning, the user must call av_buffer_pool_init() to create the + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to + * get a reference to a new buffer, similar to av_buffer_alloc(). This new + * reference works in all aspects the same way as the one created by + * av_buffer_alloc(). However, when the last reference to this buffer is + * unreferenced, it is returned to the pool instead of being freed and will be + * reused for subsequent av_buffer_pool_get() calls. + * + * When the caller is done with the pool and no longer needs to allocate any new + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable. + * Once all the buffers are released, it will automatically be freed. + * + * Allocating and releasing buffers with this API is thread-safe as long as + * either the default alloc callback is used, or the user-supplied one is + * thread-safe. + */ + +/** + * The buffer pool. This structure is opaque and not meant to be accessed + * directly. It is allocated with av_buffer_pool_init() and freed with + * av_buffer_pool_uninit(). + */ +typedef struct AVBufferPool AVBufferPool; + +/** + * Allocate and initialize a buffer pool. + * + * @param size size of each buffer in this pool + * @param alloc a function that will be used to allocate new buffers when the + * pool is empty. May be NULL, then the default allocator will be used + * (av_buffer_alloc()). + * @return newly created buffer pool on success, NULL on error. + */ +AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); + +/** + * Mark the pool as being available for freeing. It will actually be freed only + * once all the allocated buffers associated with the pool are released. Thus it + * is safe to call this function while some of the allocated buffers are still + * in use. + * + * @param pool pointer to the pool to be freed. It will be set to NULL. + * @see av_buffer_pool_can_uninit() + */ +void av_buffer_pool_uninit(AVBufferPool **pool); + +/** + * Allocate a new AVBuffer, reusing an old buffer from the pool when available. + * This function may be called simultaneously from multiple threads. + * + * @return a reference to the new buffer on success, NULL on error. + */ +AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); + +/** + * @} + */ + +#endif /* AVUTIL_BUFFER_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/channel_layout.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/channel_layout.h new file mode 100644 index 000000000..6a1f83005 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/channel_layout.h @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2006 Michael Niedermayer <[email protected]> + * Copyright (c) 2008 Peter Ross + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CHANNEL_LAYOUT_H +#define AVUTIL_CHANNEL_LAYOUT_H + +#include <stdint.h> + +/** + * @file + * audio channel layout utility functions + */ + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup channel_masks Audio channel masks + * @{ + */ +#define AV_CH_FRONT_LEFT 0x00000001 +#define AV_CH_FRONT_RIGHT 0x00000002 +#define AV_CH_FRONT_CENTER 0x00000004 +#define AV_CH_LOW_FREQUENCY 0x00000008 +#define AV_CH_BACK_LEFT 0x00000010 +#define AV_CH_BACK_RIGHT 0x00000020 +#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 +#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 +#define AV_CH_BACK_CENTER 0x00000100 +#define AV_CH_SIDE_LEFT 0x00000200 +#define AV_CH_SIDE_RIGHT 0x00000400 +#define AV_CH_TOP_CENTER 0x00000800 +#define AV_CH_TOP_FRONT_LEFT 0x00001000 +#define AV_CH_TOP_FRONT_CENTER 0x00002000 +#define AV_CH_TOP_FRONT_RIGHT 0x00004000 +#define AV_CH_TOP_BACK_LEFT 0x00008000 +#define AV_CH_TOP_BACK_CENTER 0x00010000 +#define AV_CH_TOP_BACK_RIGHT 0x00020000 +#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. +#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT. +#define AV_CH_WIDE_LEFT 0x0000000080000000ULL +#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL +#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL +#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL +#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL + +/** Channel mask value used for AVCodecContext.request_channel_layout + to indicate that the user requests the channel order of the decoder output + to be the native codec channel order. */ +#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL + +/** + * @} + * @defgroup channel_mask_c Audio channel convenience macros + * @{ + * */ +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) + +enum AVMatrixEncoding { + AV_MATRIX_ENCODING_NONE, + AV_MATRIX_ENCODING_DOLBY, + AV_MATRIX_ENCODING_DPLII, + AV_MATRIX_ENCODING_DPLIIX, + AV_MATRIX_ENCODING_DPLIIZ, + AV_MATRIX_ENCODING_DOLBYEX, + AV_MATRIX_ENCODING_DOLBYHEADPHONE, + AV_MATRIX_ENCODING_NB +}; + +/** + * @} + */ + +/** + * Return a channel layout id that matches name, or 0 if no match is found. + * + * name can be one or several of the following notations, + * separated by '+' or '|': + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); + * - a number of channels, in decimal, optionally followed by 'c', yielding + * the default channel layout for that number of channels (@see + * av_get_default_channel_layout); + * - a channel layout mask, in hexadecimal starting with "0x" (see the + * AV_CH_* macros). + * + * Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7" + */ +uint64_t av_get_channel_layout(const char *name); + +/** + * Return a description of a channel layout. + * If nb_channels is <= 0, it is guessed from the channel_layout. + * + * @param buf put here the string containing the channel layout + * @param buf_size size in bytes of the buffer + */ +void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout); + +/** + * Return the number of channels in the channel layout. + */ +int av_get_channel_layout_nb_channels(uint64_t channel_layout); + +/** + * Return default channel layout for a given number of channels. + */ +uint64_t av_get_default_channel_layout(int nb_channels); + +/** + * Get the index of a channel in channel_layout. + * + * @param channel a channel layout describing exactly one channel which must be + * present in channel_layout. + * + * @return index of channel in channel_layout on success, a negative AVERROR + * on error. + */ +int av_get_channel_layout_channel_index(uint64_t channel_layout, + uint64_t channel); + +/** + * Get the channel with the given index in channel_layout. + */ +uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index); + +/** + * Get the name of a given channel. + * + * @return channel name on success, NULL on error. + */ +const char *av_get_channel_name(uint64_t channel); + +/** + * @} + */ + +#endif /* AVUTIL_CHANNEL_LAYOUT_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/common.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/common.h new file mode 100644 index 000000000..eb40e1299 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/common.h @@ -0,0 +1,406 @@ +/* + * copyright (c) 2006 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * common internal and external API header + */ + +#ifndef AVUTIL_COMMON_H +#define AVUTIL_COMMON_H + +#include <errno.h> +#include <inttypes.h> +#include <limits.h> +#include <math.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "attributes.h" +#include "version.h" +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +//rounded division & shift +#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) +/* assume b>0 */ +#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) +#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) +#define FFSIGN(a) ((a) > 0 ? 1 : -1) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) + +/* misc math functions */ + +#if FF_API_AV_REVERSE +extern attribute_deprecated const uint8_t av_reverse[256]; +#endif + +#ifdef HAVE_AV_CONFIG_H +# include "config.h" +# include "intmath.h" +#endif + +/* Pull in unguarded fallback defines at the end of this file. */ +#include "common.h" + +#ifndef av_log2 +av_const int av_log2(unsigned v); +#endif + +#ifndef av_log2_16bit +av_const int av_log2_16bit(unsigned v); +#endif + +/** + * Clip a signed integer value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) +{ + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a signed integer value into the 0-255 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) +{ + if (a&(~0xFF)) return (-a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -128,127 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int8_t av_clip_int8_c(int a) +{ + if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F; + else return a; +} + +/** + * Clip a signed integer value into the 0-65535 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) +{ + if (a&(~0xFFFF)) return (-a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -32768,32767 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int16_t av_clip_int16_c(int a) +{ + if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF; + else return a; +} + +/** + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) +{ + if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF; + else return a; +} + +/** + * Clip a signed integer to an unsigned power of two range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) +{ + if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1); + else return a; +} + +/** + * Add two signed 32-bit values with saturation. + * + * @param a one value + * @param b another value + * @return sum with signed saturation + */ +static av_always_inline int av_sat_add32_c(int a, int b) +{ + return av_clipl_int32((int64_t)a + b); +} + +/** + * Add a doubled value to another value with saturation at both stages. + * + * @param a first value + * @param b value doubled and added to a + * @return sum with signed saturation + */ +static av_always_inline int av_sat_dadd32_c(int a, int b) +{ + return av_sat_add32(a, av_sat_add32(b, b)); +} + +/** + * Clip a float value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const float av_clipf_c(float a, float amin, float amax) +{ + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** Compute ceil(log2(x)). + * @param x value used to compute ceil(log2(x)) + * @return computed ceiling of log2(x) + */ +static av_always_inline av_const int av_ceil_log2_c(int x) +{ + return av_log2((x - 1) << 1); +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount_c(uint32_t x) +{ + x -= (x >> 1) & 0x55555555; + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0F0F0F0F; + x += x >> 8; + return (x + (x >> 16)) & 0x3F; +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount64_c(uint64_t x) +{ + return av_popcount(x) + av_popcount(x >> 32); +} + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + +/** + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_BYTE Expression reading one byte from the input. + * Evaluated up to 7 times (4 for the currently + * assigned Unicode range). With a memory buffer + * input, this could be *ptr++. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF8(val, GET_BYTE, ERROR)\ + val= GET_BYTE;\ + {\ + uint32_t top = (val & 128) >> 1;\ + if ((val & 0xc0) == 0x80)\ + ERROR\ + while (val & top) {\ + int tmp= GET_BYTE - 128;\ + if(tmp>>6)\ + ERROR\ + val= (val<<6) + tmp;\ + top <<= 5;\ + }\ + val &= (top << 1) - 1;\ + } + +/** + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted + * to native byte order. Evaluated one or two times. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF16(val, GET_16BIT, ERROR)\ + val = GET_16BIT;\ + {\ + unsigned int hi = val - 0xD800;\ + if (hi < 0x800) {\ + val = GET_16BIT - 0xDC00;\ + if (val > 0x3FFU || hi > 0x3FFU)\ + ERROR\ + val += (hi<<10) + 0x10000;\ + }\ + }\ + +/** + * @def PUT_UTF8(val, tmp, PUT_BYTE) + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint8_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_BYTE. + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. + * It could be a function or a statement, and uses tmp as the input byte. + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be + * executed up to 4 times for values in the valid UTF-8 range and up to + * 7 times in the general case, depending on the length of the converted + * Unicode character. + */ +#define PUT_UTF8(val, tmp, PUT_BYTE)\ + {\ + int bytes, shift;\ + uint32_t in = val;\ + if (in < 0x80) {\ + tmp = in;\ + PUT_BYTE\ + } else {\ + bytes = (av_log2(in) + 4) / 5;\ + shift = (bytes - 1) * 6;\ + tmp = (256 - (256 >> bytes)) | (in >> shift);\ + PUT_BYTE\ + while (shift >= 6) {\ + shift -= 6;\ + tmp = 0x80 | ((in >> shift) & 0x3f);\ + PUT_BYTE\ + }\ + }\ + } + +/** + * @def PUT_UTF16(val, tmp, PUT_16BIT) + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint16_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_16BIT. + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination + * in desired endianness. It could be a function or a statement, and uses tmp + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" + * PUT_BYTE will be executed 1 or 2 times depending on input character. + */ +#define PUT_UTF16(val, tmp, PUT_16BIT)\ + {\ + uint32_t in = val;\ + if (in < 0x10000) {\ + tmp = in;\ + PUT_16BIT\ + } else {\ + tmp = 0xD800 | ((in - 0x10000) >> 10);\ + PUT_16BIT\ + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\ + PUT_16BIT\ + }\ + }\ + + + +#include "mem.h" + +#ifdef HAVE_AV_CONFIG_H +# include "internal.h" +#endif /* HAVE_AV_CONFIG_H */ + +#endif /* AVUTIL_COMMON_H */ + +/* + * The following definitions are outside the multiple inclusion guard + * to ensure they are immediately available in intmath.h. + */ + +#ifndef av_ceil_log2 +# define av_ceil_log2 av_ceil_log2_c +#endif +#ifndef av_clip +# define av_clip av_clip_c +#endif +#ifndef av_clip_uint8 +# define av_clip_uint8 av_clip_uint8_c +#endif +#ifndef av_clip_int8 +# define av_clip_int8 av_clip_int8_c +#endif +#ifndef av_clip_uint16 +# define av_clip_uint16 av_clip_uint16_c +#endif +#ifndef av_clip_int16 +# define av_clip_int16 av_clip_int16_c +#endif +#ifndef av_clipl_int32 +# define av_clipl_int32 av_clipl_int32_c +#endif +#ifndef av_clip_uintp2 +# define av_clip_uintp2 av_clip_uintp2_c +#endif +#ifndef av_sat_add32 +# define av_sat_add32 av_sat_add32_c +#endif +#ifndef av_sat_dadd32 +# define av_sat_dadd32 av_sat_dadd32_c +#endif +#ifndef av_clipf +# define av_clipf av_clipf_c +#endif +#ifndef av_popcount +# define av_popcount av_popcount_c +#endif +#ifndef av_popcount64 +# define av_popcount64 av_popcount64_c +#endif diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/cpu.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/cpu.h new file mode 100644 index 000000000..7cecccc9c --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/cpu.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CPU_H +#define AVUTIL_CPU_H + +#include "version.h" + +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ + + /* lower 16 bits - CPU features */ +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX +#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext +#if FF_API_CPU_FLAG_MMX2 +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext +#endif +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster + ///< than regular MMX/SSE (e.g. Core1) +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster + ///< than regular MMX/SSE (e.g. Core1) +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions +#define AV_CPU_FLAG_CMOV 0x1000 ///< i686 cmov +#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions +#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 +#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 + +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard + +#define AV_CPU_FLAG_ARMV5TE (1 << 0) +#define AV_CPU_FLAG_ARMV6 (1 << 1) +#define AV_CPU_FLAG_ARMV6T2 (1 << 2) +#define AV_CPU_FLAG_VFP (1 << 3) +#define AV_CPU_FLAG_VFPV3 (1 << 4) +#define AV_CPU_FLAG_NEON (1 << 5) +#define AV_CPU_FLAG_ARMV8 (1 << 6) + +/** + * Return the flags which specify extensions supported by the CPU. + */ +int av_get_cpu_flags(void); + +/** + * Set a mask on flags returned by av_get_cpu_flags(). + * This function is mainly useful for testing. + * + * @warning this function is not thread safe. + */ +void av_set_cpu_flags_mask(int mask); + +/** + * Parse CPU flags from a string. + * + * @return a combination of AV_CPU_* flags, negative on error. + */ +int av_parse_cpu_flags(const char *s); + +/** + * @return the number of logical CPU cores present. + */ +int av_cpu_count(void); + +#endif /* AVUTIL_CPU_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/crc.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/crc.h new file mode 100644 index 000000000..dcb7e2c7d --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/crc.h @@ -0,0 +1,75 @@ +/* + * copyright (c) 2006 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CRC_H +#define AVUTIL_CRC_H + +#include <stdint.h> +#include <stddef.h> +#include "attributes.h" + +typedef uint32_t AVCRC; + +typedef enum { + AV_CRC_8_ATM, + AV_CRC_16_ANSI, + AV_CRC_16_CCITT, + AV_CRC_32_IEEE, + AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ + AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ + AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ +}AVCRCId; + +/** + * Initialize a CRC table. + * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 + * @param le If 1, the lowest bit represents the coefficient for the highest + * exponent of the corresponding polynomial (both for poly and + * actual CRC). + * If 0, you must swap the CRC parameter and the result of av_crc + * if you need the standard representation (can be simplified in + * most cases to e.g. bswap16): + * av_bswap32(crc << (32-bits)) + * @param bits number of bits for the CRC + * @param poly generator polynomial without the x**bits coefficient, in the + * representation as specified by le + * @param ctx_size size of ctx in bytes + * @return <0 on failure + */ +int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); + +/** + * Get an initialized standard CRC table. + * @param crc_id ID of a standard CRC + * @return a pointer to the CRC table or NULL on failure + */ +const AVCRC *av_crc_get_table(AVCRCId crc_id); + +/** + * Calculate the CRC of a block. + * @param crc CRC of previous blocks if any or initial value for CRC + * @return CRC updated with the data from the given block + * + * @see av_crc_init() "le" parameter + */ +uint32_t av_crc(const AVCRC *ctx, uint32_t crc, + const uint8_t *buffer, size_t length) av_pure; + +#endif /* AVUTIL_CRC_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/dict.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/dict.h new file mode 100644 index 000000000..e4aee27ca --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/dict.h @@ -0,0 +1,146 @@ +/* + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Public dictionary API. + */ + +#ifndef AVUTIL_DICT_H +#define AVUTIL_DICT_H + +/** + * @addtogroup lavu_dict AVDictionary + * @ingroup lavu_data + * + * @brief Simple key:value store + * + * @{ + * Dictionaries are used for storing key:value pairs. To create + * an AVDictionary, simply pass an address of a NULL pointer to + * av_dict_set(). NULL can be used as an empty dictionary wherever + * a pointer to an AVDictionary is required. + * Use av_dict_get() to retrieve an entry or iterate over all + * entries and finally av_dict_free() to free the dictionary + * and all its contents. + * + @code + AVDictionary *d = NULL; // "create" an empty dictionary + AVDictionaryEntry *t = NULL; + + av_dict_set(&d, "foo", "bar", 0); // add an entry + + char *k = av_strdup("key"); // if your strings are already allocated, + char *v = av_strdup("value"); // you can avoid copying them like this + av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + + while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { + <....> // iterate over all entries in d + } + av_dict_free(&d); + @endcode + * + */ + +#define AV_DICT_MATCH_CASE 1 +#define AV_DICT_IGNORE_SUFFIX 2 +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been + allocated with av_malloc() and children. */ +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been + allocated with av_malloc() and chilren. */ +#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. */ + +typedef struct AVDictionaryEntry { + char *key; + char *value; +} AVDictionaryEntry; + +typedef struct AVDictionary AVDictionary; + +/** + * Get a dictionary entry with matching key. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param flags Allows case as well as suffix-insensitive comparisons. + * @return Found entry or NULL, changing key or value leads to undefined behavior. + */ +AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, + const AVDictionaryEntry *prev, int flags); + +/** + * Get number of entries in dictionary. + * + * @param m dictionary + * @return number of entries in dictionary + */ +int av_dict_count(const AVDictionary *m); + +/** + * Set the given entry in *pm, overwriting an existing entry. + * + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL + * a dictionary struct is allocated and put in *pm. + * @param key entry key to add to *pm (will be av_strduped depending on flags) + * @param value entry value to add to *pm (will be av_strduped depending on flags). + * Passing a NULL value will cause an existing entry to be deleted. + * @return >= 0 on success otherwise an error code <0 + */ +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); + +/** + * Parse the key/value pairs list and add to a dictionary. + * + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @param flags flags to use when adding to dictionary. + * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL + * are ignored since the key/value tokens will always + * be duplicated. + * @return 0 on success, negative AVERROR code on failure + */ +int av_dict_parse_string(AVDictionary **pm, const char *str, + const char *key_val_sep, const char *pairs_sep, + int flags); + +/** + * Copy entries from one AVDictionary struct into another. + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, + * this function will allocate a struct for you and put it in *dst + * @param src pointer to source AVDictionary struct + * @param flags flags to use when setting entries in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + */ +void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags); + +/** + * Free all the memory allocated for an AVDictionary struct + * and all keys and values. + */ +void av_dict_free(AVDictionary **m); + +/** + * @} + */ + +#endif /* AVUTIL_DICT_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/display.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/display.h new file mode 100644 index 000000000..7e3762763 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/display.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2014 Vittorio Giovara <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_DISPLAY_H +#define AVUTIL_DISPLAY_H + +#include <stdint.h> + +/** + * The display transformation matrix specifies an affine transformation that + * should be applied to video frames for correct presentation. It is compatible + * with the matrices stored in the ISO/IEC 14496-12 container format. + * + * The data is a 3x3 matrix represented as a 9-element array: + * + * | a b u | + * (a, b, u, c, d, v, x, y, w) -> | c d v | + * | x y w | + * + * All numbers are stored in native endianness, as 16.16 fixed-point values, + * except for u, v and w, which are stored as 2.30 fixed-point values. + * + * The transformation maps a point (p, q) in the source (pre-transformation) + * frame to the point (p', q') in the destination (post-transformation) frame as + * follows: + * | a b u | + * (p, q, 1) . | c d v | = z * (p', q', 1) + * | x y w | + * + * The transformation can also be more explicitly written in components as + * follows: + * p' = (a * p + c * q + x) / z; + * q' = (b * p + d * q + y) / z; + * z = u * p + v * q + w + */ + +/** + * Extract the rotation component of the transformation matrix. + * + * @param matrix the transformation matrix + * @return the angle (in degrees) by which the transformation rotates the frame. + * The angle will be in range [-180.0, 180.0], or NaN if the matrix is + * singular. + * + * @note floating point numbers are inherently inexact, so callers are + * recommended to round the return value to nearest integer before use. + */ +double av_display_rotation_get(const int32_t matrix[9]); + +/** + * Initialize a transformation matrix describing a pure rotation by the + * specified angle (in degrees). + * + * @param matrix an allocated transformation matrix (will be fully overwritten + * by this function) + * @param angle rotation angle in degrees. + */ +void av_display_rotation_set(int32_t matrix[9], double angle); + +/** + * Flip the input matrix horizontally and/or vertically. + * + * @param matrix an allocated transformation matrix + * @param hflip whether the matrix should be flipped horizontally + * @param vflip whether the matrix should be flipped vertically + */ +void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip); + +#endif /* AVUTIL_DISPLAY_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/downmix_info.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/downmix_info.h new file mode 100644 index 000000000..69969f6fb --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/downmix_info.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2014 Tim Walker <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_DOWNMIX_INFO_H +#define AVUTIL_DOWNMIX_INFO_H + +#include "frame.h" + +/** + * @file + * audio downmix medatata + */ + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup downmix_info Audio downmix metadata + * @{ + */ + +/** + * Possible downmix types. + */ +enum AVDownmixType { + AV_DOWNMIX_TYPE_UNKNOWN, /**< Not indicated. */ + AV_DOWNMIX_TYPE_LORO, /**< Lo/Ro 2-channel downmix (Stereo). */ + AV_DOWNMIX_TYPE_LTRT, /**< Lt/Rt 2-channel downmix, Dolby Surround compatible. */ + AV_DOWNMIX_TYPE_DPLII, /**< Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible. */ + AV_DOWNMIX_TYPE_NB /**< Number of downmix types. Not part of ABI. */ +}; + +/** + * This structure describes optional metadata relevant to a downmix procedure. + * + * All fields are set by the decoder to the value indicated in the audio + * bitstream (if present), or to a "sane" default otherwise. + */ +typedef struct AVDownmixInfo { + /** + * Type of downmix preferred by the mastering engineer. + */ + enum AVDownmixType preferred_downmix_type; + + /** + * Absolute scale factor representing the nominal level of the center + * channel during a regular downmix. + */ + double center_mix_level; + + /** + * Absolute scale factor representing the nominal level of the center + * channel during an Lt/Rt compatible downmix. + */ + double center_mix_level_ltrt; + + /** + * Absolute scale factor representing the nominal level of the surround + * channels during a regular downmix. + */ + double surround_mix_level; + + /** + * Absolute scale factor representing the nominal level of the surround + * channels during an Lt/Rt compatible downmix. + */ + double surround_mix_level_ltrt; + + /** + * Absolute scale factor representing the level at which the LFE data is + * mixed into L/R channels during downmixing. + */ + double lfe_mix_level; +} AVDownmixInfo; + +/** + * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing. + * + * The side data is created and added to the frame if it's absent. + * + * @param frame the frame for which the side data is to be obtained. + * + * @return the AVDownmixInfo structure to be edited by the caller. + */ +AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); + +/** + * @} + */ + +/** + * @} + */ + +#endif /* AVUTIL_DOWNMIX_INFO_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/error.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/error.h new file mode 100644 index 000000000..8be87cbeb --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/error.h @@ -0,0 +1,84 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * error code definitions + */ + +#ifndef AVUTIL_ERROR_H +#define AVUTIL_ERROR_H + +#include <errno.h> +#include <stddef.h> + +/** + * @addtogroup lavu_error + * + * @{ + */ + + +/* error handling */ +#if EDOM > 0 +#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. +#else +/* Some platforms have E* and errno already negated. */ +#define AVERROR(e) (e) +#define AVUNERROR(e) (e) +#endif + +#define AVERROR_BSF_NOT_FOUND (-0x39acbd08) ///< Bitstream filter not found +#define AVERROR_DECODER_NOT_FOUND (-0x3cbabb08) ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND (-0x32babb08) ///< Demuxer not found +#define AVERROR_ENCODER_NOT_FOUND (-0x3cb1ba08) ///< Encoder not found +#define AVERROR_EOF (-0x5fb9b0bb) ///< End of file +#define AVERROR_EXIT (-0x2bb6a7bb) ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_FILTER_NOT_FOUND (-0x33b6b908) ///< Filter not found +#define AVERROR_INVALIDDATA (-0x3ebbb1b7) ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND (-0x27aab208) ///< Muxer not found +#define AVERROR_OPTION_NOT_FOUND (-0x2bafb008) ///< Option not found +#define AVERROR_PATCHWELCOME (-0x3aa8beb0) ///< Not yet implemented in Libav, patches welcome +#define AVERROR_PROTOCOL_NOT_FOUND (-0x30adaf08) ///< Protocol not found +#define AVERROR_STREAM_NOT_FOUND (-0x2dabac08) ///< Stream not found +#define AVERROR_BUG (-0x5fb8aabe) ///< Bug detected, please report the issue +#define AVERROR_UNKNOWN (-0x31b4b1ab) ///< Unknown error, typically from an external library +#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. +#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED) +#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED) + +/** + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the + * error. Even in case of failure av_strerror() will print a generic + * error message indicating the errnum provided to errbuf. + * + * @param errnum error code to describe + * @param errbuf buffer to which description is written + * @param errbuf_size the size in bytes of errbuf + * @return 0 on success, a negative value if a description for errnum + * cannot be found + */ +int av_strerror(int errnum, char *errbuf, size_t errbuf_size); + +/** + * @} + */ + +#endif /* AVUTIL_ERROR_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/eval.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/eval.h new file mode 100644 index 000000000..ccb29e7a3 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/eval.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2002 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple arithmetic expression evaluator + */ + +#ifndef AVUTIL_EVAL_H +#define AVUTIL_EVAL_H + +#include "avutil.h" + +typedef struct AVExpr AVExpr; + +/** + * Parse and evaluate an expression. + * Note, this is significantly slower than av_expr_eval(). + * + * @param res a pointer to a double where is put the result value of + * the expression, or NAN in case of error + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param const_values a zero terminated array of values for the identifiers from const_names + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @param log_ctx parent logging context + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse_and_eval(double *res, const char *s, + const char * const *const_names, const double *const_values, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + void *opaque, int log_offset, void *log_ctx); + +/** + * Parse an expression. + * + * @param expr a pointer where is put an AVExpr containing the parsed + * value in case of successful parsing, or NULL otherwise. + * The pointed to AVExpr must be freed with av_expr_free() by the user + * when it is not needed anymore. + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param log_ctx parent logging context + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse(AVExpr **expr, const char *s, + const char * const *const_names, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + int log_offset, void *log_ctx); + +/** + * Evaluate a previously parsed expression. + * + * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @return the value of the expression + */ +double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); + +/** + * Free a parsed expression previously created with av_expr_parse(). + */ +void av_expr_free(AVExpr *e); + +/** + * Parse the string in numstr and return its value as a double. If + * the string is empty, contains only whitespaces, or does not contain + * an initial substring that has the expected syntax for a + * floating-point number, no conversion is performed. In this case, + * returns a value of zero and the value returned in tail is the value + * of numstr. + * + * @param numstr a string representing a number, may contain one of + * the International System number postfixes, for example 'K', 'M', + * 'G'. If 'i' is appended after the postfix, powers of 2 are used + * instead of powers of 10. The 'B' postfix multiplies the value for + * 8, and can be appended after another postfix or used alone. This + * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. + * @param tail if non-NULL puts here the pointer to the char next + * after the last parsed character + */ +double av_strtod(const char *numstr, char **tail); + +#endif /* AVUTIL_EVAL_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/fifo.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/fifo.h new file mode 100644 index 000000000..ea30f5d2b --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/fifo.h @@ -0,0 +1,131 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * a very simple circular buffer FIFO implementation + */ + +#ifndef AVUTIL_FIFO_H +#define AVUTIL_FIFO_H + +#include <stdint.h> +#include "avutil.h" +#include "attributes.h" + +typedef struct AVFifoBuffer { + uint8_t *buffer; + uint8_t *rptr, *wptr, *end; + uint32_t rndx, wndx; +} AVFifoBuffer; + +/** + * Initialize an AVFifoBuffer. + * @param size of FIFO + * @return AVFifoBuffer or NULL in case of memory allocation failure + */ +AVFifoBuffer *av_fifo_alloc(unsigned int size); + +/** + * Free an AVFifoBuffer. + * @param f AVFifoBuffer to free + */ +void av_fifo_free(AVFifoBuffer *f); + +/** + * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. + * @param f AVFifoBuffer to reset + */ +void av_fifo_reset(AVFifoBuffer *f); + +/** + * Return the amount of data in bytes in the AVFifoBuffer, that is the + * amount of data you can read from it. + * @param f AVFifoBuffer to read from + * @return size + */ +int av_fifo_size(AVFifoBuffer *f); + +/** + * Return the amount of space in bytes in the AVFifoBuffer, that is the + * amount of data you can write into it. + * @param f AVFifoBuffer to write into + * @return size + */ +int av_fifo_space(AVFifoBuffer *f); + +/** + * Feed data from an AVFifoBuffer to a user-supplied callback. + * @param f AVFifoBuffer to read from + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); + +/** + * Feed data from a user-supplied callback to an AVFifoBuffer. + * @param f AVFifoBuffer to write to + * @param src data source; non-const since it may be used as a + * modifiable context by the function defined in func + * @param size number of bytes to write + * @param func generic write function; the first parameter is src, + * the second is dest_buf, the third is dest_buf_size. + * func must return the number of bytes written to dest_buf, or <= 0 to + * indicate no more data available to write. + * If func is NULL, src is interpreted as a simple byte array for source data. + * @return the number of bytes written to the FIFO + */ +int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); + +/** + * Resize an AVFifoBuffer. + * @param f AVFifoBuffer to resize + * @param size new AVFifoBuffer size in bytes + * @return <0 for failure, >=0 otherwise + */ +int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); + +/** + * Read and discard the specified amount of data from an AVFifoBuffer. + * @param f AVFifoBuffer to read from + * @param size amount of data to read in bytes + */ +void av_fifo_drain(AVFifoBuffer *f, int size); + +/** + * Return a pointer to the data stored in a FIFO buffer at a certain offset. + * The FIFO buffer is not modified. + * + * @param f AVFifoBuffer to peek at, f must be non-NULL + * @param offs an offset in bytes, its absolute value must be less + * than the used buffer size or the returned pointer will + * point outside to the buffer data. + * The used buffer size can be checked with av_fifo_size(). + */ +static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) +{ + uint8_t *ptr = f->rptr + offs; + if (ptr >= f->end) + ptr = f->buffer + (ptr - f->end); + else if (ptr < f->buffer) + ptr = f->end - (f->buffer - ptr); + return ptr; +} + +#endif /* AVUTIL_FIFO_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/file.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/file.h new file mode 100644 index 000000000..e3f02a830 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/file.h @@ -0,0 +1,54 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_FILE_H +#define AVUTIL_FILE_H + +#include <stdint.h> + +#include "avutil.h" + +/** + * @file + * Misc file utilities. + */ + +/** + * Read the file with name filename, and put its content in a newly + * allocated buffer or map it with mmap() when available. + * In case of success set *bufptr to the read or mmapped buffer, and + * *size to the size in bytes of the buffer in *bufptr. + * The returned buffer must be released with av_file_unmap(). + * + * @param log_offset loglevel offset used for logging + * @param log_ctx context used for logging + * @return a non negative number in case of success, a negative value + * corresponding to an AVERROR error code in case of failure + */ +int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, + int log_offset, void *log_ctx); + +/** + * Unmap or free the buffer bufptr created by av_file_map(). + * + * @param size size in bytes of bufptr, must be the same as returned + * by av_file_map() + */ +void av_file_unmap(uint8_t *bufptr, size_t size); + +#endif /* AVUTIL_FILE_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/frame.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/frame.h new file mode 100644 index 000000000..d3360c4b2 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/frame.h @@ -0,0 +1,609 @@ +/* + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_frame + * reference-counted frame API + */ + +#ifndef AVUTIL_FRAME_H +#define AVUTIL_FRAME_H + +#include <stdint.h> + +#include "avutil.h" +#include "buffer.h" +#include "dict.h" +#include "rational.h" +#include "samplefmt.h" +#include "pixfmt.h" +#include "version.h" + + +/** + * @defgroup lavu_frame AVFrame + * @ingroup lavu_data + * + * @{ + * AVFrame is an abstraction for reference-counted raw multimedia data. + */ + +enum AVFrameSideDataType { + /** + * The data is the AVPanScan struct defined in libavcodec. + */ + AV_FRAME_DATA_PANSCAN, + /** + * ATSC A53 Part 4 Closed Captions. + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data. + * The number of bytes of CC data is AVFrameSideData.size. + */ + AV_FRAME_DATA_A53_CC, + /** + * Stereoscopic 3d metadata. + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h. + */ + AV_FRAME_DATA_STEREO3D, + /** + * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h. + */ + AV_FRAME_DATA_MATRIXENCODING, + /** + * Metadata relevant to a downmix procedure. + * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h. + */ + AV_FRAME_DATA_DOWNMIX_INFO, + /** + * ReplayGain information in the form of the AVReplayGain struct. + */ + AV_FRAME_DATA_REPLAYGAIN, + /** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the frame for correct + * presentation. + * + * See libavutil/display.h for a detailed description of the data. + */ + AV_FRAME_DATA_DISPLAYMATRIX, + /** + * Active Format Description data consisting of a single byte as specified + * in ETSI TS 101 154 using enum AVActiveFormatDescription. + */ + AV_FRAME_DATA_AFD, +}; + +enum AVActiveFormatDescription { + AV_AFD_SAME = 8, + AV_AFD_4_3 = 9, + AV_AFD_16_9 = 10, + AV_AFD_14_9 = 11, + AV_AFD_4_3_SP_14_9 = 13, + AV_AFD_16_9_SP_14_9 = 14, + AV_AFD_SP_4_3 = 15, +}; + +typedef struct AVFrameSideData { + enum AVFrameSideDataType type; + uint8_t *data; + int size; + AVDictionary *metadata; +} AVFrameSideData; + +/** + * This structure describes decoded (raw) audio or video data. + * + * AVFrame must be allocated using av_frame_alloc(). Note that this only + * allocates the AVFrame itself, the buffers for the data must be managed + * through other means (see below). + * AVFrame must be freed with av_frame_free(). + * + * AVFrame is typically allocated once and then reused multiple times to hold + * different data (e.g. a single AVFrame to hold frames received from a + * decoder). In such a case, av_frame_unref() will free any references held by + * the frame and reset it to its original clean state before it + * is reused again. + * + * The data described by an AVFrame is usually reference counted through the + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf / + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case, + * every single data plane must be contained in one of the buffers in + * AVFrame.buf or AVFrame.extended_buf. + * There may be a single buffer for all the data, or one separate buffer for + * each plane, or anything in between. + * + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added + * to the end with a minor bump. + */ +typedef struct AVFrame { +#define AV_NUM_DATA_POINTERS 8 + /** + * pointer to the picture/channel planes. + * This might be different from the first allocated byte + */ + uint8_t *data[AV_NUM_DATA_POINTERS]; + + /** + * For video, size in bytes of each picture line. + * For audio, size in bytes of each plane. + * + * For audio, only linesize[0] may be set. For planar audio, each channel + * plane must be the same size. + * + * @note The linesize may be larger than the size of usable data -- there + * may be extra padding present for performance reasons. + */ + int linesize[AV_NUM_DATA_POINTERS]; + + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data should always be set in a valid frame, + * but for planar audio with more channels that can fit in data, + * extended_data must be used in order to access all channels. + */ + uint8_t **extended_data; + + /** + * width and height of the video frame + */ + int width, height; + + /** + * number of audio samples (per channel) described by this frame + */ + int nb_samples; + + /** + * format of the frame, -1 if unknown or unset + * Values correspond to enum AVPixelFormat for video frames, + * enum AVSampleFormat for audio) + */ + int format; + + /** + * 1 -> keyframe, 0-> not + */ + int key_frame; + + /** + * Picture type of the frame. + */ + enum AVPictureType pict_type; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + uint8_t *base[AV_NUM_DATA_POINTERS]; +#endif + + /** + * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified. + */ + AVRational sample_aspect_ratio; + + /** + * Presentation timestamp in time_base units (time when frame should be shown to user). + */ + int64_t pts; + + /** + * PTS copied from the AVPacket that was decoded to produce this frame. + */ + int64_t pkt_pts; + + /** + * DTS copied from the AVPacket that triggered returning this frame. + */ + int64_t pkt_dts; + + /** + * picture number in bitstream order + */ + int coded_picture_number; + /** + * picture number in display order + */ + int display_picture_number; + + /** + * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) + */ + int quality; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + int reference; + + /** + * QP table + */ + attribute_deprecated + int8_t *qscale_table; + /** + * QP store stride + */ + attribute_deprecated + int qstride; + + attribute_deprecated + int qscale_type; + + /** + * mbskip_table[mb]>=1 if MB didn't change + * stride= mb_width = (width+15)>>4 + */ + attribute_deprecated + uint8_t *mbskip_table; + + /** + * motion vector table + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + */ + attribute_deprecated + int16_t (*motion_val[2])[2]; + + /** + * macroblock type table + * mb_type_base + mb_width + 2 + */ + attribute_deprecated + uint32_t *mb_type; + + /** + * DCT coefficients + */ + attribute_deprecated + short *dct_coeff; + + /** + * motion reference frame index + * the order in which these are stored can depend on the codec. + */ + attribute_deprecated + int8_t *ref_index[2]; +#endif + + /** + * for some private data of the user + */ + void *opaque; + + /** + * error + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + int type; +#endif + + /** + * When decoding, this signals how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps) + */ + int repeat_pict; + + /** + * The content of the picture is interlaced. + */ + int interlaced_frame; + + /** + * If the content is interlaced, is top field displayed first. + */ + int top_field_first; + + /** + * Tell user application that palette has changed from previous frame. + */ + int palette_has_changed; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + int buffer_hints; + + /** + * Pan scan. + */ + attribute_deprecated + struct AVPanScan *pan_scan; +#endif + + /** + * reordered opaque 64bit (generally an integer or a double precision float + * PTS but can be anything). + * The user sets AVCodecContext.reordered_opaque to represent the input at + * that time, + * the decoder reorders values as needed and sets AVFrame.reordered_opaque + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque + * @deprecated in favor of pkt_pts + */ + int64_t reordered_opaque; + +#if FF_API_AVFRAME_LAVC + /** + * @deprecated this field is unused + */ + attribute_deprecated void *hwaccel_picture_private; + + attribute_deprecated + struct AVCodecContext *owner; + attribute_deprecated + void *thread_opaque; + + /** + * log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) + */ + attribute_deprecated + uint8_t motion_subsample_log2; +#endif + + /** + * Sample rate of the audio data. + */ + int sample_rate; + + /** + * Channel layout of the audio data. + */ + uint64_t channel_layout; + + /** + * AVBuffer references backing the data for this frame. If all elements of + * this array are NULL, then this frame is not reference counted. + * + * There may be at most one AVBuffer per data plane, so for video this array + * always contains all the references. For planar audio with more than + * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in + * this array. Then the extra AVBufferRef pointers are stored in the + * extended_buf array. + */ + AVBufferRef *buf[AV_NUM_DATA_POINTERS]; + + /** + * For planar audio which requires more than AV_NUM_DATA_POINTERS + * AVBufferRef pointers, this array will hold all the references which + * cannot fit into AVFrame.buf. + * + * Note that this is different from AVFrame.extended_data, which always + * contains all the pointers. This array only contains the extra pointers, + * which cannot fit into AVFrame.buf. + * + * This array is always allocated using av_malloc() by whoever constructs + * the frame. It is freed in av_frame_unref(). + */ + AVBufferRef **extended_buf; + /** + * Number of elements in extended_buf. + */ + int nb_extended_buf; + + AVFrameSideData **side_data; + int nb_side_data; + +/** + * @defgroup lavu_frame_flags AV_FRAME_FLAGS + * Flags describing additional frame properties. + * + * @{ + */ + +/** + * The frame data may be corrupted, e.g. due to decoding errors. + */ +#define AV_FRAME_FLAG_CORRUPT (1 << 0) +/** + * @} + */ + + /** + * Frame flags, a combination of @ref lavu_frame_flags + */ + int flags; + + enum AVColorRange color_range; + + enum AVColorPrimaries color_primaries; + + enum AVColorTransferCharacteristic color_trc; + + enum AVColorSpace colorspace; + + enum AVChromaLocation chroma_location; +} AVFrame; + +/** + * Allocate an AVFrame and set its fields to default values. The resulting + * struct must be freed using av_frame_free(). + * + * @return An AVFrame filled with default values or NULL on failure. + * + * @note this only allocates the AVFrame itself, not the data buffers. Those + * must be allocated through other means, e.g. with av_frame_get_buffer() or + * manually. + */ +AVFrame *av_frame_alloc(void); + +/** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. If the frame is reference counted, it will be + * unreferenced first. + * + * @param frame frame to be freed. The pointer will be set to NULL. + */ +void av_frame_free(AVFrame **frame); + +/** + * Set up a new reference to the data described by the source frame. + * + * Copy frame properties from src to dst and create a new reference for each + * AVBufferRef from src. + * + * If src is not reference counted, new buffers are allocated and the data is + * copied. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_frame_ref(AVFrame *dst, const AVFrame *src); + +/** + * Create a new frame that references the same data as src. + * + * This is a shortcut for av_frame_alloc()+av_frame_ref(). + * + * @return newly created AVFrame on success, NULL on error. + */ +AVFrame *av_frame_clone(const AVFrame *src); + +/** + * Unreference all the buffers referenced by frame and reset the frame fields. + */ +void av_frame_unref(AVFrame *frame); + +/** + * Move everythnig contained in src to dst and reset src. + */ +void av_frame_move_ref(AVFrame *dst, AVFrame *src); + +/** + * Allocate new buffer(s) for audio or video data. + * + * The following fields must be set on frame before calling this function: + * - format (pixel format for video, sample format for audio) + * - width and height for video + * - nb_samples and channel_layout for audio + * + * This function will fill AVFrame.data and AVFrame.buf arrays and, if + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf. + * For planar formats, one buffer will be allocated for each plane. + * + * @param frame frame in which to store the new buffers. + * @param align required buffer size alignment + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_frame_get_buffer(AVFrame *frame, int align); + +/** + * Check if the frame data is writable. + * + * @return A positive value if the frame data is writable (which is true if and + * only if each of the underlying buffers has only one reference, namely the one + * stored in this frame). Return 0 otherwise. + * + * If 1 is returned the answer is valid until av_buffer_ref() is called on any + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly). + * + * @see av_frame_make_writable(), av_buffer_is_writable() + */ +int av_frame_is_writable(AVFrame *frame); + +/** + * Ensure that the frame data is writable, avoiding data copy if possible. + * + * Do nothing if the frame is writable, allocate new buffers and copy the data + * if it is not. + * + * @return 0 on success, a negative AVERROR on error. + * + * @see av_frame_is_writable(), av_buffer_is_writable(), + * av_buffer_make_writable() + */ +int av_frame_make_writable(AVFrame *frame); + +/** + * Copy the frame data from src to dst. + * + * This function does not allocate anything, dst must be already initialized and + * allocated with the same parameters as src. + * + * This function only copies the frame data (i.e. the contents of the data / + * extended data arrays), not any other properties. + * + * @return >= 0 on success, a negative AVERROR on error. + */ +int av_frame_copy(AVFrame *dst, const AVFrame *src); + +/** + * Copy only "metadata" fields from src to dst. + * + * Metadata for the purpose of this function are those fields that do not affect + * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample + * aspect ratio (for video), but not width/height or channel layout. + * Side data is also copied. + */ +int av_frame_copy_props(AVFrame *dst, const AVFrame *src); + +/** + * Get the buffer reference a given data plane is stored in. + * + * @param plane index of the data plane of interest in frame->extended_data. + * + * @return the buffer reference that contains the plane or NULL if the input + * frame is not valid. + */ +AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); + +/** + * Add a new side data to a frame. + * + * @param frame a frame to which the side data should be added + * @param type type of the added side data + * @param size size of the side data + * + * @return newly added side data on success, NULL on error + */ +AVFrameSideData *av_frame_new_side_data(AVFrame *frame, + enum AVFrameSideDataType type, + int size); + +/** + * @return a pointer to the side data of a given type on success, NULL if there + * is no side data with such type in this frame. + */ +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, + enum AVFrameSideDataType type); + +/** + * If side data of the supplied type exists in the frame, free it and remove it + * from the frame. + */ +void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type); + +/** + * @} + */ + +#endif /* AVUTIL_FRAME_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/hmac.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/hmac.h new file mode 100644 index 000000000..28c2062b1 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/hmac.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2012 Martin Storsjo + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HMAC_H +#define AVUTIL_HMAC_H + +#include <stdint.h> + +/** + * @defgroup lavu_hmac HMAC + * @ingroup lavu_crypto + * @{ + */ + +enum AVHMACType { + AV_HMAC_MD5, + AV_HMAC_SHA1, +}; + +typedef struct AVHMAC AVHMAC; + +/** + * Allocate an AVHMAC context. + * @param type The hash function used for the HMAC. + */ +AVHMAC *av_hmac_alloc(enum AVHMACType type); + +/** + * Free an AVHMAC context. + * @param ctx The context to free, may be NULL + */ +void av_hmac_free(AVHMAC *ctx); + +/** + * Initialize an AVHMAC context with an authentication key. + * @param ctx The HMAC context + * @param key The authentication key + * @param keylen The length of the key, in bytes + */ +void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); + +/** + * Hash data with the HMAC. + * @param ctx The HMAC context + * @param data The data to hash + * @param len The length of the data, in bytes + */ +void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); + +/** + * Finish hashing and output the HMAC digest. + * @param ctx The HMAC context + * @param out The output buffer to write the digest into + * @param outlen The length of the out buffer, in bytes + * @return The number of bytes written to out, or a negative error code. + */ +int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); + +/** + * Hash an array of data with a key. + * @param ctx The HMAC context + * @param data The data to hash + * @param len The length of the data, in bytes + * @param key The authentication key + * @param keylen The length of the key, in bytes + * @param out The output buffer to write the digest into + * @param outlen The length of the out buffer, in bytes + * @return The number of bytes written to out, or a negative error code. + */ +int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, + const uint8_t *key, unsigned int keylen, + uint8_t *out, unsigned int outlen); + +/** + * @} + */ + +#endif /* AVUTIL_HMAC_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/imgutils.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/imgutils.h new file mode 100644 index 000000000..50fa8159e --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/imgutils.h @@ -0,0 +1,151 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_IMGUTILS_H +#define AVUTIL_IMGUTILS_H + +/** + * @file + * misc image utilities + * + * @addtogroup lavu_picture + * @{ + */ + +#include "avutil.h" +#include "pixdesc.h" +#include "rational.h" + +/** + * Compute the max pixel step for each plane of an image with a + * format described by pixdesc. + * + * The pixel step is the distance in bytes between the first byte of + * the group of bytes which describe a pixel component and the first + * byte of the successive group in the same plane for the same + * component. + * + * @param max_pixsteps an array which is filled with the max pixel step + * for each plane. Since a plane may contain different pixel + * components, the computed max_pixsteps[plane] is relative to the + * component in the plane with the max pixel step. + * @param max_pixstep_comps an array which is filled with the component + * for each plane which has the max pixel step. May be NULL. + */ +void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc); + +/** + * Compute the size of an image line with format pix_fmt and width + * width for the plane plane. + * + * @return the computed size in bytes + */ +int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane); + +/** + * Fill plane linesizes for an image with pixel format pix_fmt and + * width width. + * + * @param linesizes array to be filled with the linesize for each plane + * @return >= 0 in case of success, a negative error code otherwise + */ +int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width); + +/** + * Fill plane data pointers for an image with pixel format pix_fmt and + * height height. + * + * @param data pointers array to be filled with the pointer for each image plane + * @param ptr the pointer to a buffer which will contain the image + * @param linesizes the array containing the linesize for each + * plane, should be filled by av_image_fill_linesizes() + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height, + uint8_t *ptr, const int linesizes[4]); + +/** + * Allocate an image with size w and h and pixel format pix_fmt, and + * fill pointers and linesizes accordingly. + * The allocated image buffer has to be freed by using + * av_freep(&pointers[0]). + * + * @param align the value to use for buffer size alignment + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_alloc(uint8_t *pointers[4], int linesizes[4], + int w, int h, enum AVPixelFormat pix_fmt, int align); + +/** + * Copy image plane from src to dst. + * That is, copy "height" number of lines of "bytewidth" bytes each. + * The first byte of each successive line is separated by *_linesize + * bytes. + * + * @param dst_linesize linesize for the image plane in dst + * @param src_linesize linesize for the image plane in src + */ +void av_image_copy_plane(uint8_t *dst, int dst_linesize, + const uint8_t *src, int src_linesize, + int bytewidth, int height); + +/** + * Copy image in src_data to dst_data. + * + * @param dst_linesizes linesizes for the image in dst_data + * @param src_linesizes linesizes for the image in src_data + */ +void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], + const uint8_t *src_data[4], const int src_linesizes[4], + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Check if the given dimension of an image is valid, meaning that all + * bytes of the image can be addressed with a signed int. + * + * @param w the width of the picture + * @param h the height of the picture + * @param log_offset the offset to sum to the log level for logging with log_ctx + * @param log_ctx the parent logging context, it may be NULL + * @return >= 0 if valid, a negative error code otherwise + */ +int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); + +/** + * Check if the given sample aspect ratio of an image is valid. + * + * It is considered invalid if the denominator is 0 or if applying the ratio + * to the image size would make the smaller dimension less than 1. If the + * sar numerator is 0, it is considered unknown and will return as valid. + * + * @param w width of the image + * @param h height of the image + * @param sar sample aspect ratio of the image + * @return 0 if valid, a negative AVERROR code otherwise + */ +int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar); + +/** + * @} + */ + + +#endif /* AVUTIL_IMGUTILS_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/intfloat.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/intfloat.h new file mode 100644 index 000000000..38d26ad87 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/intfloat.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTFLOAT_H +#define AVUTIL_INTFLOAT_H + +#include <stdint.h> +#include "attributes.h" + +union av_intfloat32 { + uint32_t i; + float f; +}; + +union av_intfloat64 { + uint64_t i; + double f; +}; + +/** + * Reinterpret a 32-bit integer as a float. + */ +static av_always_inline float av_int2float(uint32_t i) +{ + union av_intfloat32 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a float as a 32-bit integer. + */ +static av_always_inline uint32_t av_float2int(float f) +{ + union av_intfloat32 v; + v.f = f; + return v.i; +} + +/** + * Reinterpret a 64-bit integer as a double. + */ +static av_always_inline double av_int2double(uint64_t i) +{ + union av_intfloat64 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a double as a 64-bit integer. + */ +static av_always_inline uint64_t av_double2int(double f) +{ + union av_intfloat64 v; + v.f = f; + return v.i; +} + +#endif /* AVUTIL_INTFLOAT_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/intreadwrite.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/intreadwrite.h new file mode 100644 index 000000000..f77fd60f3 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/intreadwrite.h @@ -0,0 +1,549 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTREADWRITE_H +#define AVUTIL_INTREADWRITE_H + +#include <stdint.h> +#include "libavutil/avconfig.h" +#include "attributes.h" +#include "bswap.h" + +typedef union { + uint64_t u64; + uint32_t u32[2]; + uint16_t u16[4]; + uint8_t u8 [8]; + double f64; + float f32[2]; +} av_alias av_alias64; + +typedef union { + uint32_t u32; + uint16_t u16[2]; + uint8_t u8 [4]; + float f32; +} av_alias av_alias32; + +typedef union { + uint16_t u16; + uint8_t u8 [2]; +} av_alias av_alias16; + +/* + * Arch-specific headers can provide any combination of + * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. + * Preprocessor symbols must be defined, even if these are implemented + * as inline functions. + */ + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_ARM +# include "arm/intreadwrite.h" +#elif ARCH_AVR32 +# include "avr32/intreadwrite.h" +#elif ARCH_MIPS +# include "mips/intreadwrite.h" +#elif ARCH_PPC +# include "ppc/intreadwrite.h" +#elif ARCH_TOMI +# include "tomi/intreadwrite.h" +#elif ARCH_X86 +# include "x86/intreadwrite.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +/* + * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. + */ + +#if AV_HAVE_BIGENDIAN + +# if defined(AV_RN16) && !defined(AV_RB16) +# define AV_RB16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RB16) +# define AV_RN16(p) AV_RB16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WB16) +# define AV_WB16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WB16) +# define AV_WN16(p, v) AV_WB16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RB24) +# define AV_RB24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RB24) +# define AV_RN24(p) AV_RB24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WB24) +# define AV_WB24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WB24) +# define AV_WN24(p, v) AV_WB24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RB32) +# define AV_RB32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RB32) +# define AV_RN32(p) AV_RB32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WB32) +# define AV_WB32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WB32) +# define AV_WN32(p, v) AV_WB32(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RB64) +# define AV_RB64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RB64) +# define AV_RN64(p) AV_RB64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WB64) +# define AV_WB64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WB64) +# define AV_WN64(p, v) AV_WB64(p, v) +# endif + +#else /* AV_HAVE_BIGENDIAN */ + +# if defined(AV_RN16) && !defined(AV_RL16) +# define AV_RL16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RL16) +# define AV_RN16(p) AV_RL16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WL16) +# define AV_WL16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WL16) +# define AV_WN16(p, v) AV_WL16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RL24) +# define AV_RL24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RL24) +# define AV_RN24(p) AV_RL24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WL24) +# define AV_WL24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WL24) +# define AV_WN24(p, v) AV_WL24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RL32) +# define AV_RL32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RL32) +# define AV_RN32(p) AV_RL32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WL32) +# define AV_WL32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WL32) +# define AV_WN32(p, v) AV_WL32(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RL64) +# define AV_RL64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RL64) +# define AV_RN64(p) AV_RL64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WL64) +# define AV_WL64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WL64) +# define AV_WN64(p, v) AV_WL64(p, v) +# endif + +#endif /* !AV_HAVE_BIGENDIAN */ + +/* + * Define AV_[RW]N helper macros to simplify definitions not provided + * by per-arch headers. + */ + +#if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__) + +union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; +union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; +union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; + +# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) +# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) + +#elif defined(__DECC) + +# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) +# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) + +#elif AV_HAVE_FAST_UNALIGNED + +# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) +# define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#else + +#ifndef AV_RB16 +# define AV_RB16(x) \ + ((((const uint8_t*)(x))[0] << 8) | \ + ((const uint8_t*)(x))[1]) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, d) do { \ + ((uint8_t*)(p))[1] = (d); \ + ((uint8_t*)(p))[0] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RL16 +# define AV_RL16(x) \ + ((((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RB32 +# define AV_RB32(x) \ + (((uint32_t)((const uint8_t*)(x))[0] << 24) | \ + (((const uint8_t*)(x))[1] << 16) | \ + (((const uint8_t*)(x))[2] << 8) | \ + ((const uint8_t*)(x))[3]) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, d) do { \ + ((uint8_t*)(p))[3] = (d); \ + ((uint8_t*)(p))[2] = (d)>>8; \ + ((uint8_t*)(p))[1] = (d)>>16; \ + ((uint8_t*)(p))[0] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RL32 +# define AV_RL32(x) \ + (((uint32_t)((const uint8_t*)(x))[3] << 24) | \ + (((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RB64 +# define AV_RB64(x) \ + (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 8) | \ + (uint64_t)((const uint8_t*)(x))[7]) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, d) do { \ + ((uint8_t*)(p))[7] = (d); \ + ((uint8_t*)(p))[6] = (d)>>8; \ + ((uint8_t*)(p))[5] = (d)>>16; \ + ((uint8_t*)(p))[4] = (d)>>24; \ + ((uint8_t*)(p))[3] = (d)>>32; \ + ((uint8_t*)(p))[2] = (d)>>40; \ + ((uint8_t*)(p))[1] = (d)>>48; \ + ((uint8_t*)(p))[0] = (d)>>56; \ + } while(0) +#endif + +#ifndef AV_RL64 +# define AV_RL64(x) \ + (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ + (uint64_t)((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + ((uint8_t*)(p))[4] = (d)>>32; \ + ((uint8_t*)(p))[5] = (d)>>40; \ + ((uint8_t*)(p))[6] = (d)>>48; \ + ((uint8_t*)(p))[7] = (d)>>56; \ + } while(0) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RN(s, p) AV_RB##s(p) +# define AV_WN(s, p, v) AV_WB##s(p, v) +#else +# define AV_RN(s, p) AV_RL##s(p) +# define AV_WN(s, p, v) AV_WL##s(p, v) +#endif + +#endif /* HAVE_FAST_UNALIGNED */ + +#ifndef AV_RN16 +# define AV_RN16(p) AV_RN(16, p) +#endif + +#ifndef AV_RN32 +# define AV_RN32(p) AV_RN(32, p) +#endif + +#ifndef AV_RN64 +# define AV_RN64(p) AV_RN(64, p) +#endif + +#ifndef AV_WN16 +# define AV_WN16(p, v) AV_WN(16, p, v) +#endif + +#ifndef AV_WN32 +# define AV_WN32(p, v) AV_WN(32, p, v) +#endif + +#ifndef AV_WN64 +# define AV_WN64(p, v) AV_WN(64, p, v) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RB(s, p) AV_RN##s(p) +# define AV_WB(s, p, v) AV_WN##s(p, v) +# define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) +#else +# define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) +# define AV_RL(s, p) AV_RN##s(p) +# define AV_WL(s, p, v) AV_WN##s(p, v) +#endif + +#define AV_RB8(x) (((const uint8_t*)(x))[0]) +#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) + +#define AV_RL8(x) AV_RB8(x) +#define AV_WL8(p, d) AV_WB8(p, d) + +#ifndef AV_RB16 +# define AV_RB16(p) AV_RB(16, p) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, v) AV_WB(16, p, v) +#endif + +#ifndef AV_RL16 +# define AV_RL16(p) AV_RL(16, p) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, v) AV_WL(16, p, v) +#endif + +#ifndef AV_RB32 +# define AV_RB32(p) AV_RB(32, p) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, v) AV_WB(32, p, v) +#endif + +#ifndef AV_RL32 +# define AV_RL32(p) AV_RL(32, p) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, v) AV_WL(32, p, v) +#endif + +#ifndef AV_RB64 +# define AV_RB64(p) AV_RB(64, p) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, v) AV_WB(64, p, v) +#endif + +#ifndef AV_RL64 +# define AV_RL64(p) AV_RL(64, p) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, v) AV_WL(64, p, v) +#endif + +#ifndef AV_RB24 +# define AV_RB24(x) \ + ((((const uint8_t*)(x))[0] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[2]) +#endif +#ifndef AV_WB24 +# define AV_WB24(p, d) do { \ + ((uint8_t*)(p))[2] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[0] = (d)>>16; \ + } while(0) +#endif + +#ifndef AV_RL24 +# define AV_RL24(x) \ + ((((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL24 +# define AV_WL24(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + } while(0) +#endif + +/* + * The AV_[RW]NA macros access naturally aligned data + * in a type-safe way. + */ + +#define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) +#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#ifndef AV_RN16A +# define AV_RN16A(p) AV_RNA(16, p) +#endif + +#ifndef AV_RN32A +# define AV_RN32A(p) AV_RNA(32, p) +#endif + +#ifndef AV_RN64A +# define AV_RN64A(p) AV_RNA(64, p) +#endif + +#ifndef AV_WN16A +# define AV_WN16A(p, v) AV_WNA(16, p, v) +#endif + +#ifndef AV_WN32A +# define AV_WN32A(p, v) AV_WNA(32, p, v) +#endif + +#ifndef AV_WN64A +# define AV_WN64A(p, v) AV_WNA(64, p, v) +#endif + +/* + * The AV_COPYxxU macros are suitable for copying data to/from unaligned + * memory locations. + */ + +#define AV_COPYU(n, d, s) AV_WN##n(d, AV_RN##n(s)); + +#ifndef AV_COPY16U +# define AV_COPY16U(d, s) AV_COPYU(16, d, s) +#endif + +#ifndef AV_COPY32U +# define AV_COPY32U(d, s) AV_COPYU(32, d, s) +#endif + +#ifndef AV_COPY64U +# define AV_COPY64U(d, s) AV_COPYU(64, d, s) +#endif + +#ifndef AV_COPY128U +# define AV_COPY128U(d, s) \ + do { \ + AV_COPY64U(d, s); \ + AV_COPY64U((char *)(d) + 8, (const char *)(s) + 8); \ + } while(0) +#endif + +/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be + * naturally aligned. They may be implemented using MMX, + * so emms_c() must be called before using any float code + * afterwards. + */ + +#define AV_COPY(n, d, s) \ + (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) + +#ifndef AV_COPY16 +# define AV_COPY16(d, s) AV_COPY(16, d, s) +#endif + +#ifndef AV_COPY32 +# define AV_COPY32(d, s) AV_COPY(32, d, s) +#endif + +#ifndef AV_COPY64 +# define AV_COPY64(d, s) AV_COPY(64, d, s) +#endif + +#ifndef AV_COPY128 +# define AV_COPY128(d, s) \ + do { \ + AV_COPY64(d, s); \ + AV_COPY64((char*)(d)+8, (char*)(s)+8); \ + } while(0) +#endif + +#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) + +#ifndef AV_SWAP64 +# define AV_SWAP64(a, b) AV_SWAP(64, a, b) +#endif + +#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) + +#ifndef AV_ZERO16 +# define AV_ZERO16(d) AV_ZERO(16, d) +#endif + +#ifndef AV_ZERO32 +# define AV_ZERO32(d) AV_ZERO(32, d) +#endif + +#ifndef AV_ZERO64 +# define AV_ZERO64(d) AV_ZERO(64, d) +#endif + +#ifndef AV_ZERO128 +# define AV_ZERO128(d) \ + do { \ + AV_ZERO64(d); \ + AV_ZERO64((char*)(d)+8); \ + } while(0) +#endif + +#endif /* AVUTIL_INTREADWRITE_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/lfg.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/lfg.h new file mode 100644 index 000000000..5e526c1da --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/lfg.h @@ -0,0 +1,62 @@ +/* + * Lagged Fibonacci PRNG + * Copyright (c) 2008 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LFG_H +#define AVUTIL_LFG_H + +typedef struct AVLFG { + unsigned int state[64]; + int index; +} AVLFG; + +void av_lfg_init(AVLFG *c, unsigned int seed); + +/** + * Get the next random unsigned 32-bit number using an ALFG. + * + * Please also consider a simple LCG like state= state*1664525+1013904223, + * it may be good enough and faster for your specific use case. + */ +static inline unsigned int av_lfg_get(AVLFG *c){ + c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; + return c->state[c->index++ & 63]; +} + +/** + * Get the next random unsigned 32-bit number using a MLFG. + * + * Please also consider av_lfg_get() above, it is faster. + */ +static inline unsigned int av_mlfg_get(AVLFG *c){ + unsigned int a= c->state[(c->index-55) & 63]; + unsigned int b= c->state[(c->index-24) & 63]; + return c->state[c->index++ & 63] = 2*a*b+a+b; +} + +/** + * Get the next two numbers generated by a Box-Muller Gaussian + * generator using the random numbers issued by lfg. + * + * @param out array where the two generated numbers are placed + */ +void av_bmg_get(AVLFG *lfg, double out[2]); + +#endif /* AVUTIL_LFG_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/log.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/log.h new file mode 100644 index 000000000..4e4424a55 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/log.h @@ -0,0 +1,272 @@ +/* + * copyright (c) 2006 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LOG_H +#define AVUTIL_LOG_H + +#include <stdarg.h> +#include "avutil.h" +#include "attributes.h" + +/** + * Describe the class of an AVClass context structure. That is an + * arbitrary struct of which the first field is a pointer to an + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). + */ +typedef struct AVClass { + /** + * The name of the class; usually it is the same name as the + * context structure type to which the AVClass is associated. + */ + const char* class_name; + + /** + * A pointer to a function which returns the name of a context + * instance ctx associated with the class. + */ + const char* (*item_name)(void* ctx); + + /** + * a pointer to the first option specified in the class if any or NULL + * + * @see av_set_default_options() + */ + const struct AVOption *option; + + /** + * LIBAVUTIL_VERSION with which this structure was created. + * This is used to allow fields to be added without requiring major + * version bumps everywhere. + */ + + int version; + + /** + * Offset in the structure where log_level_offset is stored. + * 0 means there is no such variable + */ + int log_level_offset_offset; + + /** + * Offset in the structure where a pointer to the parent context for + * logging is stored. For example a decoder could pass its AVCodecContext + * to eval as such a parent context, which an av_log() implementation + * could then leverage to display the parent context. + * The offset can be NULL. + */ + int parent_log_context_offset; + + /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + + /** + * Return an AVClass corresponding to the next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + */ + const struct AVClass* (*child_class_next)(const struct AVClass *prev); +} AVClass; + +/** + * @addtogroup lavu_log + * + * @{ + * + * @defgroup lavu_log_constants Logging Constants + * + * @{ + */ + +/** + * Print no output. + */ +#define AV_LOG_QUIET -8 + +/** + * Something went really wrong and we will crash now. + */ +#define AV_LOG_PANIC 0 + +/** + * Something went wrong and recovery is not possible. + * For example, no header was found for a format which depends + * on headers or an illegal combination of parameters is used. + */ +#define AV_LOG_FATAL 8 + +/** + * Something went wrong and cannot losslessly be recovered. + * However, not all future data is affected. + */ +#define AV_LOG_ERROR 16 + +/** + * Something somehow does not look correct. This may or may not + * lead to problems. An example would be the use of '-vstrict -2'. + */ +#define AV_LOG_WARNING 24 + +/** + * Standard information. + */ +#define AV_LOG_INFO 32 + +/** + * Detailed information. + */ +#define AV_LOG_VERBOSE 40 + +/** + * Stuff which is only useful for libav* developers. + */ +#define AV_LOG_DEBUG 48 + +/** + * @} + */ + +/** + * Sets additional colors for extended debugging sessions. + * @code + av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n"); + @endcode + * Requires 256color terminal support. Uses outside debugging is not + * recommended. + */ +#define AV_LOG_C(x) (x << 8) + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log_set_callback + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + */ +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); + + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log_set_callback + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + */ +void av_vlog(void *avcl, int level, const char *fmt, va_list vl); + +/** + * Get the current log level + * + * @see lavu_log_constants + * + * @return Current log level + */ +int av_log_get_level(void); + +/** + * Set the log level + * + * @see lavu_log_constants + * + * @param level Logging level + */ +void av_log_set_level(int level); + +/** + * Set the logging callback + * + * @see av_log_default_callback + * + * @param callback A logging function with a compatible signature. + */ +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)); + +/** + * Default logging callback + * + * It prints the message to stderr, optionally colorizing it. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + */ +void av_log_default_callback(void *avcl, int level, const char *fmt, + va_list vl); + +/** + * Return the context name + * + * @param ctx The AVClass context + * + * @return The AVClass class_name + */ +const char* av_default_item_name(void* ctx); + +/** + * av_dlog macros + * Useful to print debug messages that shouldn't get compiled in normally. + */ + +#ifdef DEBUG +# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) +#else +# define av_dlog(pctx, ...) +#endif + +/** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, ""); at the end + */ +#define AV_LOG_SKIP_REPEATED 1 +void av_log_set_flags(int arg); + +/** + * @} + */ + +#endif /* AVUTIL_LOG_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/lzo.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/lzo.h new file mode 100644 index 000000000..9d7e8f1dc --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/lzo.h @@ -0,0 +1,66 @@ +/* + * LZO 1x decompression + * copyright (c) 2006 Reimar Doeffinger + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LZO_H +#define AVUTIL_LZO_H + +/** + * @defgroup lavu_lzo LZO + * @ingroup lavu_crypto + * + * @{ + */ + +#include <stdint.h> + +/** @name Error flags returned by av_lzo1x_decode + * @{ */ +/// end of the input buffer reached before decoding finished +#define AV_LZO_INPUT_DEPLETED 1 +/// decoded data did not fit into output buffer +#define AV_LZO_OUTPUT_FULL 2 +/// a reference to previously decoded data was wrong +#define AV_LZO_INVALID_BACKPTR 4 +/// a non-specific error in the compressed bitstream +#define AV_LZO_ERROR 8 +/** @} */ + +#define AV_LZO_INPUT_PADDING 8 +#define AV_LZO_OUTPUT_PADDING 12 + +/** + * @brief Decodes LZO 1x compressed data. + * @param out output buffer + * @param outlen size of output buffer, number of bytes left are returned here + * @param in input buffer + * @param inlen size of input buffer, number of bytes left are returned here + * @return 0 on success, otherwise a combination of the error flags above + * + * Make sure all buffers are appropriately padded, in must provide + * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. + */ +int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); + +/** + * @} + */ + +#endif /* AVUTIL_LZO_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/macros.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/macros.h new file mode 100644 index 000000000..bf3eb9b9a --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/macros.h @@ -0,0 +1,48 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu + * Utility Preprocessor macros + */ + +#ifndef AVUTIL_MACROS_H +#define AVUTIL_MACROS_H + +/** + * @addtogroup preproc_misc Preprocessor String Macros + * + * String manipulation macros + * + * @{ + */ + +#define AV_STRINGIFY(s) AV_TOSTRING(s) +#define AV_TOSTRING(s) #s + +#define AV_GLUE(a, b) a ## b +#define AV_JOIN(a, b) AV_GLUE(a, b) + +/** + * @} + */ + +#define AV_PRAGMA(s) _Pragma(#s) + +#endif /* AVUTIL_MACROS_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/mathematics.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/mathematics.h new file mode 100644 index 000000000..043dd0faf --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/mathematics.h @@ -0,0 +1,111 @@ +/* + * copyright (c) 2005 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MATHEMATICS_H +#define AVUTIL_MATHEMATICS_H + +#include <stdint.h> +#include <math.h> +#include "attributes.h" +#include "rational.h" +#include "intfloat.h" + +#ifndef M_LOG2_10 +#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ +#endif +#ifndef M_PHI +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ +#endif +#ifndef NAN +#define NAN av_int2float(0x7fc00000) +#endif +#ifndef INFINITY +#define INFINITY av_int2float(0x7f800000) +#endif + +/** + * @addtogroup lavu_math + * @{ + */ + + +enum AVRounding { + AV_ROUND_ZERO = 0, ///< Round toward zero. + AV_ROUND_INF = 1, ///< Round away from zero. + AV_ROUND_DOWN = 2, ///< Round toward -infinity. + AV_ROUND_UP = 3, ///< Round toward +infinity. + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. +}; + +/** + * Return the greatest common divisor of a and b. + * If both a and b are 0 or either or both are <0 then behavior is + * undefined. + */ +int64_t av_const av_gcd(int64_t a, int64_t b); + +/** + * Rescale a 64-bit integer with rounding to nearest. + * A simple a*b/c isn't possible as it can overflow. + */ +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; + +/** + * Rescale a 64-bit integer with specified rounding. + * A simple a*b/c isn't possible as it can overflow. + */ +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers. + */ +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers with specified rounding. + */ +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, + enum AVRounding) av_const; + +/** + * Compare 2 timestamps each in its own timebases. + * The result of the function is undefined if one of the timestamps + * is outside the int64_t range when represented in the others timebase. + * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position + */ +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); + +/** + * Compare 2 integers modulo mod. + * That is we compare integers a and b for which only the least + * significant log2(mod) bits are known. + * + * @param mod must be a power of 2 + * @return a negative value if a is smaller than b + * a positive value if a is greater than b + * 0 if a equals b + */ +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); + +/** + * @} + */ + +#endif /* AVUTIL_MATHEMATICS_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/md5.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/md5.h new file mode 100644 index 000000000..29e4e7c2b --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/md5.h @@ -0,0 +1,51 @@ +/* + * copyright (c) 2006 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MD5_H +#define AVUTIL_MD5_H + +#include <stdint.h> + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_md5 MD5 + * @ingroup lavu_crypto + * @{ + */ + +#if FF_API_CONTEXT_SIZE +extern attribute_deprecated const int av_md5_size; +#endif + +struct AVMD5; + +struct AVMD5 *av_md5_alloc(void); +void av_md5_init(struct AVMD5 *ctx); +void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); +void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); +void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); + +/** + * @} + */ + +#endif /* AVUTIL_MD5_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/mem.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/mem.h new file mode 100644 index 000000000..9f667c270 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/mem.h @@ -0,0 +1,275 @@ +/* + * copyright (c) 2006 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * memory handling functions + */ + +#ifndef AVUTIL_MEM_H +#define AVUTIL_MEM_H + +#include <limits.h> +#include <stdint.h> + +#include "attributes.h" +#include "avutil.h" + +/** + * @addtogroup lavu_mem + * @{ + */ + + +#if defined(__ICC) && __ICC < 1200 || defined(__SUNPRO_C) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v +#elif defined(__TI_COMPILER_VERSION__) + #define DECLARE_ALIGNED(n,t,v) \ + AV_PRAGMA(DATA_ALIGN(v,n)) \ + t __attribute__((aligned(n))) v + #define DECLARE_ASM_CONST(n,t,v) \ + AV_PRAGMA(DATA_ALIGN(v,n)) \ + static const t __attribute__((aligned(n))) v +#elif defined(__GNUC__) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v +#elif defined(_MSC_VER) + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v + #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v +#else + #define DECLARE_ALIGNED(n,t,v) t v + #define DECLARE_ASM_CONST(n,t,v) static const t v +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) + #define av_malloc_attrib __attribute__((__malloc__)) +#else + #define av_malloc_attrib +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,3) + #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) +#else + #define av_alloc_size(...) +#endif + +/** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU). + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + */ +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a block of size * nmemb bytes with av_malloc(). + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_malloc() + */ +av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size) +{ + if (!size || nmemb >= INT_MAX / size) + return NULL; + return av_malloc(nmemb * size); +} + +/** + * Allocate or reallocate a block of memory. + * If ptr is NULL and size > 0, allocate a new block. If + * size is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_realloc() or NULL. + * @param size Size in bytes of the memory block to be allocated or + * reallocated. + * @return Pointer to a newly-reallocated block or NULL if the block + * cannot be reallocated or the function is used to free the memory block. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + * @see av_fast_realloc() + */ +void *av_realloc(void *ptr, size_t size) av_alloc_size(2); + +/** + * Allocate or reallocate a block of memory. + * If *ptr is NULL and size > 0, allocate a new block. If + * size is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a pointer to a memory block already allocated + * with av_realloc(), or pointer to a pointer to NULL. + * The pointer is updated on success, or freed on failure. + * @param size Size in bytes for the memory block to be allocated or + * reallocated + * @return Zero on success, an AVERROR error code on failure. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_reallocp(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + */ +int av_reallocp(void *ptr, size_t size); + +/** + * Allocate or reallocate an array. + * If ptr is NULL and nmemb > 0, allocate a new block. If + * nmemb is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_realloc() or NULL. + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to a newly-reallocated block or NULL if the block + * cannot be reallocated or the function is used to free the memory block. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + */ +av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size); + +/** + * Allocate or reallocate an array through a pointer to a pointer. + * If *ptr is NULL and nmemb > 0, allocate a new block. If + * nmemb is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a pointer to a memory block already allocated + * with av_realloc(), or pointer to a pointer to NULL. + * The pointer is updated on success, or freed on failure. + * @param nmemb Number of elements + * @param size Size of the single element + * @return Zero on success, an AVERROR error code on failure. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + */ +av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size); + +/** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc(). + * @param ptr Pointer to the memory block which should be freed. + * @note ptr = NULL is explicitly allowed. + * @note It is recommended that you use av_freep() instead. + * @see av_freep() + */ +void av_free(void *ptr); + +/** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zero all the bytes of the block. + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if it cannot be allocated. + * @see av_malloc() + */ +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a block of size * nmemb bytes with av_mallocz(). + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + * @see av_malloc_array() + */ +av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size) +{ + if (!size || nmemb >= INT_MAX / size) + return NULL; + return av_mallocz(nmemb * size); +} + +/** + * Duplicate the string s. + * @param s string to be duplicated + * @return Pointer to a newly-allocated string containing a + * copy of s or NULL if the string cannot be allocated. + */ +char *av_strdup(const char *s) av_malloc_attrib; + +/** + * Duplicate a substring of the string s. + * @param s string to be duplicated + * @param len the maximum length of the resulting string (not counting the + * terminating byte). + * @return Pointer to a newly-allocated string containing a + * copy of s or NULL if the string cannot be allocated. + */ +char *av_strndup(const char *s, size_t len) av_malloc_attrib; + +/** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc() and set the pointer pointing to it to NULL. + * @param ptr Pointer to the pointer to the memory block which should + * be freed. + * @see av_free() + */ +void av_freep(void *ptr); + +/** + * deliberately overlapping memcpy implementation + * @param dst destination buffer + * @param back how many bytes back we start (the initial size of the overlapping window) + * @param cnt number of bytes to copy, must be >= 0 + * + * cnt > back is valid, this will copy the bytes we just copied, + * thus creating a repeating pattern with a period length of back. + */ +void av_memcpy_backptr(uint8_t *dst, int back, int cnt); + +/** + * Reallocate the given block if it is not large enough, otherwise do nothing. + * + * @see av_realloc + */ +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Allocate a buffer, reusing the given one if large enough. + * + * Contrary to av_fast_realloc the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special + * handling to avoid memleaks is necessary. + * + * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer + * @param size size of the buffer *ptr points to + * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and + * *size 0 if an error occurred. + */ +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * @} + */ + +#endif /* AVUTIL_MEM_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/old_pix_fmts.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/old_pix_fmts.h new file mode 100644 index 000000000..d3e1e5b24 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/old_pix_fmts.h @@ -0,0 +1,134 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OLD_PIX_FMTS_H +#define AVUTIL_OLD_PIX_FMTS_H + +/* + * This header exists to prevent new pixel formats from being accidentally added + * to the deprecated list. + * Do not include it directly. It will be removed on next major bump + * + * Do not add new items to this list. Use the AVPixelFormat enum instead. + */ + PIX_FMT_NONE = AV_PIX_FMT_NONE, + PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + PIX_FMT_GRAY8, ///< Y , 8bpp + PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range +#if FF_API_XVMC + PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + PIX_FMT_XVMC_MPEG2_IDCT, +#endif /* FF_API_XVMC */ + PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range + PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) +#if FF_API_VDPAU + PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian + PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian + + PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers + PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers + PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + + PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian +#if FF_API_VDPAU + PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 + PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 + PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha + PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian + PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian + PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian + PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian + PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian + PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian + PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + +#endif /* AVUTIL_OLD_PIX_FMTS_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/opt.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/opt.h new file mode 100644 index 000000000..ac722ee08 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/opt.h @@ -0,0 +1,538 @@ +/* + * AVOptions + * copyright (c) 2005 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OPT_H +#define AVUTIL_OPT_H + +/** + * @file + * AVOptions + */ + +#include "rational.h" +#include "avutil.h" +#include "dict.h" +#include "log.h" + +/** + * @defgroup avoptions AVOptions + * @ingroup lavu_data + * @{ + * AVOptions provide a generic system to declare options on arbitrary structs + * ("objects"). An option can have a help text, a type and a range of possible + * values. Options may then be enumerated, read and written to. + * + * @section avoptions_implement Implementing AVOptions + * This section describes how to add AVOptions capabilities to a struct. + * + * All AVOptions-related information is stored in an AVClass. Therefore + * the first member of the struct must be a pointer to an AVClass describing it. + * The option field of the AVClass must be set to a NULL-terminated static array + * of AVOptions. Each AVOption must have a non-empty name, a type, a default + * value and for number-type AVOptions also a range of allowed values. It must + * also declare an offset in bytes from the start of the struct, where the field + * associated with this AVOption is located. Other fields in the AVOption struct + * should also be set when applicable, but are not required. + * + * The following example illustrates an AVOptions-enabled struct: + * @code + * typedef struct test_struct { + * AVClass *class; + * int int_opt; + * char *str_opt; + * uint8_t *bin_opt; + * int bin_len; + * } test_struct; + * + * static const AVOption test_options[] = { + * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt), + * AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX }, + * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt), + * AV_OPT_TYPE_STRING }, + * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt), + * AV_OPT_TYPE_BINARY }, + * { NULL }, + * }; + * + * static const AVClass test_class = { + * .class_name = "test class", + * .item_name = av_default_item_name, + * .option = test_options, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * @endcode + * + * Next, when allocating your struct, you must ensure that the AVClass pointer + * is set to the correct value. Then, av_opt_set_defaults() must be called to + * initialize defaults. After that the struct is ready to be used with the + * AVOptions API. + * + * When cleaning up, you may use the av_opt_free() function to automatically + * free all the allocated string and binary options. + * + * Continuing with the above example: + * + * @code + * test_struct *alloc_test_struct(void) + * { + * test_struct *ret = av_malloc(sizeof(*ret)); + * ret->class = &test_class; + * av_opt_set_defaults(ret); + * return ret; + * } + * void free_test_struct(test_struct **foo) + * { + * av_opt_free(*foo); + * av_freep(foo); + * } + * @endcode + * + * @subsection avoptions_implement_nesting Nesting + * It may happen that an AVOptions-enabled struct contains another + * AVOptions-enabled struct as a member (e.g. AVCodecContext in + * libavcodec exports generic options, while its priv_data field exports + * codec-specific options). In such a case, it is possible to set up the + * parent struct to export a child's options. To do that, simply + * implement AVClass.child_next() and AVClass.child_class_next() in the + * parent struct's AVClass. + * Assuming that the test_struct from above now also contains a + * child_struct field: + * + * @code + * typedef struct child_struct { + * AVClass *class; + * int flags_opt; + * } child_struct; + * static const AVOption child_opts[] = { + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX }, + * { NULL }, + * }; + * static const AVClass child_class = { + * .class_name = "child class", + * .item_name = av_default_item_name, + * .option = child_opts, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * + * void *child_next(void *obj, void *prev) + * { + * test_struct *t = obj; + * if (!prev && t->child_struct) + * return t->child_struct; + * return NULL + * } + * const AVClass child_class_next(const AVClass *prev) + * { + * return prev ? NULL : &child_class; + * } + * @endcode + * Putting child_next() and child_class_next() as defined above into + * test_class will now make child_struct's options accessible through + * test_struct (again, proper setup as described above needs to be done on + * child_struct right after it is created). + * + * From the above example it might not be clear why both child_next() + * and child_class_next() are needed. The distinction is that child_next() + * iterates over actually existing objects, while child_class_next() + * iterates over all possible child classes. E.g. if an AVCodecContext + * was initialized to use a codec which has private options, then its + * child_next() will return AVCodecContext.priv_data and finish + * iterating. OTOH child_class_next() on AVCodecContext.av_class will + * iterate over all available codecs with private options. + * + * @subsection avoptions_implement_named_constants Named constants + * It is possible to create named constants for options. Simply set the unit + * field of the option the constants should apply to to a string and + * create the constants themselves as options of type AV_OPT_TYPE_CONST + * with their unit field set to the same string. + * Their default_val field should contain the value of the named + * constant. + * For example, to add some named constants for the test_flags option + * above, put the following into the child_opts array: + * @code + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, "test_unit" }, + * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { .i64 = 16 }, 0, 0, "test_unit" }, + * @endcode + * + * @section avoptions_use Using AVOptions + * This section deals with accessing options in an AVOptions-enabled struct. + * Such structs in Libav are e.g. AVCodecContext in libavcodec or + * AVFormatContext in libavformat. + * + * @subsection avoptions_use_examine Examining AVOptions + * The basic functions for examining options are av_opt_next(), which iterates + * over all options defined for one object, and av_opt_find(), which searches + * for an option with the given name. + * + * The situation is more complicated with nesting. An AVOptions-enabled struct + * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag + * to av_opt_find() will make the function search children recursively. + * + * For enumerating there are basically two cases. The first is when you want to + * get all options that may potentially exist on the struct and its children + * (e.g. when constructing documentation). In that case you should call + * av_opt_child_class_next() recursively on the parent struct's AVClass. The + * second case is when you have an already initialized struct with all its + * children and you want to get all options that can be actually written or read + * from it. In that case you should call av_opt_child_next() recursively (and + * av_opt_next() on each result). + * + * @subsection avoptions_use_get_set Reading and writing AVOptions + * When setting options, you often have a string read directly from the + * user. In such a case, simply passing it to av_opt_set() is enough. For + * non-string type options, av_opt_set() will parse the string according to the + * option type. + * + * Similarly av_opt_get() will read any option type and convert it to a string + * which will be returned. Do not forget that the string is allocated, so you + * have to free it with av_free(). + * + * In some cases it may be more convenient to put all options into an + * AVDictionary and call av_opt_set_dict() on it. A specific case of this + * are the format/codec open functions in lavf/lavc which take a dictionary + * filled with option as a parameter. This allows to set some options + * that cannot be set otherwise, since e.g. the input file format is not known + * before the file is actually opened. + */ + +enum AVOptionType{ + AV_OPT_TYPE_FLAGS, + AV_OPT_TYPE_INT, + AV_OPT_TYPE_INT64, + AV_OPT_TYPE_DOUBLE, + AV_OPT_TYPE_FLOAT, + AV_OPT_TYPE_STRING, + AV_OPT_TYPE_RATIONAL, + AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_DICT, + AV_OPT_TYPE_CONST = 128, +}; + +/** + * AVOption + */ +typedef struct AVOption { + const char *name; + + /** + * short English help text + * @todo What about other languages? + */ + const char *help; + + /** + * The offset relative to the context structure where the option + * value is stored. It should be 0 for named constants. + */ + int offset; + enum AVOptionType type; + + /** + * the default value for scalar options + */ + union { + int64_t i64; + double dbl; + const char *str; + /* TODO those are unused now */ + AVRational q; + } default_val; + double min; ///< minimum valid value for the option + double max; ///< maximum valid value for the option + + int flags; +#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding +#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding +#if FF_API_OPT_TYPE_METADATA +#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... +#endif +#define AV_OPT_FLAG_AUDIO_PARAM 8 +#define AV_OPT_FLAG_VIDEO_PARAM 16 +#define AV_OPT_FLAG_SUBTITLE_PARAM 32 +/** + * The option is inteded for exporting values to the caller. + */ +#define AV_OPT_FLAG_EXPORT 64 +/** + * The option may not be set through the AVOptions API, only read. + * This flag only makes sense when AV_OPT_FLAG_EXPORT is also set. + */ +#define AV_OPT_FLAG_READONLY 128 +//FIXME think about enc-audio, ... style flags + + /** + * The logical unit to which the option belongs. Non-constant + * options and corresponding named constants share the same + * unit. May be NULL. + */ + const char *unit; +} AVOption; + +/** + * Show the obj options. + * + * @param req_flags requested flags for the options to show. Show only the + * options for which it is opt->flags & req_flags. + * @param rej_flags rejected flags for the options to show. Show only the + * options for which it is !(opt->flags & req_flags). + * @param av_log_obj log context to use for showing the options + */ +int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); + +/** + * Set the values of all AVOption fields to their default values. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + */ +void av_opt_set_defaults(void *s); + +/** + * Parse the key/value pairs list in opts. For each key/value pair + * found, stores the value in the field in ctx that is named like the + * key. ctx must be an AVClass context, storing is done using + * AVOptions. + * + * @param key_val_sep a 0-terminated list of characters used to + * separate key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @return the number of successfully set key/value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_set_string3() if a key/value pair + * cannot be set + */ +int av_set_options_string(void *ctx, const char *opts, + const char *key_val_sep, const char *pairs_sep); + +/** + * Free all allocated objects in obj. + */ +void av_opt_free(void *obj); + +/** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + */ +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); + +/* + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + */ +int av_opt_set_dict(void *obj, struct AVDictionary **options); + +/** + * @defgroup opt_eval_funcs Evaluating option strings + * @{ + * This group of functions can be used to evaluate option strings + * and get numbers out of them. They do the same thing as av_opt_set(), + * except the result is written into the caller-supplied pointer. + * + * @param obj a struct whose first element is a pointer to AVClass. + * @param o an option for which the string is to be evaluated. + * @param val string to be evaluated. + * @param *_out value of the string will be written here. + * + * @return 0 on success, a negative number on failure. + */ +int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out); +int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out); +int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out); +int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out); +int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out); +int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out); +/** + * @} + */ + +#define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the + given object first. */ +/** + * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass + * instead of a required pointer to a struct containing AVClass. This is + * useful for searching for options without needing to allocate the corresponding + * object. + */ +#define AV_OPT_SEARCH_FAKE_OBJ 0x0002 + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return A pointer to the option found, or NULL if no option + * was found. + * + * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable + * directly with av_set_string3(). Use special calls which take an options + * AVDictionary (e.g. avformat_open_input()) to set options found with this + * flag. + */ +const AVOption *av_opt_find(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags); + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * @param[out] target_obj if non-NULL, an object to which the option belongs will be + * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present + * in search_flags. This parameter is ignored if search_flags contain + * AV_OPT_SEARCH_FAKE_OBJ. + * + * @return A pointer to the option found, or NULL if no option + * was found. + */ +const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags, void **target_obj); + +/** + * Iterate over all AVOptions belonging to obj. + * + * @param obj an AVOptions-enabled struct or a double pointer to an + * AVClass describing it. + * @param prev result of the previous call to av_opt_next() on this object + * or NULL + * @return next AVOption or NULL + */ +const AVOption *av_opt_next(void *obj, const AVOption *prev); + +/** + * Iterate over AVOptions-enabled children of obj. + * + * @param prev result of a previous call to this function or NULL + * @return next AVOptions-enabled child or NULL + */ +void *av_opt_child_next(void *obj, void *prev); + +/** + * Iterate over potential AVOptions-enabled children of parent. + * + * @param prev result of a previous call to this function or NULL + * @return AVClass corresponding to next potential child or NULL + */ +const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); + +/** + * @defgroup opt_set_funcs Option setting functions + * @{ + * Those functions set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. In case of av_opt_set() if the field is not + * of a string type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be set on a child of obj. + * + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + */ +int av_opt_set (void *obj, const char *name, const char *val, int search_flags); +int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); +int av_opt_set_double (void *obj, const char *name, double val, int search_flags); +int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); +int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags); +/** + * @note Any old dictionary present is discarded and replaced with a copy of the new one. The + * caller still owns val is and responsible for freeing it. + */ +int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags); +/** + * @} + */ + +/** + * @defgroup opt_get_funcs Option getting functions + * @{ + * Those functions get a value of the option with the given name from an object. + * + * @param[in] obj a struct whose first element is a pointer to an AVClass. + * @param[in] name name of the option to get. + * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be found in a child of obj. + * @param[out] out_val value of the option will be written here + * @return 0 on success, a negative error code otherwise + */ +/** + * @note the returned string will av_malloc()ed and must be av_free()ed by the caller + */ +int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); +int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); +int av_opt_get_double (void *obj, const char *name, int search_flags, double *out_val); +int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); +/** + * @param[out] out_val The returned dictionary is a copy of the actual value and must + * be freed with av_dict_free() by the caller + */ +int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val); +/** + * @} + * @} + */ + +#endif /* AVUTIL_OPT_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/parseutils.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/parseutils.h new file mode 100644 index 000000000..0844abb2f --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/parseutils.h @@ -0,0 +1,124 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PARSEUTILS_H +#define AVUTIL_PARSEUTILS_H + +#include <time.h> + +#include "rational.h" + +/** + * @file + * misc parsing utilities + */ + +/** + * Parse str and put in width_ptr and height_ptr the detected values. + * + * @param[in,out] width_ptr pointer to the variable which will contain the detected + * width value + * @param[in,out] height_ptr pointer to the variable which will contain the detected + * height value + * @param[in] str the string to parse: it has to be a string in the format + * width x height or a valid video size abbreviation. + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); + +/** + * Parse str and store the detected values in *rate. + * + * @param[in,out] rate pointer to the AVRational which will contain the detected + * frame rate + * @param[in] str the string to parse: it has to be a string in the format + * rate_num / rate_den, a float number or a valid video rate abbreviation + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_rate(AVRational *rate, const char *str); + +/** + * Put the RGBA values that correspond to color_string in rgba_color. + * + * @param color_string a string specifying a color. It can be the name of + * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, + * possibly followed by "@" and a string representing the alpha + * component. + * The alpha component may be a string composed by "0x" followed by an + * hexadecimal number or a decimal number between 0.0 and 1.0, which + * represents the opacity value (0x00/0.0 means completely transparent, + * 0xff/1.0 completely opaque). + * If the alpha component is not specified then 0xff is assumed. + * The string "random" will result in a random color. + * @param slen length of the initial part of color_string containing the + * color. It can be set to -1 if color_string is a null terminated string + * containing nothing else than the color. + * @return >= 0 in case of success, a negative value in case of + * failure (for example if color_string cannot be parsed). + */ +int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, + void *log_ctx); + +/** + * Parse timestr and return in *time a corresponding number of + * microseconds. + * + * @param timeval puts here the number of microseconds corresponding + * to the string in timestr. If the string represents a duration, it + * is the number of microseconds contained in the time interval. If + * the string is a date, is the number of microseconds since 1st of + * January, 1970 up to the time of the parsed date. If timestr cannot + * be successfully parsed, set *time to INT64_MIN. + + * @param timestr a string representing a date or a duration. + * - If a date the syntax is: + * @code + * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z] + * now + * @endcode + * If the value is "now" it takes the current time. + * Time is local time unless Z is appended, in which case it is + * interpreted as UTC. + * If the year-month-day part is not specified it takes the current + * year-month-day. + * - If a duration the syntax is: + * @code + * [-]HH[:MM[:SS[.m...]]] + * [-]S+[.m...] + * @endcode + * @param duration flag which tells how to interpret timestr, if not + * zero timestr is interpreted as a duration, otherwise as a date + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_parse_time(int64_t *timeval, const char *timestr, int duration); + +/** + * Attempt to find a specific tag in a URL. + * + * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. + * Return 1 if found. + */ +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); + +/** + * Convert the decomposed UTC time in tm to a time_t value. + */ +time_t av_timegm(struct tm *tm); + +#endif /* AVUTIL_PARSEUTILS_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/pixdesc.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/pixdesc.h new file mode 100644 index 000000000..1c9e0af11 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/pixdesc.h @@ -0,0 +1,294 @@ +/* + * pixel format descriptor + * Copyright (c) 2009 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXDESC_H +#define AVUTIL_PIXDESC_H + +#include <inttypes.h> + +#include "attributes.h" +#include "pixfmt.h" + +typedef struct AVComponentDescriptor { + /** + * Which of the 4 planes contains the component. + */ + uint16_t plane : 2; + + /** + * Number of elements between 2 horizontally consecutive pixels minus 1. + * Elements are bits for bitstream formats, bytes otherwise. + */ + uint16_t step_minus1 : 3; + + /** + * Number of elements before the component of the first pixel plus 1. + * Elements are bits for bitstream formats, bytes otherwise. + */ + uint16_t offset_plus1 : 3; + + /** + * Number of least significant bits that must be shifted away + * to get the value. + */ + uint16_t shift : 3; + + /** + * Number of bits in the component minus 1. + */ + uint16_t depth_minus1 : 4; +} AVComponentDescriptor; + +/** + * Descriptor that unambiguously describes how the bits of a pixel are + * stored in the up to 4 data planes of an image. It also stores the + * subsampling factors and number of components. + * + * @note This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV + * and all the YUV variants) AVPixFmtDescriptor just stores how values + * are stored not what these values represent. + */ +typedef struct AVPixFmtDescriptor { + const char *name; + uint8_t nb_components; ///< The number of components each pixel has, (1-4) + + /** + * Amount to shift the luma width right to find the chroma width. + * For YV12 this is 1 for example. + * chroma_width = -((-luma_width) >> log2_chroma_w) + * The note above is needed to ensure rounding up. + * This value only refers to the chroma components. + */ + uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w) + + /** + * Amount to shift the luma height right to find the chroma height. + * For YV12 this is 1 for example. + * chroma_height= -((-luma_height) >> log2_chroma_h) + * The note above is needed to ensure rounding up. + * This value only refers to the chroma components. + */ + uint8_t log2_chroma_h; + uint8_t flags; + + /** + * Parameters that describe how pixels are packed. If the format + * has chroma components, they must be stored in comp[1] and + * comp[2]. + */ + AVComponentDescriptor comp[4]; + + /** + * Alternative comma-separated names. + */ + const char *alias; +} AVPixFmtDescriptor; + +/** + * Pixel format is big-endian. + */ +#define AV_PIX_FMT_FLAG_BE (1 << 0) +/** + * Pixel format has a palette in data[1], values are indexes in this palette. + */ +#define AV_PIX_FMT_FLAG_PAL (1 << 1) +/** + * All values of a component are bit-wise packed end to end. + */ +#define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2) +/** + * Pixel format is an HW accelerated format. + */ +#define AV_PIX_FMT_FLAG_HWACCEL (1 << 3) +/** + * At least one pixel component is not in the first data plane. + */ +#define AV_PIX_FMT_FLAG_PLANAR (1 << 4) +/** + * The pixel format contains RGB-like data (as opposed to YUV/grayscale). + */ +#define AV_PIX_FMT_FLAG_RGB (1 << 5) +/** + * The pixel format is "pseudo-paletted". This means that Libav treats it as + * paletted internally, but the palette is generated by the decoder and is not + * stored in the file. + */ +#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) +/** + * The pixel format has an alpha channel. + */ +#define AV_PIX_FMT_FLAG_ALPHA (1 << 7) + +#if FF_API_PIX_FMT +/** + * @deprecated use the AV_PIX_FMT_FLAG_* flags + */ +#define PIX_FMT_BE AV_PIX_FMT_FLAG_BE +#define PIX_FMT_PAL AV_PIX_FMT_FLAG_PAL +#define PIX_FMT_BITSTREAM AV_PIX_FMT_FLAG_BITSTREAM +#define PIX_FMT_HWACCEL AV_PIX_FMT_FLAG_HWACCEL +#define PIX_FMT_PLANAR AV_PIX_FMT_FLAG_PLANAR +#define PIX_FMT_RGB AV_PIX_FMT_FLAG_RGB +#define PIX_FMT_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL +#define PIX_FMT_ALPHA AV_PIX_FMT_FLAG_ALPHA +#endif + +#if FF_API_PIX_FMT_DESC +/** + * The array of all the pixel format descriptors. + */ +extern attribute_deprecated const AVPixFmtDescriptor av_pix_fmt_descriptors[]; +#endif + +/** + * Read a line from an image, and write the values of the + * pixel format component c to dst. + * + * @param data the array containing the pointers to the planes of the image + * @param linesize the array containing the linesizes of the image + * @param desc the pixel format descriptor for the image + * @param x the horizontal coordinate of the first pixel to read + * @param y the vertical coordinate of the first pixel to read + * @param w the width of the line to read, that is the number of + * values to write to dst + * @param read_pal_component if not zero and the format is a paletted + * format writes the values corresponding to the palette + * component c in data[1] to dst, rather than the palette indexes in + * data[0]. The behavior is undefined if the format is not paletted. + */ +void av_read_image_line(uint16_t *dst, const uint8_t *data[4], + const int linesize[4], const AVPixFmtDescriptor *desc, + int x, int y, int c, int w, int read_pal_component); + +/** + * Write the values from src to the pixel format component c of an + * image line. + * + * @param src array containing the values to write + * @param data the array containing the pointers to the planes of the + * image to write into. It is supposed to be zeroed. + * @param linesize the array containing the linesizes of the image + * @param desc the pixel format descriptor for the image + * @param x the horizontal coordinate of the first pixel to write + * @param y the vertical coordinate of the first pixel to write + * @param w the width of the line to write, that is the number of + * values to write to the image line + */ +void av_write_image_line(const uint16_t *src, uint8_t *data[4], + const int linesize[4], const AVPixFmtDescriptor *desc, + int x, int y, int c, int w); + +/** + * Return the pixel format corresponding to name. + * + * If there is no pixel format with name name, then looks for a + * pixel format with the name corresponding to the native endian + * format of name. + * For example in a little-endian system, first looks for "gray16", + * then for "gray16le". + * + * Finally if no pixel format has been found, returns PIX_FMT_NONE. + */ +enum AVPixelFormat av_get_pix_fmt(const char *name); + +/** + * Return the short name for a pixel format, NULL in case pix_fmt is + * unknown. + * + * @see av_get_pix_fmt(), av_get_pix_fmt_string() + */ +const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt); + +/** + * Print in buf the string corresponding to the pixel format with + * number pix_fmt, or an header if pix_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param pix_fmt the number of the pixel format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + */ +char *av_get_pix_fmt_string(char *buf, int buf_size, + enum AVPixelFormat pix_fmt); + +/** + * Return the number of bits per pixel used by the pixel format + * described by pixdesc. Note that this is not the same as the number + * of bits per sample. + * + * The returned number of bits refers to the number of bits actually + * used for storing the pixel information, that is padding bits are + * not counted. + */ +int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); + +/** + * @return a pixel format descriptor for provided pixel format or NULL if + * this pixel format is unknown. + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt); + +/** + * Iterate over all pixel format descriptors known to libavutil. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev); + +/** + * @return an AVPixelFormat id described by desc, or AV_PIX_FMT_NONE if desc + * is not a valid pointer to a pixel format descriptor. + */ +enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc); + +/** + * Utility function to access log2_chroma_w log2_chroma_h from + * the pixel format AVPixFmtDescriptor. + * + * @param[in] pix_fmt the pixel format + * @param[out] h_shift store log2_chroma_h + * @param[out] v_shift store log2_chroma_w + * + * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format + */ +int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, + int *h_shift, int *v_shift); + +/** + * @return number of planes in pix_fmt, a negative AVERROR if pix_fmt is not a + * valid pixel format. + */ +int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt); + +/** + * Utility function to swap the endianness of a pixel format. + * + * @param[in] pix_fmt the pixel format + * + * @return pixel format with swapped endianness if it exists, + * otherwise AV_PIX_FMT_NONE + */ +enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt); + +#endif /* AVUTIL_PIXDESC_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/pixfmt.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/pixfmt.h new file mode 100644 index 000000000..47951e060 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/pixfmt.h @@ -0,0 +1,387 @@ +/* + * copyright (c) 2006 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXFMT_H +#define AVUTIL_PIXFMT_H + +/** + * @file + * pixel format definitions + * + */ + +#include "libavutil/avconfig.h" +#include "version.h" + +/** + * Pixel format. + * + * @note + * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little-endian CPU architectures and ARGB on + * big-endian CPUs. + * + * @par + * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + * + * @par + * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like + * for pal8. This palette is filled in automatically by the function + * allocating the picture. + * + * @note + * Make sure that all newly added big-endian formats have pix_fmt & 1 == 1 + * and that all newly added little-endian formats have pix_fmt & 1 == 0. + * This allows simpler detection of big vs little-endian. + */ +enum AVPixelFormat { + AV_PIX_FMT_NONE = -1, + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + AV_PIX_FMT_GRAY8, ///< Y , 8bpp + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range +#if FF_API_XVMC + AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + AV_PIX_FMT_XVMC_MPEG2_IDCT, +#endif /* FF_API_XVMC */ + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) +#if FF_API_VDPAU + AV_PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian + + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers + AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers + AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian +#if FF_API_VDPAU + AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + AV_PIX_FMT_YA8, ///< 8bit gray, 8bit alpha + + AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 + + AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface + AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + + AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb + + AV_PIX_FMT_VDA, ///< HW acceleration through VDA, data[3] contains a CVPixelBufferRef + + AV_PIX_FMT_YA16BE, ///< 16bit gray, 16bit alpha (big-endian) + AV_PIX_FMT_YA16LE, ///< 16bit gray, 16bit alpha (little-endian) + + AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + +#if FF_API_PIX_FMT +#include "old_pix_fmts.h" +#endif +}; + +#if AV_HAVE_BIGENDIAN +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be +#else +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le +#endif + +#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA) +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR) +#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA) +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB) + +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE) +#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE) +#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE) +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE) +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE) +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE) +#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE) +#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE) +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE) +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE) +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE) +#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE) + +#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE) +#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE) +#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE) +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE) +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE) +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE) +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE) +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) + +#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE) +#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE) +#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE) + +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE) +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE) +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE) +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) + +#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE) +#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE) + + +#if FF_API_PIX_FMT +#define PixelFormat AVPixelFormat + +#define PIX_FMT_NE(be, le) AV_PIX_FMT_NE(be, le) + +#define PIX_FMT_RGB32 AV_PIX_FMT_RGB32 +#define PIX_FMT_RGB32_1 AV_PIX_FMT_RGB32_1 +#define PIX_FMT_BGR32 AV_PIX_FMT_BGR32 +#define PIX_FMT_BGR32_1 AV_PIX_FMT_BGR32_1 + +#define PIX_FMT_GRAY16 AV_PIX_FMT_GRAY16 +#define PIX_FMT_RGB48 AV_PIX_FMT_RGB48 +#define PIX_FMT_RGB565 AV_PIX_FMT_RGB565 +#define PIX_FMT_RGB555 AV_PIX_FMT_RGB555 +#define PIX_FMT_RGB444 AV_PIX_FMT_RGB444 +#define PIX_FMT_BGR48 AV_PIX_FMT_BGR48 +#define PIX_FMT_BGR565 AV_PIX_FMT_BGR565 +#define PIX_FMT_BGR555 AV_PIX_FMT_BGR555 +#define PIX_FMT_BGR444 AV_PIX_FMT_BGR444 + +#define PIX_FMT_YUV420P9 AV_PIX_FMT_YUV420P9 +#define PIX_FMT_YUV422P9 AV_PIX_FMT_YUV422P9 +#define PIX_FMT_YUV444P9 AV_PIX_FMT_YUV444P9 +#define PIX_FMT_YUV420P10 AV_PIX_FMT_YUV420P10 +#define PIX_FMT_YUV422P10 AV_PIX_FMT_YUV422P10 +#define PIX_FMT_YUV444P10 AV_PIX_FMT_YUV444P10 +#define PIX_FMT_YUV420P16 AV_PIX_FMT_YUV420P16 +#define PIX_FMT_YUV422P16 AV_PIX_FMT_YUV422P16 +#define PIX_FMT_YUV444P16 AV_PIX_FMT_YUV444P16 + +#define PIX_FMT_GBRP9 AV_PIX_FMT_GBRP9 +#define PIX_FMT_GBRP10 AV_PIX_FMT_GBRP10 +#define PIX_FMT_GBRP16 AV_PIX_FMT_GBRP16 +#endif + +/** + * Chromaticity coordinates of the source primaries. + */ +enum AVColorPrimaries { + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_UNSPECIFIED = 2, + AVCOL_PRI_RESERVED = 3, + AVCOL_PRI_BT470M = 4, + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_FILM = 8, + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 + AVCOL_PRI_NB, ///< Not part of ABI +}; + +/** + * Color Transfer Characteristic. + */ +enum AVColorTransferCharacteristic { + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 + AVCOL_TRC_UNSPECIFIED = 2, + AVCOL_TRC_RESERVED = 3, + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG + AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC + AVCOL_TRC_SMPTE240M = 7, + AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics" + AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)" + AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)" + AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4 + AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut + AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC) + AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system + AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system + AVCOL_TRC_NB, ///< Not part of ABI +}; + +/** + * YUV colorspace type. + */ +enum AVColorSpace { + AVCOL_SPC_RGB = 0, + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_UNSPECIFIED = 2, + AVCOL_SPC_RESERVED = 3, + AVCOL_SPC_FCC = 4, + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, + AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system + AVCOL_SPC_NB, ///< Not part of ABI +}; + +/** + * MPEG vs JPEG YUV range. + */ +enum AVColorRange { + AVCOL_RANGE_UNSPECIFIED = 0, + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges + AVCOL_RANGE_NB, ///< Not part of ABI +}; + +/** + * Location of chroma samples. + * + * X X 3 4 X X are luma samples, + * 1 2 1-6 are possible chroma positions + * X X 5 6 X 0 is undefined/unknown position + */ +enum AVChromaLocation { + AVCHROMA_LOC_UNSPECIFIED = 0, + AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default + AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263 + AVCHROMA_LOC_TOPLEFT = 3, ///< DV + AVCHROMA_LOC_TOP = 4, + AVCHROMA_LOC_BOTTOMLEFT = 5, + AVCHROMA_LOC_BOTTOM = 6, + AVCHROMA_LOC_NB, ///< Not part of ABI +}; + +#endif /* AVUTIL_PIXFMT_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/random_seed.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/random_seed.h new file mode 100644 index 000000000..b1fad13d0 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/random_seed.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2009 Baptiste Coudurier <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_RANDOM_SEED_H +#define AVUTIL_RANDOM_SEED_H + +#include <stdint.h> +/** + * @addtogroup lavu_crypto + * @{ + */ + +/** + * Get random data. + * + * This function can be called repeatedly to generate more random bits + * as needed. It is generally quite slow, and usually used to seed a + * PRNG. As it uses /dev/urandom and /dev/random, the quality of the + * returned random data depends on the platform. + */ +uint32_t av_get_random_seed(void); + +/** + * @} + */ + +#endif /* AVUTIL_RANDOM_SEED_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/rational.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/rational.h new file mode 100644 index 000000000..5d7dab7fd --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/rational.h @@ -0,0 +1,155 @@ +/* + * rational numbers + * Copyright (c) 2003 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * rational numbers + * @author Michael Niedermayer <[email protected]> + */ + +#ifndef AVUTIL_RATIONAL_H +#define AVUTIL_RATIONAL_H + +#include <stdint.h> +#include <limits.h> +#include "attributes.h" + +/** + * @addtogroup lavu_math + * @{ + */ + +/** + * rational number numerator/denominator + */ +typedef struct AVRational{ + int num; ///< numerator + int den; ///< denominator +} AVRational; + +/** + * Compare two rationals. + * @param a first rational + * @param b second rational + * @return 0 if a==b, 1 if a>b, -1 if a<b, and INT_MIN if one of the + * values is of the form 0/0 + */ +static inline int av_cmp_q(AVRational a, AVRational b){ + const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den; + + if(tmp) return ((tmp ^ a.den ^ b.den)>>63)|1; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; +} + +/** + * Convert rational to double. + * @param a rational to convert + * @return (double) a + */ +static inline double av_q2d(AVRational a){ + return a.num / (double) a.den; +} + +/** + * Reduce a fraction. + * This is useful for framerate calculations. + * @param dst_num destination numerator + * @param dst_den destination denominator + * @param num source numerator + * @param den source denominator + * @param max the maximum allowed for dst_num & dst_den + * @return 1 if exact, 0 otherwise + */ +int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); + +/** + * Multiply two rationals. + * @param b first rational + * @param c second rational + * @return b*c + */ +AVRational av_mul_q(AVRational b, AVRational c) av_const; + +/** + * Divide one rational by another. + * @param b first rational + * @param c second rational + * @return b/c + */ +AVRational av_div_q(AVRational b, AVRational c) av_const; + +/** + * Add two rationals. + * @param b first rational + * @param c second rational + * @return b+c + */ +AVRational av_add_q(AVRational b, AVRational c) av_const; + +/** + * Subtract one rational from another. + * @param b first rational + * @param c second rational + * @return b-c + */ +AVRational av_sub_q(AVRational b, AVRational c) av_const; + +/** + * Invert a rational. + * @param q value + * @return 1 / q + */ +static av_always_inline AVRational av_inv_q(AVRational q) +{ + AVRational r = { q.den, q.num }; + return r; +} + +/** + * Convert a double precision floating point number to a rational. + * inf is expressed as {1,0} or {-1,0} depending on the sign. + * + * @param d double to convert + * @param max the maximum allowed numerator and denominator + * @return (AVRational) d + */ +AVRational av_d2q(double d, int max) av_const; + +/** + * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer + * than q1, 0 if they have the same distance. + */ +int av_nearer_q(AVRational q, AVRational q1, AVRational q2); + +/** + * Find the nearest value in q_list to q. + * @param q_list an array of rationals terminated by {0, 0} + * @return the index of the nearest value found in the array + */ +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); + +/** + * @} + */ + +#endif /* AVUTIL_RATIONAL_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/replaygain.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/replaygain.h new file mode 100644 index 000000000..7871d2c76 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/replaygain.h @@ -0,0 +1,51 @@ +/* + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_REPLAYGAIN_H +#define AVUTIL_REPLAYGAIN_H + +#include <stdint.h> + +/** + * ReplayGain information (see + * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). + * The size of this struct is a part of the public ABI. + */ +typedef struct AVReplayGain { + /** + * Track replay gain in microbels (divide by 100000 to get the value in dB). + * Should be set to INT32_MIN when unknown. + */ + int32_t track_gain; + /** + * Peak track amplitude, with 100000 representing full scale (but values + * may overflow). 0 when unknown. + */ + uint32_t track_peak; + /** + * Same as track_gain, but for the whole album. + */ + int32_t album_gain; + /** + * Same as track_peak, but for the whole album, + */ + uint32_t album_peak; +} AVReplayGain; + +#endif /* AVUTIL_REPLAYGAIN_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/samplefmt.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/samplefmt.h new file mode 100644 index 000000000..8347fac29 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/samplefmt.h @@ -0,0 +1,245 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SAMPLEFMT_H +#define AVUTIL_SAMPLEFMT_H + +#include <stdint.h> + +#include "avutil.h" +#include "attributes.h" + +/** + * @addtogroup lavu_audio + * @{ + * + * @defgroup lavu_sampfmts Audio sample formats + * + * Audio sample format enumeration and related convenience functions. + * @{ + * + */ + +/** + * Audio Sample Formats + * + * @par + * The data described by the sample format is always in native-endian order. + * Sample values can be expressed by native C types, hence the lack of a signed + * 24-bit sample format even though it is a common raw audio data format. + * + * @par + * The floating-point formats are based on full volume being in the range + * [-1.0, 1.0]. Any values outside this range are beyond full volume level. + * + * @par + * The data layout as used in av_samples_fill_arrays() and elsewhere in Libav + * (such as AVFrame in libavcodec) is as follows: + * + * @par + * For planar sample formats, each audio channel is in a separate data plane, + * and linesize is the buffer size, in bytes, for a single plane. All data + * planes must be the same size. For packed sample formats, only the first data + * plane is used, and samples for each channel are interleaved. In this case, + * linesize is the buffer size, in bytes, for the 1 plane. + */ +enum AVSampleFormat { + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar + AV_SAMPLE_FMT_FLTP, ///< float, planar + AV_SAMPLE_FMT_DBLP, ///< double, planar + + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically +}; + +/** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + */ +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); + +/** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + */ +enum AVSampleFormat av_get_sample_fmt(const char *name); + +/** + * Get the packed alternative form of the given sample format. + * + * If the passed sample_fmt is already in packed format, the format returned is + * the same as the input. + * + * @return the packed alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Get the planar alternative form of the given sample format. + * + * If the passed sample_fmt is already in planar format, the format returned is + * the same as the input. + * + * @return the planar alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL if sample_fmt is + * unknown or in case of other errors + */ +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); + +/** + * Return number of bytes per sample. + * + * @param sample_fmt the sample format + * @return number of bytes per sample or zero if unknown for the given + * sample format + */ +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); + +/** + * Check if the sample format is planar. + * + * @param sample_fmt the sample format to inspect + * @return 1 if the sample format is planar, 0 if it is interleaved + */ +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); + +/** + * Get the required buffer size for the given audio parameters. + * + * @param[out] linesize calculated linesize, may be NULL + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return required buffer size, or negative error code on failure + */ +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * @} + * + * @defgroup lavu_sampmanip Samples manipulation + * + * Functions that manipulate audio samples + * @{ + */ + +/** + * Fill channel data pointers and linesize for samples with sample + * format sample_fmt. + * + * The pointers array is filled with the pointers to the samples data: + * for planar, set the start point of each channel's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The linesize array is filled with the aligned size of each channel's data + * buffer for planar layout, or the aligned size of the buffer for all channels + * for packed layout. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize calculated linesize, may be NULL + * @param buf the pointer to a buffer containing the samples + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return 0 on success or a negative error code on failure + */ +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, + const uint8_t *buf, + int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * Allocate a samples buffer for nb_samples samples, and fill data pointers and + * linesize accordingly. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) + * Allocated data will be initialized to silence. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize aligned size for audio buffer(s), may be NULL + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return 0 on success or a negative error code on failure + * @see av_samples_fill_arrays() + */ +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, + int nb_samples, enum AVSampleFormat sample_fmt, int align); + +/** + * Copy samples from src to dst. + * + * @param dst destination array of pointers to data planes + * @param src source array of pointers to data planes + * @param dst_offset offset in samples at which the data will be written to dst + * @param src_offset offset in samples at which the data will be read from src + * @param nb_samples number of samples to be copied + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, + int src_offset, int nb_samples, int nb_channels, + enum AVSampleFormat sample_fmt); + +/** + * Fill an audio buffer with silence. + * + * @param audio_data array of pointers to data planes + * @param offset offset in samples at which to start filling + * @param nb_samples number of samples to fill + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, + int nb_channels, enum AVSampleFormat sample_fmt); + +/** + * @} + * @} + */ +#endif /* AVUTIL_SAMPLEFMT_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/sha.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/sha.h new file mode 100644 index 000000000..4c9a0c909 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/sha.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007 Michael Niedermayer <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SHA_H +#define AVUTIL_SHA_H + +#include <stdint.h> + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_sha SHA + * @ingroup lavu_crypto + * @{ + */ + +#if FF_API_CONTEXT_SIZE +extern attribute_deprecated const int av_sha_size; +#endif + +struct AVSHA; + +/** + * Allocate an AVSHA context. + */ +struct AVSHA *av_sha_alloc(void); + +/** + * Initialize SHA-1 or SHA-2 hashing. + * + * @param context pointer to the function context (of size av_sha_size) + * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_sha_init(struct AVSHA* context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_sha_final(struct AVSHA* context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_SHA_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/stereo3d.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/stereo3d.h new file mode 100644 index 000000000..b1910b1f8 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/stereo3d.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2013 Vittorio Giovara <[email protected]> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_STEREO3D_H +#define AVUTIL_STEREO3D_H + +#include <stdint.h> + +#include "frame.h" + +/** + * List of possible 3D Types + */ +enum AVStereo3DType { + /** + * Video is not stereoscopic (and metadata has to be there). + */ + AV_STEREO3D_2D, + + /** + * Views are next to each other. + * + * LLLLRRRR + * LLLLRRRR + * LLLLRRRR + * ... + */ + AV_STEREO3D_SIDEBYSIDE, + + /** + * Views are on top of each other. + * + * LLLLLLLL + * LLLLLLLL + * RRRRRRRR + * RRRRRRRR + */ + AV_STEREO3D_TOPBOTTOM, + + /** + * Views are alternated temporally. + * + * frame0 frame1 frame2 ... + * LLLLLLLL RRRRRRRR LLLLLLLL + * LLLLLLLL RRRRRRRR LLLLLLLL + * LLLLLLLL RRRRRRRR LLLLLLLL + * ... ... ... + */ + AV_STEREO3D_FRAMESEQUENCE, + + /** + * Views are packed in a checkerboard-like structure per pixel. + * + * LRLRLRLR + * RLRLRLRL + * LRLRLRLR + * ... + */ + AV_STEREO3D_CHECKERBOARD, + + /** + * Views are next to each other, but when upscaling + * apply a checkerboard pattern. + * + * LLLLRRRR L L L L R R R R + * LLLLRRRR => L L L L R R R R + * LLLLRRRR L L L L R R R R + * LLLLRRRR L L L L R R R R + */ + AV_STEREO3D_SIDEBYSIDE_QUINCUNX, + + /** + * Views are packed per line, as if interlaced. + * + * LLLLLLLL + * RRRRRRRR + * LLLLLLLL + * ... + */ + AV_STEREO3D_LINES, + + /** + * Views are packed per column. + * + * LRLRLRLR + * LRLRLRLR + * LRLRLRLR + * ... + */ + AV_STEREO3D_COLUMNS, +}; + + +/** + * Inverted views, Right/Bottom represents the left view. + */ +#define AV_STEREO3D_FLAG_INVERT (1 << 0) + +/** + * Stereo 3D type: this structure describes how two videos are packed + * within a single video surface, with additional information as needed. + * + * @note The struct must be allocated with av_stereo3d_alloc() and + * its size is not a part of the public ABI. + */ +typedef struct AVStereo3D { + /** + * How views are packed within the video. + */ + enum AVStereo3DType type; + + /** + * Additional information about the frame packing. + */ + int flags; +} AVStereo3D; + +/** + * Allocate an AVStereo3D structure and set its fields to default values. + * The resulting struct can be freed using av_freep(). + * + * @return An AVStereo3D filled with default values or NULL on failure. + */ +AVStereo3D *av_stereo3d_alloc(void); + +/** + * Allocate a complete AVFrameSideData and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVStereo3D structure to be filled by caller. + */ +AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); + +#endif /* AVUTIL_STEREO3D_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/time.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/time.h new file mode 100644 index 000000000..b01a97d77 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/time.h @@ -0,0 +1,39 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_TIME_H +#define AVUTIL_TIME_H + +#include <stdint.h> + +/** + * Get the current time in microseconds. + */ +int64_t av_gettime(void); + +/** + * Sleep for a period of time. Although the duration is expressed in + * microseconds, the actual delay may be rounded to the precision of the + * system timer. + * + * @param usec Number of microseconds to sleep. + * @return zero on success or (negative) error code. + */ +int av_usleep(unsigned usec); + +#endif /* AVUTIL_TIME_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/version.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/version.h new file mode 100644 index 000000000..c22d0c5f4 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/version.h @@ -0,0 +1,120 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_VERSION_H +#define AVUTIL_VERSION_H + +#include "macros.h" + +/** + * @defgroup version_utils Library Version Macros + * + * Useful to check and match library version in order to maintain + * backward compatibility. + * + * @{ + */ + +#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) + +/** + * @} + */ + +/** + * @file + * @ingroup lavu + * Libavutil version macros + */ + +/** + * @defgroup lavu_ver Version and Build diagnostics + * + * Macros and function useful to check at compiletime and at runtime + * which version of libavutil is in use. + * + * @{ + */ + +#define LIBAVUTIL_VERSION_MAJOR 54 +#define LIBAVUTIL_VERSION_MINOR 3 +#define LIBAVUTIL_VERSION_MICRO 0 + +#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT + +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) + +/** + * @} + * + * @defgroup depr_guards Deprecation guards + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + * + * @{ + */ + +#ifndef FF_API_PIX_FMT +#define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_CONTEXT_SIZE +#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_PIX_FMT_DESC +#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_AV_REVERSE +#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_AUDIOCONVERT +#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_CPU_FLAG_MMX2 +#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_LLS_PRIVATE +#define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_AVFRAME_LAVC +#define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_VDPAU +#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_XVMC +#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_OPT_TYPE_METADATA +#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 55) +#endif + + +/** + * @} + */ + +#endif /* AVUTIL_VERSION_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/xtea.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/xtea.h new file mode 100644 index 000000000..0fc3810dd --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libavutil/xtea.h @@ -0,0 +1,63 @@ +/* + * A 32-bit implementation of the XTEA algorithm + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_XTEA_H +#define AVUTIL_XTEA_H + +#include <stdint.h> + +/** + * @file + * @brief Public header for libavutil XTEA algorithm + * @defgroup lavu_xtea XTEA + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVXTEA { + uint32_t key[16]; +} AVXTEA; + +/** + * Initialize an AVXTEA context. + * + * @param ctx an AVXTEA context + * @param key a key of 16 bytes used for encryption/decryption + */ +void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVXTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_XTEA_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libswresample/swresample.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libswresample/swresample.h new file mode 100644 index 000000000..37656a667 --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libswresample/swresample.h @@ -0,0 +1,534 @@ +/* + * Copyright (C) 2011-2013 Michael Niedermayer ([email protected]) + * + * This file is part of libswresample + * + * libswresample is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * libswresample is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with libswresample; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWRESAMPLE_SWRESAMPLE_H +#define SWRESAMPLE_SWRESAMPLE_H + +/** + * @file + * @ingroup lswr + * libswresample public header + */ + +/** + * @defgroup lswr Libswresample + * @{ + * + * Libswresample (lswr) is a library that handles audio resampling, sample + * format conversion and mixing. + * + * Interaction with lswr is done through SwrContext, which is + * allocated with swr_alloc() or swr_alloc_set_opts(). It is opaque, so all parameters + * must be set with the @ref avoptions API. + * + * The first thing you will need to do in order to use lswr is to allocate + * SwrContext. This can be done with swr_alloc() or swr_alloc_set_opts(). If you + * are using the former, you must set options through the @ref avoptions API. + * The latter function provides the same feature, but it allows you to set some + * common options in the same statement. + * + * For example the following code will setup conversion from planar float sample + * format to interleaved signed 16-bit integer, downsampling from 48kHz to + * 44.1kHz and downmixing from 5.1 channels to stereo (using the default mixing + * matrix). This is using the swr_alloc() function. + * @code + * SwrContext *swr = swr_alloc(); + * av_opt_set_channel_layout(swr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0); + * av_opt_set_channel_layout(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0); + * av_opt_set_int(swr, "in_sample_rate", 48000, 0); + * av_opt_set_int(swr, "out_sample_rate", 44100, 0); + * av_opt_set_sample_fmt(swr, "in_sample_fmt", AV_SAMPLE_FMT_FLTP, 0); + * av_opt_set_sample_fmt(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); + * @endcode + * + * The same job can be done using swr_alloc_set_opts() as well: + * @code + * SwrContext *swr = swr_alloc_set_opts(NULL, // we're allocating a new context + * AV_CH_LAYOUT_STEREO, // out_ch_layout + * AV_SAMPLE_FMT_S16, // out_sample_fmt + * 44100, // out_sample_rate + * AV_CH_LAYOUT_5POINT1, // in_ch_layout + * AV_SAMPLE_FMT_FLTP, // in_sample_fmt + * 48000, // in_sample_rate + * 0, // log_offset + * NULL); // log_ctx + * @endcode + * + * Once all values have been set, it must be initialized with swr_init(). If + * you need to change the conversion parameters, you can change the parameters + * using @ref AVOptions, as described above in the first example; or by using + * swr_alloc_set_opts(), but with the first argument the allocated context. + * You must then call swr_init() again. + * + * The conversion itself is done by repeatedly calling swr_convert(). + * Note that the samples may get buffered in swr if you provide insufficient + * output space or if sample rate conversion is done, which requires "future" + * samples. Samples that do not require future input can be retrieved at any + * time by using swr_convert() (in_count can be set to 0). + * At the end of conversion the resampling buffer can be flushed by calling + * swr_convert() with NULL in and 0 in_count. + * + * The samples used in the conversion process can be managed with the libavutil + * @ref lavu_sampmanip "samples manipulation" API, including av_samples_alloc() + * function used in the following example. + * + * The delay between input and output, can at any time be found by using + * swr_get_delay(). + * + * The following code demonstrates the conversion loop assuming the parameters + * from above and caller-defined functions get_input() and handle_output(): + * @code + * uint8_t **input; + * int in_samples; + * + * while (get_input(&input, &in_samples)) { + * uint8_t *output; + * int out_samples = av_rescale_rnd(swr_get_delay(swr, 48000) + + * in_samples, 44100, 48000, AV_ROUND_UP); + * av_samples_alloc(&output, NULL, 2, out_samples, + * AV_SAMPLE_FMT_S16, 0); + * out_samples = swr_convert(swr, &output, out_samples, + * input, in_samples); + * handle_output(output, out_samples); + * av_freep(&output); + * } + * @endcode + * + * When the conversion is finished, the conversion + * context and everything associated with it must be freed with swr_free(). + * A swr_close() function is also available, but it exists mainly for + * compatibility with libavresample, and is not required to be called. + * + * There will be no memory leak if the data is not completely flushed before + * swr_free(). + */ + +#include <stdint.h> +#include "libavutil/frame.h" +#include "libavutil/samplefmt.h" + +#include "libswresample/version.h" + +#if LIBSWRESAMPLE_VERSION_MAJOR < 1 +#define SWR_CH_MAX 32 ///< Maximum number of channels +#endif + +/** + * @name Option constants + * These constants are used for the @ref avoptions interface for lswr. + * @{ + * + */ + +#define SWR_FLAG_RESAMPLE 1 ///< Force resampling even if equal sample rate +//TODO use int resample ? +//long term TODO can we enable this dynamically? + +/** Dithering algorithms */ +enum SwrDitherType { + SWR_DITHER_NONE = 0, + SWR_DITHER_RECTANGULAR, + SWR_DITHER_TRIANGULAR, + SWR_DITHER_TRIANGULAR_HIGHPASS, + + SWR_DITHER_NS = 64, ///< not part of API/ABI + SWR_DITHER_NS_LIPSHITZ, + SWR_DITHER_NS_F_WEIGHTED, + SWR_DITHER_NS_MODIFIED_E_WEIGHTED, + SWR_DITHER_NS_IMPROVED_E_WEIGHTED, + SWR_DITHER_NS_SHIBATA, + SWR_DITHER_NS_LOW_SHIBATA, + SWR_DITHER_NS_HIGH_SHIBATA, + SWR_DITHER_NB, ///< not part of API/ABI +}; + +/** Resampling Engines */ +enum SwrEngine { + SWR_ENGINE_SWR, /**< SW Resampler */ + SWR_ENGINE_SOXR, /**< SoX Resampler */ + SWR_ENGINE_NB, ///< not part of API/ABI +}; + +/** Resampling Filter Types */ +enum SwrFilterType { + SWR_FILTER_TYPE_CUBIC, /**< Cubic */ + SWR_FILTER_TYPE_BLACKMAN_NUTTALL, /**< Blackman Nuttall Windowed Sinc */ + SWR_FILTER_TYPE_KAISER, /**< Kaiser Windowed Sinc */ +}; + +/** + * @} + */ + +/** + * The libswresample context. Unlike libavcodec and libavformat, this structure + * is opaque. This means that if you would like to set options, you must use + * the @ref avoptions API and cannot directly set values to members of the + * structure. + */ +typedef struct SwrContext SwrContext; + +/** + * Get the AVClass for SwrContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + * @return the AVClass of SwrContext + */ +const AVClass *swr_get_class(void); + +/** + * @name SwrContext constructor functions + * @{ + */ + +/** + * Allocate SwrContext. + * + * If you use this function you will need to set the parameters (manually or + * with swr_alloc_set_opts()) before calling swr_init(). + * + * @see swr_alloc_set_opts(), swr_init(), swr_free() + * @return NULL on error, allocated context otherwise + */ +struct SwrContext *swr_alloc(void); + +/** + * Initialize context after user parameters have been set. + * @note The context must be configured using the AVOption API. + * + * @see av_opt_set_int() + * @see av_opt_set_dict() + * + * @param[in,out] s Swr context to initialize + * @return AVERROR error code in case of failure. + */ +int swr_init(struct SwrContext *s); + +/** + * Check whether an swr context has been initialized or not. + * + * @param[in] s Swr context to check + * @see swr_init() + * @return positive if it has been initialized, 0 if not initialized + */ +int swr_is_initialized(struct SwrContext *s); + +/** + * Allocate SwrContext if needed and set/reset common parameters. + * + * This function does not require s to be allocated with swr_alloc(). On the + * other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters + * on the allocated context. + * + * @param s existing Swr context if available, or NULL if not + * @param out_ch_layout output channel layout (AV_CH_LAYOUT_*) + * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*). + * @param out_sample_rate output sample rate (frequency in Hz) + * @param in_ch_layout input channel layout (AV_CH_LAYOUT_*) + * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*). + * @param in_sample_rate input sample rate (frequency in Hz) + * @param log_offset logging level offset + * @param log_ctx parent logging context, can be NULL + * + * @see swr_init(), swr_free() + * @return NULL on error, allocated context otherwise + */ +struct SwrContext *swr_alloc_set_opts(struct SwrContext *s, + int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, + int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, + int log_offset, void *log_ctx); + +/** + * @} + * + * @name SwrContext destructor functions + * @{ + */ + +/** + * Free the given SwrContext and set the pointer to NULL. + * + * @param[in] s a pointer to a pointer to Swr context + */ +void swr_free(struct SwrContext **s); + +/** + * Closes the context so that swr_is_initialized() returns 0. + * + * The context can be brought back to life by running swr_init(), + * swr_init() can also be used without swr_close(). + * This function is mainly provided for simplifying the usecase + * where one tries to support libavresample and libswresample. + * + * @param[in,out] s Swr context to be closed + */ +void swr_close(struct SwrContext *s); + +/** + * @} + * + * @name Core conversion functions + * @{ + */ + +/** Convert audio. + * + * in and in_count can be set to 0 to flush the last few samples out at the + * end. + * + * If more input is provided than output space then the input will be buffered. + * You can avoid this buffering by providing more output space than input. + * Conversion will run directly without copying whenever possible. + * + * @param s allocated Swr context, with parameters set + * @param out output buffers, only the first one need be set in case of packed audio + * @param out_count amount of space available for output in samples per channel + * @param in input buffers, only the first one need to be set in case of packed audio + * @param in_count number of input samples available in one channel + * + * @return number of samples output per channel, negative value on error + */ +int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, + const uint8_t **in , int in_count); + +/** + * Convert the next timestamp from input to output + * timestamps are in 1/(in_sample_rate * out_sample_rate) units. + * + * @note There are 2 slightly differently behaving modes. + * @li When automatic timestamp compensation is not used, (min_compensation >= FLT_MAX) + * in this case timestamps will be passed through with delays compensated + * @li When automatic timestamp compensation is used, (min_compensation < FLT_MAX) + * in this case the output timestamps will match output sample numbers. + * See ffmpeg-resampler(1) for the two modes of compensation. + * + * @param s[in] initialized Swr context + * @param pts[in] timestamp for the next input sample, INT64_MIN if unknown + * @see swr_set_compensation(), swr_drop_output(), and swr_inject_silence() are + * function used internally for timestamp compensation. + * @return the output timestamp for the next output sample + */ +int64_t swr_next_pts(struct SwrContext *s, int64_t pts); + +/** + * @} + * + * @name Low-level option setting functions + * These functons provide a means to set low-level options that is not possible + * with the AVOption API. + * @{ + */ + +/** + * Activate resampling compensation ("soft" compensation). This function is + * internally called when needed in swr_next_pts(). + * + * @param[in,out] s allocated Swr context. If it is not initialized, + * or SWR_FLAG_RESAMPLE is not set, swr_init() is + * called with the flag set. + * @param[in] sample_delta delta in PTS per sample + * @param[in] compensation_distance number of samples to compensate for + * @return >= 0 on success, AVERROR error codes if: + * @li @c s is NULL, + * @li @c compensation_distance is less than 0, + * @li @c compensation_distance is 0 but sample_delta is not, + * @li compensation unsupported by resampler, or + * @li swr_init() fails when called. + */ +int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance); + +/** + * Set a customized input channel mapping. + * + * @param[in,out] s allocated Swr context, not yet initialized + * @param[in] channel_map customized input channel mapping (array of channel + * indexes, -1 for a muted channel) + * @return >= 0 on success, or AVERROR error code in case of failure. + */ +int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map); + +/** + * Set a customized remix matrix. + * + * @param s allocated Swr context, not yet initialized + * @param matrix remix coefficients; matrix[i + stride * o] is + * the weight of input channel i in output channel o + * @param stride offset between lines of the matrix + * @return >= 0 on success, or AVERROR error code in case of failure. + */ +int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride); + +/** + * @} + * + * @name Sample handling functions + * @{ + */ + +/** + * Drops the specified number of output samples. + * + * This function, along with swr_inject_silence(), is called by swr_next_pts() + * if needed for "hard" compensation. + * + * @param s allocated Swr context + * @param count number of samples to be dropped + * + * @return >= 0 on success, or a negative AVERROR code on failure + */ +int swr_drop_output(struct SwrContext *s, int count); + +/** + * Injects the specified number of silence samples. + * + * This function, along with swr_drop_output(), is called by swr_next_pts() + * if needed for "hard" compensation. + * + * @param s allocated Swr context + * @param count number of samples to be dropped + * + * @return >= 0 on success, or a negative AVERROR code on failure + */ +int swr_inject_silence(struct SwrContext *s, int count); + +/** + * Gets the delay the next input sample will experience relative to the next output sample. + * + * Swresample can buffer data if more input has been provided than available + * output space, also converting between sample rates needs a delay. + * This function returns the sum of all such delays. + * The exact delay is not necessarily an integer value in either input or + * output sample rate. Especially when downsampling by a large value, the + * output sample rate may be a poor choice to represent the delay, similarly + * for upsampling and the input sample rate. + * + * @param s swr context + * @param base timebase in which the returned delay will be: + * @li if it's set to 1 the returned delay is in seconds + * @li if it's set to 1000 the returned delay is in milliseconds + * @li if it's set to the input sample rate then the returned + * delay is in input samples + * @li if it's set to the output sample rate then the returned + * delay is in output samples + * @li if it's the least common multiple of in_sample_rate and + * out_sample_rate then an exact rounding-free delay will be + * returned + * @returns the delay in 1 / @c base units. + */ +int64_t swr_get_delay(struct SwrContext *s, int64_t base); + +/** + * @} + * + * @name Configuration accessors + * @{ + */ + +/** + * Return the @ref LIBSWRESAMPLE_VERSION_INT constant. + * + * This is useful to check if the build-time libswresample has the same version + * as the run-time one. + * + * @returns the unsigned int-typed version + */ +unsigned swresample_version(void); + +/** + * Return the swr build-time configuration. + * + * @returns the build-time @c ./configure flags + */ +const char *swresample_configuration(void); + +/** + * Return the swr license. + * + * @returns the license of libswresample, determined at build-time + */ +const char *swresample_license(void); + +/** + * @} + * + * @name AVFrame based API + * @{ + */ + +/** + * Convert the samples in the input AVFrame and write them to the output AVFrame. + * + * Input and output AVFrames must have channel_layout, sample_rate and format set. + * + * If the output AVFrame does not have the data pointers allocated the nb_samples + * field will be set using av_frame_get_buffer() + * is called to allocate the frame. + * + * The output AVFrame can be NULL or have fewer allocated samples than required. + * In this case, any remaining samples not written to the output will be added + * to an internal FIFO buffer, to be returned at the next call to this function + * or to swr_convert(). + * + * If converting sample rate, there may be data remaining in the internal + * resampling delay buffer. swr_get_delay() tells the number of + * remaining samples. To get this data as output, call this function or + * swr_convert() with NULL input. + * + * If the SwrContext configuration does not match the output and + * input AVFrame settings the conversion does not take place and depending on + * which AVFrame is not matching AVERROR_OUTPUT_CHANGED, AVERROR_INPUT_CHANGED + * or the result of a bitwise-OR of them is returned. + * + * @see swr_delay() + * @see swr_convert() + * @see swr_get_delay() + * + * @param swr audio resample context + * @param output output AVFrame + * @param input input AVFrame + * @return 0 on success, AVERROR on failure or nonmatching + * configuration. + */ +int swr_convert_frame(SwrContext *swr, + AVFrame *output, const AVFrame *input); + +/** + * Configure or reconfigure the SwrContext using the information + * provided by the AVFrames. + * + * The original resampling context is reset even on failure. + * The function calls swr_close() internally if the context is open. + * + * @see swr_close(); + * + * @param swr audio resample context + * @param output output AVFrame + * @param input input AVFrame + * @return 0 on success, AVERROR on failure. + */ +int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in); + +/** + * @} + * @} + */ + +#endif /* SWRESAMPLE_SWRESAMPLE_H */ diff --git a/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libswresample/version.h b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libswresample/version.h new file mode 100644 index 000000000..61c76fa2f --- /dev/null +++ b/make/stub_includes/libav/lavc56_lavf56_lavu54_lavr02/libswresample/version.h @@ -0,0 +1,45 @@ +/* + * Version macros. + * + * This file is part of libswresample + * + * libswresample is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * libswresample is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with libswresample; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWR_VERSION_H +#define SWR_VERSION_H + +/** + * @file + * Libswresample version macros + */ + +#include "libavutil/avutil.h" + +#define LIBSWRESAMPLE_VERSION_MAJOR 1 +#define LIBSWRESAMPLE_VERSION_MINOR 1 +#define LIBSWRESAMPLE_VERSION_MICRO 100 + +#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ + LIBSWRESAMPLE_VERSION_MINOR, \ + LIBSWRESAMPLE_VERSION_MICRO) +#define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \ + LIBSWRESAMPLE_VERSION_MINOR, \ + LIBSWRESAMPLE_VERSION_MICRO) +#define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT + +#define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION) + +#endif /* SWR_VERSION_H */ diff --git a/make/validate-properties.xml b/make/validate-properties.xml index 3afb12bd5..a1ff589e0 100644 --- a/make/validate-properties.xml +++ b/make/validate-properties.xml @@ -30,7 +30,7 @@ - we can not overwrite it. --> <target name="java.class.path.validate"> - <available property="jogl.jar.on.class.path" classname="javax.media.opengl.GL" /> + <available property="jogl.jar.on.class.path" classname="com.jogamp.opengl.GL" /> <fail if="jogl.jar.on.class.path"> ****************************************************************** diff --git a/oculusvr-sdk b/oculusvr-sdk -Subproject a18c0cec906c4ac8c171d9000fd1c54e9302c9a +Subproject 946d61628f32123243be3ebf2a56d6bce536db7 diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java index 3d6de2b29..bd7081002 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java @@ -33,8 +33,8 @@ package com.jogamp.audio.windows.waveout; import java.io.*; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLDrawableFactory; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLDrawableFactory; public class TestSpatialization { public static void main(String[] args) { diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java index 75067a3b7..9381d318b 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java @@ -424,7 +424,7 @@ public class BuildComposablePipeline { final ArrayList<String> imports = new ArrayList<String>(); imports.add("java.io.*"); - imports.add("javax.media.opengl.*"); + imports.add("com.jogamp.opengl.*"); imports.add("com.jogamp.gluegen.runtime.*"); imports.add(Buffer.class.getPackage().getName()+".*"); for (final Class<?> clasS : clazzList) { @@ -682,7 +682,7 @@ public class BuildComposablePipeline { !type.endsWith("core") && !type.endsWith("Compatible") ) { - final Class<?> clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type); + final Class<?> clazz = BuildComposablePipeline.getClass("com.jogamp.opengl." + type); if (clazz.isAssignableFrom(baseInterfaceClass)) { output.println(" return true;"); } else { @@ -705,7 +705,7 @@ public class BuildComposablePipeline { } else if( type.equals("GLProfile") ) { output.println(" return " + getDownstreamObjectName() + ".getGLProfile();"); } else { - final Class<?> clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type); + final Class<?> clazz = BuildComposablePipeline.getClass("com.jogamp.opengl." + type); if (clazz.isAssignableFrom(baseInterfaceClass)) { output.println(" if( is" + type + "() ) { return this; }"); output.println(" throw new GLException(\"Not a " + type + " implementation\");"); diff --git a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java index 23d4fc3cf..3d23a623f 100644 --- a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java +++ b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java @@ -35,16 +35,14 @@ import com.jogamp.common.os.DynamicLookupHelper; import com.jogamp.gluegen.runtime.FunctionAddressResolver; /** - * @author Sven Gothel - * @author Michael Bien + * @author Michael Bien, et.al. */ public class GLProcAddressResolver implements FunctionAddressResolver { public static final boolean DEBUG = false; @Override - public long resolve(final String name, final DynamicLookupHelper lookup) { - + public long resolve(final String name, final DynamicLookupHelper lookup) throws SecurityException { long newProcAddress = 0; final int permutations = GLNameResolver.getFuncNamePermutationNumber(name); diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java index 023ca8373..dde3858de 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/Region.java +++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java @@ -87,7 +87,7 @@ public abstract class Region { * <p> * If set, a color channel attribute per vertex is added to the stream, * otherwise only the - * {@link com.jogamp.graph.curve.opengl.RegionRenderer#setColorStatic(javax.media.opengl.GL2ES2, float, float, float, float) static color} + * {@link com.jogamp.graph.curve.opengl.RegionRenderer#setColorStatic(com.jogamp.opengl.GL2ES2, float, float, float, float) static color} * is being used. * </p> */ diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java index 654f9a692..d924fa9c8 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java @@ -27,8 +27,8 @@ */
package com.jogamp.graph.curve.opengl;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
import jogamp.graph.curve.opengl.VBORegion2PMSAAES2;
import jogamp.graph.curve.opengl.VBORegion2PVBAAES2;
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java index a0f54d3b5..0c782d93e 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -30,11 +30,11 @@ package com.jogamp.graph.curve.opengl; import java.io.IOException; import java.util.Iterator; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLES2; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLES2; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import jogamp.graph.curve.opengl.shader.AttributeNames; import jogamp.graph.curve.opengl.shader.UniformNames; diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java index 6ff9bf9cd..2b243e6cf 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java @@ -29,10 +29,10 @@ package com.jogamp.graph.curve.opengl; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; import jogamp.common.os.PlatformPropsImpl; import jogamp.graph.curve.opengl.shader.UniformNames; diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java index 0fa1f49f1..5423cde95 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java @@ -31,8 +31,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLException; import jogamp.graph.geom.plane.AffineTransform; diff --git a/src/jogl/classes/javax/media/opengl/DebugGL2.java b/src/jogl/classes/com/jogamp/opengl/DebugGL2.java index e0d24c4a1..dc0f0df50 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL2.java +++ b/src/jogl/classes/com/jogamp/opengl/DebugGL2.java @@ -1,4 +1,4 @@ -package javax.media.opengl; +package com.jogamp.opengl; /** * <p> diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3.java b/src/jogl/classes/com/jogamp/opengl/DebugGL3.java index 678e800f6..6b27d207b 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL3.java +++ b/src/jogl/classes/com/jogamp/opengl/DebugGL3.java @@ -1,4 +1,4 @@ -package javax.media.opengl; +package com.jogamp.opengl; /** * <p> diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java b/src/jogl/classes/com/jogamp/opengl/DebugGL3bc.java index 2636e9428..d92f6043f 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java +++ b/src/jogl/classes/com/jogamp/opengl/DebugGL3bc.java @@ -1,4 +1,4 @@ -package javax.media.opengl; +package com.jogamp.opengl; /** * <p> diff --git a/src/jogl/classes/javax/media/opengl/DebugGL4.java b/src/jogl/classes/com/jogamp/opengl/DebugGL4.java index c4f8764cb..76f5a4ac3 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL4.java +++ b/src/jogl/classes/com/jogamp/opengl/DebugGL4.java @@ -1,4 +1,4 @@ -package javax.media.opengl; +package com.jogamp.opengl; /** * <p> diff --git a/src/jogl/classes/javax/media/opengl/DebugGLES2.java b/src/jogl/classes/com/jogamp/opengl/DebugGLES2.java index c4e06f347..e2b280515 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGLES2.java +++ b/src/jogl/classes/com/jogamp/opengl/DebugGLES2.java @@ -1,4 +1,4 @@ -package javax.media.opengl; +package com.jogamp.opengl; /** * <p> diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/com/jogamp/opengl/DefaultGLCapabilitiesChooser.java index 412af25e0..88a88087f 100644 --- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java +++ b/src/jogl/classes/com/jogamp/opengl/DefaultGLCapabilitiesChooser.java @@ -38,14 +38,15 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package com.jogamp.opengl; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowException; import java.util.List; -import javax.media.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.PropertyAccess; import jogamp.opengl.Debug; @@ -126,7 +127,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { final int availnum = available.size(); if (DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); System.err.println("Desired: " + gldes); System.err.println("Available: " + availnum); for (int i = 0; i < available.size(); i++) { diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index 03693a688..e1ddc9c66 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -30,20 +30,21 @@ package com.jogamp.opengl; import java.util.Arrays; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GL3; -import javax.media.opengl.GLBase; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GL3; +import com.jogamp.opengl.GLBase; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.Debug; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.PropertyAccess; import com.jogamp.opengl.FBObject.Attachment.Type; @@ -698,10 +699,7 @@ public class FBObject { final int magFilter, final int minFilter, final int wrapS, final int wrapT) { final int dataFormat, dataType; final boolean alpha = hasAlpha(internalFormat); - if( gl.isGLES3() ) { - dataFormat = alpha ? GL.GL_RGBA : GL.GL_RGB; - dataType = GL.GL_UNSIGNED_BYTE; - } else if( gl.isGLES() ) { + if( gl.isGLES() ) { dataFormat = alpha ? GL.GL_RGBA : GL.GL_RGB; dataType = GL.GL_UNSIGNED_BYTE; } else { @@ -1071,7 +1069,7 @@ public class FBObject { vStatus = GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; // always incomplete w/o attachments! if(DEBUG) { System.err.println("FBObject.init() END: "+this); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } @@ -1306,7 +1304,7 @@ public class FBObject { final int glerr = gl.glGetError(); if(DEBUG && GL.GL_NO_ERROR != glerr) { System.err.println("Pre-existing GL error: "+toHexString(glerr)); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return glerr; } @@ -1520,7 +1518,7 @@ public class FBObject { final TextureAttachment texA = colbuf.getTextureAttachment(); if( samples > 0 ) { removeColorAttachment(attachmentPoint, texA); - if(initializedColorbuf) { + if( initializedColorbuf ) { texA.free(gl); } throw new GLException("Texture2D not supported w/ MSAA. If you have enabled MSAA with exisiting texture attachments, you may want to detach them via detachAllTexturebuffer(gl)."); @@ -1533,9 +1531,9 @@ public class FBObject { if(!ignoreStatus) { updateStatus(gl); - if(!isStatusValid()) { + if( !isStatusValid() ) { detachColorbuffer(gl, attachmentPoint, true); - throw new GLException("attachTexture2D "+texA+" at "+attachmentPoint+" failed "+getStatusString()+", "+this); + throw new GLException("attachTexture2D "+texA+" at "+attachmentPoint+" failed: "+getStatusString()+", "+this); } } } else { @@ -1548,9 +1546,9 @@ public class FBObject { if(!ignoreStatus) { updateStatus(gl); - if(!isStatusValid()) { + if( !isStatusValid() ) { detachColorbuffer(gl, attachmentPoint, true); - throw new GLException("attachColorbuffer "+colA+" at "+attachmentPoint+" failed "+getStatusString()+", "+this); + throw new GLException("attachColorbuffer "+colA+" at "+attachmentPoint+" failed: "+getStatusString()+", "+this); } } } @@ -1796,7 +1794,7 @@ public class FBObject { updateStatus(gl); if( !isStatusValid() ) { detachRenderbuffer(gl, atype, true); - throw new GLException("renderbuffer [attachmentType "+atype+", iformat "+toHexString(internalFormat)+"] failed: "+this.getStatusString()+": "+this.toString()); + throw new GLException("renderbuffer [attachmentType "+atype+", iformat "+toHexString(internalFormat)+"] failed: "+this.getStatusString()+", "+this.toString()); } } @@ -2197,7 +2195,7 @@ public class FBObject { } */ updateStatus(gl); if(!isStatusValid()) { - throw new GLException("detachAllImpl failed "+getStatusString()+", "+this); + throw new GLException("detachAllImpl failed: "+getStatusString()+", "+this); } } } finally { @@ -2306,7 +2304,7 @@ public class FBObject { public final boolean resetSamplingSink(final GL gl) throws GLException { if(DEBUG) { System.err.println("FBObject.resetSamplingSink.0"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if( 0 == samples ) { diff --git a/src/jogl/classes/javax/media/opengl/FPSCounter.java b/src/jogl/classes/com/jogamp/opengl/FPSCounter.java index 4997258e0..a3b7ccb70 100644 --- a/src/jogl/classes/javax/media/opengl/FPSCounter.java +++ b/src/jogl/classes/com/jogamp/opengl/FPSCounter.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; import java.io.PrintStream; diff --git a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java b/src/jogl/classes/com/jogamp/opengl/GLAnimatorControl.java index d14ada48b..549efd569 100644 --- a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java +++ b/src/jogl/classes/com/jogamp/opengl/GLAnimatorControl.java @@ -26,11 +26,11 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; /** * An animator control interface, - * which implementation may drive a {@link javax.media.opengl.GLAutoDrawable} animation. + * which implementation may drive a {@link com.jogamp.opengl.GLAutoDrawable} animation. */ public interface GLAnimatorControl extends FPSCounter { /** diff --git a/src/jogl/classes/javax/media/opengl/GLArrayData.java b/src/jogl/classes/com/jogamp/opengl/GLArrayData.java index 97f58a92a..ea2dfb0f3 100644 --- a/src/jogl/classes/javax/media/opengl/GLArrayData.java +++ b/src/jogl/classes/com/jogamp/opengl/GLArrayData.java @@ -26,11 +26,11 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; import java.nio.Buffer; -import javax.media.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; /** * diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawable.java index bded88d20..385acf082 100644 --- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawable.java @@ -38,11 +38,11 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package com.jogamp.opengl; import java.util.List; -import javax.media.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeSurface; import com.jogamp.common.util.locks.RecursiveLock; @@ -63,7 +63,7 @@ import jogamp.opengl.Debug; <h5><a name="initialization">GLAutoDrawable Initialization</a></h5> <p> The implementation shall initialize itself as soon as possible, - which is only possible <i>after</i> the attached {@link javax.media.nativewindow.NativeSurface NativeSurface} becomes visible and and is realized.<br> + which is only possible <i>after</i> the attached {@link com.jogamp.nativewindow.NativeSurface NativeSurface} becomes visible and and is realized.<br> The following initialization sequence should be implemented: <ul> <li> Create the {@link GLDrawable} with the requested {@link GLCapabilities}</li> @@ -81,11 +81,11 @@ import jogamp.opengl.Debug; <p> Another implementation detail is the {@link GLDrawable} reconfiguration. One use case is where a window is being dragged to another screen with a different pixel configuration, ie {@link GLCapabilities}. The implementation - shall be able to detect such cases in conjunction with the associated {@link javax.media.nativewindow.NativeSurface NativeSurface}.<br/> + shall be able to detect such cases in conjunction with the associated {@link com.jogamp.nativewindow.NativeSurface NativeSurface}.<br/> For example, AWT's {@link java.awt.Canvas} 's {@link java.awt.Canvas#getGraphicsConfiguration getGraphicsConfiguration()} - is capable to determine a display device change. This is demonstrated within {@link javax.media.opengl.awt.GLCanvas}'s - and NEWT's <code>AWTCanvas</code> {@link javax.media.opengl.awt.GLCanvas#getGraphicsConfiguration getGraphicsConfiguration()} - specialization. Another demonstration is NEWT's {@link javax.media.nativewindow.NativeWindow NativeWindow} + is capable to determine a display device change. This is demonstrated within {@link com.jogamp.opengl.awt.GLCanvas}'s + and NEWT's <code>AWTCanvas</code> {@link com.jogamp.opengl.awt.GLCanvas#getGraphicsConfiguration getGraphicsConfiguration()} + specialization. Another demonstration is NEWT's {@link com.jogamp.nativewindow.NativeWindow NativeWindow} implementation on the Windows platform, which utilizes the native platform's <i>MonitorFromWindow(HWND)</i> function.<br/> All OpenGL resources shall be regenerated, while the drawable's {@link GLCapabilities} has to be chosen again. The following protocol shall be satisfied. @@ -342,12 +342,12 @@ public interface GLAutoDrawable extends GLDrawable { public GLEventListener removeGLEventListener(GLEventListener listener); /** - * Registers the usage of an animator, an {@link javax.media.opengl.GLAnimatorControl} implementation. + * Registers the usage of an animator, an {@link com.jogamp.opengl.GLAnimatorControl} implementation. * The animator will be queried whether it's animating, ie periodically issuing {@link #display()} calls or not. * <p> * This method shall be called by an animator implementation only,<br> - * e.g. {@link com.jogamp.opengl.util.Animator#add(javax.media.opengl.GLAutoDrawable)}, passing it's control implementation,<br> - * and {@link com.jogamp.opengl.util.Animator#remove(javax.media.opengl.GLAutoDrawable)}, passing <code>null</code>. + * e.g. {@link com.jogamp.opengl.util.Animator#add(com.jogamp.opengl.GLAutoDrawable)}, passing it's control implementation,<br> + * and {@link com.jogamp.opengl.util.Animator#remove(com.jogamp.opengl.GLAutoDrawable)}, passing <code>null</code>. * </p> * <p> * Impacts {@link #display()} and {@link #invoke(boolean, GLRunnable)} semantics.</p><br> @@ -359,15 +359,15 @@ public interface GLAutoDrawable extends GLDrawable { * @throws GLException if an animator is already registered. * @see #display() * @see #invoke(boolean, GLRunnable) - * @see javax.media.opengl.GLAnimatorControl + * @see com.jogamp.opengl.GLAnimatorControl */ public abstract void setAnimator(GLAnimatorControl animatorControl) throws GLException; /** - * @return the registered {@link javax.media.opengl.GLAnimatorControl} implementation, using this <code>GLAutoDrawable</code>. + * @return the registered {@link com.jogamp.opengl.GLAnimatorControl} implementation, using this <code>GLAutoDrawable</code>. * - * @see #setAnimator(javax.media.opengl.GLAnimatorControl) - * @see javax.media.opengl.GLAnimatorControl + * @see #setAnimator(com.jogamp.opengl.GLAnimatorControl) + * @see com.jogamp.opengl.GLAnimatorControl */ public GLAnimatorControl getAnimator(); @@ -504,15 +504,15 @@ public interface GLAutoDrawable extends GLDrawable { * <ul> * <li> Calling {@link GLEventListener#display display(..)} for all * registered {@link GLEventListener}s. </li> - * <li> Executes all one-shot {@link javax.media.opengl.GLRunnable GLRunnable}, + * <li> Executes all one-shot {@link com.jogamp.opengl.GLRunnable GLRunnable}, * enqueued via {@link #invoke(boolean, GLRunnable)}.</li> * </ul></p> * <p> - * May be called periodically by a running {@link javax.media.opengl.GLAnimatorControl} implementation,<br> - * which must register itself with {@link #setAnimator(javax.media.opengl.GLAnimatorControl)}.</p> + * May be called periodically by a running {@link com.jogamp.opengl.GLAnimatorControl} implementation,<br> + * which must register itself with {@link #setAnimator(com.jogamp.opengl.GLAnimatorControl)}.</p> * <p> * Called automatically by the window system toolkit upon receiving a repaint() request, <br> - * except an {@link javax.media.opengl.GLAnimatorControl} implementation {@link javax.media.opengl.GLAnimatorControl#isAnimating()}.</p> + * except an {@link com.jogamp.opengl.GLAnimatorControl} implementation {@link com.jogamp.opengl.GLAnimatorControl#isAnimating()}.</p> * <p> * This routine may also be called manually for better control over the * rendering process. It is legal to call another GLAutoDrawable's @@ -525,7 +525,7 @@ public interface GLAutoDrawable extends GLDrawable { * actual {@link GLEventListener#display display(..)} calls, * in case this has not been done yet.</p> * - * @see #setAnimator(javax.media.opengl.GLAnimatorControl) + * @see #setAnimator(com.jogamp.opengl.GLAnimatorControl) */ public void display(); @@ -598,8 +598,8 @@ public interface GLAutoDrawable extends GLDrawable { * <tr><td>Toolkit</td> <td>GLAutoDrawable Implementation</td> <td>~</td> <td>Return Type of getUpstreamWidget()</td</tr> * <tr><td>NEWT</td> <td>{@link com.jogamp.newt.opengl.GLWindow}</td> <td>has a</td> <td>{@link com.jogamp.newt.Window}</td</tr> * <tr><td>SWT</td> <td>{@link com.jogamp.opengl.swt.GLCanvas}</td> <td>is a</td> <td>{@link org.eclipse.swt.widgets.Canvas}</td</tr> - * <tr><td>AWT</td> <td>{@link javax.media.opengl.awt.GLCanvas}</td> <td>is a</td> <td>{@link java.awt.Canvas}</td</tr> - * <tr><td>AWT</td> <td>{@link javax.media.opengl.awt.GLJPanel}</td> <td>is a</td> <td>{@link javax.swing.JPanel}</td</tr> + * <tr><td>AWT</td> <td>{@link com.jogamp.opengl.awt.GLCanvas}</td> <td>is a</td> <td>{@link java.awt.Canvas}</td</tr> + * <tr><td>AWT</td> <td>{@link com.jogamp.opengl.awt.GLJPanel}</td> <td>is a</td> <td>{@link javax.swing.JPanel}</td</tr> * </table> * However, the result may be other object types than the listed above * due to new supported toolkits. diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java index b9f1fb10c..712fcdac7 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java +++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java @@ -28,17 +28,17 @@ package com.jogamp.opengl; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.WindowClosingProtocol; -import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLSharedContextSetter; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.WindowClosingProtocol; +import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLSharedContextSetter; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/com/jogamp/opengl/GLBase.java index 48455c525..19b7808fc 100644 --- a/src/jogl/classes/javax/media/opengl/GLBase.java +++ b/src/jogl/classes/com/jogamp/opengl/GLBase.java @@ -27,7 +27,7 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; /** * <P>The base interface from which all GL profiles derive, providing @@ -584,6 +584,9 @@ public interface GLBase { /** * Return the framebuffer name bound to this context, * see {@link GL#glBindFramebuffer(int, int)}. + * <p> + * Calls {@link GLContext#getBoundFramebuffer(int)}. + * </p> */ public int getBoundFramebuffer(int target); @@ -594,6 +597,9 @@ public interface GLBase { * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable * is being used. * </p> + * <p> + * Calls {@link GLContext#getDefaultDrawFramebuffer()}. + * </p> */ public int getDefaultDrawFramebuffer(); @@ -604,6 +610,9 @@ public interface GLBase { * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable * is being used. * </p> + * <p> + * Calls {@link GLContext#getDefaultReadFramebuffer()}. + * </p> */ public int getDefaultReadFramebuffer(); @@ -628,6 +637,9 @@ public interface GLBase { * Note-3: See {@link com.jogamp.opengl.util.GLDrawableUtil#swapBuffersBeforeRead(GLCapabilitiesImmutable) swapBuffersBeforeRead} * for read-pixels and swap-buffers implications. * </p> + * <p> + * Calls {@link GLContext#getDefaultReadBuffer()}. + * </p> */ public int getDefaultReadBuffer(); } diff --git a/src/jogl/classes/javax/media/opengl/GLBufferStorage.java b/src/jogl/classes/com/jogamp/opengl/GLBufferStorage.java index 1101ed31b..5db97d42f 100644 --- a/src/jogl/classes/javax/media/opengl/GLBufferStorage.java +++ b/src/jogl/classes/com/jogamp/opengl/GLBufferStorage.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; import java.nio.ByteBuffer; import java.nio.IntBuffer; diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/com/jogamp/opengl/GLCapabilities.java index 0d65d35cb..02aa47119 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java +++ b/src/jogl/classes/com/jogamp/opengl/GLCapabilities.java @@ -38,10 +38,10 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package com.jogamp.opengl; -import javax.media.nativewindow.Capabilities; -import javax.media.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.Capabilities; +import com.jogamp.nativewindow.CapabilitiesImmutable; /** Specifies a set of OpenGL capabilities.<br> At creation time of a {@link GLDrawable} using {@link GLDrawableFactory}, diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java b/src/jogl/classes/com/jogamp/opengl/GLCapabilitiesChooser.java index 2e0bec1f9..9911d1314 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java +++ b/src/jogl/classes/com/jogamp/opengl/GLCapabilitiesChooser.java @@ -38,14 +38,14 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package com.jogamp.opengl; import java.util.List; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.CapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLCapabilitiesImmutable; /** Provides a mechanism by which applications can customize the window type selection for a given {@link GLCapabilities}. diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java b/src/jogl/classes/com/jogamp/opengl/GLCapabilitiesImmutable.java index dc28539a0..25081a521 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java +++ b/src/jogl/classes/com/jogamp/opengl/GLCapabilitiesImmutable.java @@ -26,15 +26,15 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; -import javax.media.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.CapabilitiesImmutable; /** * Specifies an immutable set of OpenGL capabilities.<br> * - * @see javax.media.opengl.GLCapabilities - * @see javax.media.nativewindow.CapabilitiesImmutable + * @see com.jogamp.opengl.GLCapabilities + * @see com.jogamp.nativewindow.CapabilitiesImmutable */ public interface GLCapabilitiesImmutable extends CapabilitiesImmutable { /** diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/com/jogamp/opengl/GLContext.java index e2498e6f1..6366c4e37 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/GLContext.java @@ -38,7 +38,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package com.jogamp.opengl; import java.nio.IntBuffer; import java.util.HashMap; @@ -47,8 +47,8 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; @@ -123,31 +123,43 @@ public abstract class GLContext { public static final int CONTEXT_CURRENT_NEW = 2; /** Version 1.00, i.e. GLSL 1.00 for ES 2.0. */ - public static final VersionNumber Version100 = new VersionNumber(1, 0, 0); + public static final VersionNumber Version1_0 = new VersionNumber(1, 0, 0); /** Version 1.10, i.e. GLSL 1.10 for GL 2.0. */ - public static final VersionNumber Version110 = new VersionNumber(1, 10, 0); + public static final VersionNumber Version1_10 = new VersionNumber(1, 10, 0); /** Version 1.20, i.e. GLSL 1.20 for GL 2.1. */ - public static final VersionNumber Version120 = new VersionNumber(1, 20, 0); + public static final VersionNumber Version1_20 = new VersionNumber(1, 20, 0); /** Version 1.30, i.e. GLSL 1.30 for GL 3.0. */ - public static final VersionNumber Version130 = new VersionNumber(1, 30, 0); + public static final VersionNumber Version1_30 = new VersionNumber(1, 30, 0); /** Version 1.40, i.e. GLSL 1.40 for GL 3.1. */ - public static final VersionNumber Version140 = new VersionNumber(1, 40, 0); + public static final VersionNumber Version1_40 = new VersionNumber(1, 40, 0); /** Version 1.50, i.e. GLSL 1.50 for GL 3.2. */ - public static final VersionNumber Version150 = new VersionNumber(1, 50, 0); + public static final VersionNumber Version1_50 = new VersionNumber(1, 50, 0); + + /** Version 1.1, i.e. GL 1.1 */ + public static final VersionNumber Version1_1 = new VersionNumber(1, 1, 0); + + /** Version 1.2, i.e. GL 1.2 */ + public static final VersionNumber Version1_2 = new VersionNumber(1, 2, 0); + + /** Version 1.4, i.e. GL 1.4 */ + public static final VersionNumber Version1_4 = new VersionNumber(1, 4, 0); + + /** Version 1.5, i.e. GL 1.5 */ + public static final VersionNumber Version1_5 = new VersionNumber(1, 5, 0); /** Version 3.0. As an OpenGL version, it qualifies for desktop {@link #isGL2()} only, or ES 3.0. Or GLSL 3.00 for ES 3.0. */ - public static final VersionNumber Version300 = new VersionNumber(3, 0, 0); + public static final VersionNumber Version3_0 = new VersionNumber(3, 0, 0); /** Version 3.1. As an OpenGL version, it qualifies for {@link #isGL3core()}, {@link #isGL3bc()} and {@link #isGL3()} */ - public static final VersionNumber Version310 = new VersionNumber(3, 1, 0); + public static final VersionNumber Version3_1 = new VersionNumber(3, 1, 0); /** Version 3.2. As an OpenGL version, it qualifies for geometry shader */ - public static final VersionNumber Version320 = new VersionNumber(3, 2, 0); + public static final VersionNumber Version3_2 = new VersionNumber(3, 2, 0); /** Version 4.3. As an OpenGL version, it qualifies for <code>GL_ARB_ES3_compatibility</code> */ - public static final VersionNumber Version430 = new VersionNumber(4, 3, 0); + public static final VersionNumber Version4_3 = new VersionNumber(4, 3, 0); - protected static final VersionNumber Version800 = new VersionNumber(8, 0, 0); + protected static final VersionNumber Version8_0 = new VersionNumber(8, 0, 0); private static final String S_EMPTY = ""; @@ -321,10 +333,11 @@ public abstract class GLContext { * if the {@link #getGLReadDrawable() read-drawable} differs * from the {@link #getGLDrawable() write-drawable}. * Otherwise set both drawables, read and write. - * @return The previous read/write drawable + * @return The previous read/write drawable if operation succeeds * - * @throws GLException in case <code>null</code> is being passed or - * this context is made current on another thread. + * @throws GLException in case <code>null</code> is being passed, + * this context is made current on another thread + * or operation fails. * * @see #isGLReadDrawableAvailable() * @see #setGLReadDrawable(GLDrawable) @@ -430,10 +443,8 @@ public abstract class GLContext { * <li>{@link #CONTEXT_NOT_CURRENT} if the context could not be made current.</li> * </ul> * - * @throws GLException if synchronization is disabled and the - * context is current on another thread, or because the context - * could not be created or made current due to non-recoverable, - * window system-specific errors. + * @throws GLException if the context could not be created + * or made current due to non-recoverable, system-specific errors. */ public abstract int makeCurrent() throws GLException; @@ -529,7 +540,7 @@ public abstract class GLContext { switch(res) { case CONTEXT_NOT_CURRENT: return "CONTEXT_NOT_CURRENT"; case CONTEXT_CURRENT: return "CONTEXT_CURRENT"; - case CONTEXT_CURRENT_NEW: return "CONTEXT_NOT_CURRENT"; + case CONTEXT_CURRENT_NEW: return "CONTEXT_CURRENT_NEW"; default: return "INVALID_VALUE"; } } @@ -666,7 +677,7 @@ public abstract class GLContext { * * @param glFunctionName the name of the OpenGL function (e.g., use * "glPolygonOffsetEXT" or "glPolygonOffset" to check if the {@link - * javax.media.opengl.GL#glPolygonOffset(float,float)} is available). + * com.jogamp.opengl.GL#glPolygonOffset(float,float)} is available). */ public abstract boolean isFunctionAvailable(String glFunctionName); @@ -698,7 +709,7 @@ public abstract class GLContext { space-separated list of available extensions. Can only be called while this context is current. This is equivalent to - {@link javax.media.opengl.GL#glGetString(int) glGetString}({@link javax.media.opengl.GL#GL_EXTENSIONS GL_EXTENSIONS}) + {@link com.jogamp.opengl.GL#glGetString(int) glGetString}({@link com.jogamp.opengl.GL#GL_EXTENSIONS GL_EXTENSIONS}) */ public abstract String getGLExtensionsString(); @@ -844,11 +855,11 @@ public abstract class GLContext { final int minor = ctxGLSLVersion.getMinor(); final String profileOpt; if( isGLES() ) { - profileOpt = ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : S_EMPTY; + profileOpt = ctxGLSLVersion.compareTo(Version3_0) >= 0 ? " es" : S_EMPTY; } else if( isGLCoreProfile() ) { - profileOpt = ctxGLSLVersion.compareTo(Version150) >= 0 ? " core" : S_EMPTY; + profileOpt = ctxGLSLVersion.compareTo(Version1_50) >= 0 ? " core" : S_EMPTY; } else if( isGLCompatibilityProfile() ) { - profileOpt = ctxGLSLVersion.compareTo(Version150) >= 0 ? " compatibility" : S_EMPTY; + profileOpt = ctxGLSLVersion.compareTo(Version1_50) >= 0 ? " compatibility" : S_EMPTY; } else { throw new InternalError("Neither ES, Core nor Compat: "+this); // see validateProfileBits(..) } @@ -858,22 +869,22 @@ public abstract class GLContext { protected static final VersionNumber getStaticGLSLVersionNumber(final int glMajorVersion, final int glMinorVersion, final int ctxOptions) { if( 0 != ( CTX_PROFILE_ES & ctxOptions ) ) { if( 3 == glMajorVersion ) { - return Version300; // ES 3.0 -> GLSL 3.00 + return Version3_0; // ES 3.0 -> GLSL 3.00 } else if( 2 == glMajorVersion ) { - return Version100; // ES 2.0 -> GLSL 1.00 + return Version1_0; // ES 2.0 -> GLSL 1.00 } } else if( 1 == glMajorVersion ) { - return Version110; // GL 1.x -> GLSL 1.10 + return Version1_10; // GL 1.x -> GLSL 1.10 } else if( 2 == glMajorVersion ) { switch ( glMinorVersion ) { - case 0: return Version110; // GL 2.0 -> GLSL 1.10 - default: return Version120; // GL 2.1 -> GLSL 1.20 + case 0: return Version1_10; // GL 2.0 -> GLSL 1.10 + default: return Version1_20; // GL 2.1 -> GLSL 1.20 } } else if( 3 == glMajorVersion && 2 >= glMinorVersion ) { switch ( glMinorVersion ) { - case 0: return Version130; // GL 3.0 -> GLSL 1.30 - case 1: return Version140; // GL 3.1 -> GLSL 1.40 - default: return Version150; // GL 3.2 -> GLSL 1.50 + case 0: return Version1_30; // GL 3.0 -> GLSL 1.30 + case 1: return Version1_40; // GL 3.1 -> GLSL 1.40 + default: return Version1_50; // GL 3.2 -> GLSL 1.50 } } // The new default: GL >= 3.3, ES >= 3.0 @@ -1032,7 +1043,7 @@ public abstract class GLContext { */ public final boolean isGL3bc() { return 0 != (ctxOptions & CTX_PROFILE_COMPAT) && - ctxVersion.compareTo(Version310) >= 0 ; + ctxVersion.compareTo(Version3_1) >= 0 ; } /** @@ -1041,7 +1052,7 @@ public abstract class GLContext { */ public final boolean isGL3() { return 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) && - ctxVersion.compareTo(Version310) >= 0 ; + ctxVersion.compareTo(Version3_1) >= 0 ; } /** @@ -1049,7 +1060,7 @@ public abstract class GLContext { */ public final boolean isGL3core() { return 0 != ( ctxOptions & CTX_PROFILE_CORE ) && - ctxVersion.compareTo(Version310) >= 0; + ctxVersion.compareTo(Version3_1) >= 0; } /** @@ -1058,7 +1069,7 @@ public abstract class GLContext { public final boolean isGLcore() { return ( 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 2 ) || ( 0 != ( ctxOptions & CTX_PROFILE_CORE ) && - ctxVersion.compareTo(Version310) >= 0 + ctxVersion.compareTo(Version3_1) >= 0 ) ; } @@ -1106,7 +1117,7 @@ public abstract class GLContext { return // ES 3.x not included, see above. ( 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 3 ) || ( 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) && 0 != ( ctxOptions & CTX_PROFILE_CORE ) && - ctxVersion.compareTo(Version310) >= 0 + ctxVersion.compareTo(Version3_1) >= 0 ) ; } @@ -1461,13 +1472,13 @@ public abstract class GLContext { /* 1.*/ { 0, 1, 2, 3, 4, 5 }, /* 2.*/ { 0, 1 }, /* 3.*/ { 0, 1, 2, 3 }, - /* 4.*/ { 0, 1, 2, 3, 4 } }; + /* 4.*/ { 0, 1, 2, 3, 4, 5 } }; public static final int ES_VERSIONS[][] = { /* 0.*/ { -1 }, /* 1.*/ { 0, 1 }, /* 2.*/ { 0 }, - /* 3.*/ { 0 } }; + /* 3.*/ { 0, 1 } }; public static final int getMaxMajor(final int ctxProfile) { return ( 0 != ( CTX_PROFILE_ES & ctxProfile ) ) ? ES_VERSIONS.length-1 : GL_VERSIONS.length-1; @@ -1604,12 +1615,12 @@ public abstract class GLContext { // /** - * @see #getDeviceVersionAvailableKey(javax.media.nativewindow.AbstractGraphicsDevice, int, int) + * @see #getDeviceVersionAvailableKey(com.jogamp.nativewindow.AbstractGraphicsDevice, int, int) */ protected static final IdentityHashMap<String, Integer> deviceVersionAvailable = new IdentityHashMap<String, Integer>(); /** - * @see #getUniqueDeviceString(javax.media.nativewindow.AbstractGraphicsDevice) + * @see #getUniqueDeviceString(com.jogamp.nativewindow.AbstractGraphicsDevice) */ private static final IdentityHashMap<String, String> deviceVersionsAvailableSet = new IdentityHashMap<String, String>(); @@ -1626,11 +1637,13 @@ public abstract class GLContext { } } - protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device) { + protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device, final boolean set) { synchronized ( deviceVersionsAvailableSet ) { final String devKey = device.getUniqueID(); - if( null != deviceVersionsAvailableSet.put(devKey, devKey) ) { - throw new InternalError("Already set: "+devKey); + if( set ) { + deviceVersionsAvailableSet.put(devKey, devKey); + } else { + deviceVersionsAvailableSet.remove(devKey); } if (DEBUG) { System.err.println(getThreadName() + ": createContextARB: SET mappedVersionsAvailableSet "+devKey); @@ -1651,7 +1664,7 @@ public abstract class GLContext { /** * Called by {@link jogamp.opengl.GLContextImpl#createContextARBMapVersionsAvailable(int,int)} not intended to be used by * implementations. However, if {@link jogamp.opengl.GLContextImpl#createContextARB(long, boolean)} is not being used within - * {@link javax.media.opengl.GLDrawableFactory#getOrCreateSharedContext(javax.media.nativewindow.AbstractGraphicsDevice)}, + * {@link com.jogamp.opengl.GLDrawableFactory#getOrCreateSharedContext(com.jogamp.nativewindow.AbstractGraphicsDevice)}, * GLProfile has to map the available versions. * * @param reqMajor Key Value either 1, 2, 3 or 4 diff --git a/src/jogl/classes/javax/media/opengl/GLDebugListener.java b/src/jogl/classes/com/jogamp/opengl/GLDebugListener.java index ec7f7cec1..30e1a49c2 100644 --- a/src/jogl/classes/javax/media/opengl/GLDebugListener.java +++ b/src/jogl/classes/com/jogamp/opengl/GLDebugListener.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; /** * Listener for {@link GLDebugMessage}s. diff --git a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java b/src/jogl/classes/com/jogamp/opengl/GLDebugMessage.java index 325345012..a8868026b 100644 --- a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java +++ b/src/jogl/classes/com/jogamp/opengl/GLDebugMessage.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; import com.jogamp.common.os.Platform; diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/com/jogamp/opengl/GLDrawable.java index 5c881ab73..c801ba463 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/GLDrawable.java @@ -38,11 +38,11 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package com.jogamp.opengl; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeSurfaceHolder; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeSurfaceHolder; /** An abstraction for an OpenGL rendering target. A GLDrawable's @@ -229,7 +229,7 @@ public interface GLDrawable extends NativeSurfaceHolder { * <i>and</i> while it's {@link NativeSurface surface} is being {@link NativeSurface#lockSurface() locked}. * <p> * It is usually identical to the underlying windowing toolkit {@link NativeSurface surface}'s - * {@link javax.media.nativewindow.NativeSurface#getSurfaceHandle() handle} + * {@link com.jogamp.nativewindow.NativeSurface#getSurfaceHandle() handle} * or an intermediate layer to suite GL, e.g. an EGL surface. * </p> * <p> diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/GLDrawableFactory.java index 71568ee76..07c3e77e0 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/GLDrawableFactory.java @@ -38,7 +38,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package com.jogamp.opengl; import java.util.ArrayList; import java.util.List; @@ -48,21 +48,21 @@ import com.jogamp.common.util.ReflectionUtil; import com.jogamp.opengl.GLAutoDrawableDelegate; import com.jogamp.opengl.GLRendererQuirks; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; import jogamp.opengl.Debug; /** <p> Provides a virtual machine- and operating system-independent mechanism for creating {@link GLDrawable}s. </p> - <p> The {@link javax.media.opengl.GLCapabilities} objects passed + <p> The {@link com.jogamp.opengl.GLCapabilities} objects passed in to the various factory methods are used as a hint for the properties of the returned drawable. The default capabilities selection algorithm (equivalent to passing in a null {@link @@ -82,8 +82,8 @@ import jogamp.opengl.Debug; raising a {@link GLException}. The semantics of the rejection process are (unfortunately) left unspecified for now. The current implementation will cause a {@link GLException} to be raised - during the first repaint of the {@link javax.media.opengl.awt.GLCanvas} or {@link - javax.media.opengl.awt.GLJPanel} if the capabilities can not be met.<br> + during the first repaint of the {@link com.jogamp.opengl.awt.GLCanvas} or {@link + com.jogamp.opengl.awt.GLJPanel} if the capabilities can not be met.<br> {@link GLOffscreenAutoDrawable} are created lazily, see {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int) createOffscreenAutoDrawable(..)}. </p> @@ -144,7 +144,7 @@ public abstract class GLDrawableFactory { } } } - if (null != factoryClassName) { + if (null != factoryClassName && !GLProfile.disableOpenGLDesktop) { if (DEBUG || GLProfile.DEBUG) { System.err.println("GLDrawableFactory.static - Native OS Factory for: "+nwt+": "+factoryClassName); } @@ -387,13 +387,14 @@ public abstract class GLDrawableFactory { * </p> * * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. + * @param glp {@link GLProfile} to identify the device's {@link GLRendererQuirks}, maybe {@code null} * @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}. * @throws IllegalArgumentException if the quirk is out of range - * @see #getRendererQuirks(AbstractGraphicsDevice) + * @see #getRendererQuirks(AbstractGraphicsDevice, GLProfile) * @see GLRendererQuirks */ - public final boolean hasRendererQuirk(final AbstractGraphicsDevice device, final int quirk) { - final GLRendererQuirks glrq = getRendererQuirks(device); + public final boolean hasRendererQuirk(final AbstractGraphicsDevice device, final GLProfile glp, final int quirk) { + final GLRendererQuirks glrq = getRendererQuirks(device, glp); return null != glrq ? glrq.exist(quirk) : false; } @@ -407,10 +408,11 @@ public abstract class GLDrawableFactory { * the result is always <code>null</code>. * </p> * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. + * @param glp {@link GLProfile} to identify the device's {@link GLRendererQuirks}, maybe {@code null} * @see GLContext#getRendererQuirks() * @see GLRendererQuirks */ - public abstract GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device); + public abstract GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device, final GLProfile glp); /** * Returns the sole GLDrawableFactory instance for the desktop (X11, WGL, ..) if exist or null @@ -466,7 +468,7 @@ public abstract class GLDrawableFactory { * due to implementation constraints, ie using the shared resource. * * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. - * @return A list of {@link javax.media.opengl.GLCapabilitiesImmutable}'s, maybe empty if none is available. + * @return A list of {@link com.jogamp.opengl.GLCapabilitiesImmutable}'s, maybe empty if none is available. */ public final List<GLCapabilitiesImmutable> getAvailableCapabilities(AbstractGraphicsDevice device) { device = validateDevice(device); @@ -509,9 +511,9 @@ public abstract class GLDrawableFactory { * * @see #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) * @see GLContext#isFBOAvailable(AbstractGraphicsDevice, GLProfile) - * @see javax.media.opengl.GLCapabilities#isOnscreen() - * @see javax.media.opengl.GLCapabilities#isFBO() - * @see javax.media.opengl.GLCapabilities#isPBuffer() + * @see com.jogamp.opengl.GLCapabilities#isOnscreen() + * @see com.jogamp.opengl.GLCapabilities#isFBO() + * @see com.jogamp.opengl.GLCapabilities#isPBuffer() * @see GraphicsConfigurationFactory#chooseGraphicsConfiguration(CapabilitiesImmutable, CapabilitiesImmutable, CapabilitiesChooser, AbstractGraphicsScreen, int) */ public abstract GLDrawable createGLDrawable(NativeSurface target) @@ -587,7 +589,7 @@ public abstract class GLDrawableFactory { * @param deviceReq which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device. * @param createNewDevice if <code>true</code> a new independent device instance is created from the <code>deviceReq</code>, otherwise <code>deviceReq</code> is used as-is and must be valid! * @param capsRequested the desired {@link GLCapabilitiesImmutable}, incl. it's {@link GLProfile}. - * For shared context, same {@link GLCapabilitiesImmutable#getVisualID(javax.media.nativewindow.VisualIDHolder.VIDType)} + * For shared context, same {@link GLCapabilitiesImmutable#getVisualID(com.jogamp.nativewindow.VisualIDHolder.VIDType)} * across shared drawables will yield best compatibility. * @param chooser the custom chooser, may be null for default * @return the created and realized <i>dummy</i> {@link GLAutoDrawable} instance @@ -648,7 +650,7 @@ public abstract class GLDrawableFactory { * @param deviceReq which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device. * @param createNewDevice if <code>true</code> a new independent device instance is created from the <code>deviceReq</code>, otherwise <code>deviceReq</code> is used as-is and must be valid! * @param capsRequested the desired {@link GLCapabilitiesImmutable}, incl. it's {@link GLProfile}. - * For shared context, same {@link GLCapabilitiesImmutable#getVisualID(javax.media.nativewindow.VisualIDHolder.VIDType) visual ID} + * For shared context, same {@link GLCapabilitiesImmutable#getVisualID(com.jogamp.nativewindow.VisualIDHolder.VIDType) visual ID} * or {@link GLCapabilitiesImmutable caps} * across shared drawables will yield best compatibility. * @param chooser the custom chooser, may be null for default @@ -726,7 +728,7 @@ public abstract class GLDrawableFactory { * context in an external (third-party) OpenGL-based library. This * GLContext object may be used to draw into this preexisting * context using its {@link GL} and {@link - * javax.media.opengl.glu.GLU} objects. New contexts created through + * com.jogamp.opengl.glu.GLU} objects. New contexts created through * {@link GLDrawable}s may share textures and display lists with * this external context. </P> * diff --git a/src/jogl/classes/javax/media/opengl/GLEventListener.java b/src/jogl/classes/com/jogamp/opengl/GLEventListener.java index 995ca2620..8c5dfd3b3 100644 --- a/src/jogl/classes/javax/media/opengl/GLEventListener.java +++ b/src/jogl/classes/com/jogamp/opengl/GLEventListener.java @@ -37,7 +37,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package com.jogamp.opengl; import java.util.EventListener; diff --git a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java index bfd5fe115..8f0724b03 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java +++ b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java @@ -30,18 +30,18 @@ package com.jogamp.opengl; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.DefaultGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLRunnable; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.DefaultGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLRunnable; import jogamp.opengl.Debug; @@ -173,7 +173,7 @@ public class GLEventListenerState { * <p> * Locking is performed on the {@link GLAutoDrawable auto-drawable's} * {@link GLAutoDrawable#getUpstreamLock() upstream-lock} and {@link GLAutoDrawable#getNativeSurface() surface}. - * See <a href="../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li> + * See <a href="../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li> * </p> * * @param src {@link GLAutoDrawable} source to move components from @@ -203,7 +203,7 @@ public class GLEventListenerState { * Locking is performed on the {@link GLAutoDrawable auto-drawable's} * {@link GLAutoDrawable#getUpstreamLock() upstream-lock} and {@link GLAutoDrawable#getNativeSurface() surface}, * which is <i>not released</i> if <code>keepLocked</code> is <code>true</code>. - * See <a href="../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li> + * See <a href="../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li> * </p> * <p> * <code>keepLocked</code> may be utilized if swapping a context between drawables @@ -321,7 +321,7 @@ public class GLEventListenerState { * <p> * Locking is performed on the {@link GLAutoDrawable auto-drawable's} * {@link GLAutoDrawable#getUpstreamLock() upstream-lock} and {@link GLAutoDrawable#getNativeSurface() surface}. - * See <a href="../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li> + * See <a href="../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li> * </p> * <p> * Note: After this operation, the GLEventListenerState reference should be released. @@ -351,7 +351,7 @@ public class GLEventListenerState { * <p> * Locking is performed on the {@link GLAutoDrawable auto-drawable's} * {@link GLAutoDrawable#getUpstreamLock() upstream-lock} and {@link GLAutoDrawable#getNativeSurface() surface}. - * See <a href="../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li> + * See <a href="../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li> * </p> * <p> * If the {@link GLAutoDrawable} <code>dest</code> has been kept locked by {@link #moveFrom(GLAutoDrawable, boolean)}, diff --git a/src/jogl/classes/javax/media/opengl/GLException.java b/src/jogl/classes/com/jogamp/opengl/GLException.java index acf7cdec0..843934ab2 100644 --- a/src/jogl/classes/javax/media/opengl/GLException.java +++ b/src/jogl/classes/com/jogamp/opengl/GLException.java @@ -38,7 +38,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package com.jogamp.opengl; /** A generic exception for OpenGL errors used throughout the binding as a substitute for {@link RuntimeException}. */ diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/com/jogamp/opengl/GLFBODrawable.java index 524c77e9d..69358743e 100644 --- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/GLFBODrawable.java @@ -26,9 +26,9 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowException; import com.jogamp.opengl.FBObject; import com.jogamp.opengl.FBObject.Colorbuffer; diff --git a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java b/src/jogl/classes/com/jogamp/opengl/GLOffscreenAutoDrawable.java index 62d10d4cb..a2d0f5fdb 100644 --- a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/GLOffscreenAutoDrawable.java @@ -26,9 +26,9 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowException; import com.jogamp.opengl.FBObject; diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/com/jogamp/opengl/GLPipelineFactory.java index ab12ba17c..8d8b0428b 100644 --- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/GLPipelineFactory.java @@ -34,7 +34,7 @@ * facility. */ -package javax.media.opengl; +package com.jogamp.opengl; import java.lang.reflect.*; import java.util.StringTokenizer; @@ -57,13 +57,13 @@ public class GLPipelineFactory { * Sample code which installs a Debug and Trace pipeline * automatic w/ user defined interface, here: GL2ES2: * <pre> - * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, gl, null) ); - * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, gl, new Object[] { System.err } ) ); + * gl = drawable.setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES2.class, gl, null) ); + * gl = drawable.setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES2.class, gl, new Object[] { System.err } ) ); * </pre> * or automatic w/ automatic defined class: * <pre> - * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ); - * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ); + * gl = drawable.setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, gl, null) ); + * gl = drawable.setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, gl, new Object[] { System.err } ) ); * </pre> * </p> * diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/com/jogamp/opengl/GLProfile.java index c7aaca5d3..a36a21ad5 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/com/jogamp/opengl/GLProfile.java @@ -35,12 +35,13 @@ * facility. */ -package javax.media.opengl; +package com.jogamp.opengl; import jogamp.opengl.Debug; import jogamp.opengl.GLDrawableFactoryImpl; import jogamp.opengl.DesktopGLDynamicLookupHelper; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.GlueGenVersion; import com.jogamp.common.jvm.JNILibLoaderBase; import com.jogamp.common.os.Platform; @@ -52,11 +53,12 @@ import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveThreadGroupLock; import com.jogamp.gluegen.runtime.FunctionAddressResolver; import com.jogamp.nativewindow.NativeWindowVersion; +import com.jogamp.opengl.GLRendererQuirks; import com.jogamp.opengl.JoglVersion; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; import java.lang.reflect.Constructor; import java.security.AccessController; @@ -79,13 +81,6 @@ public class GLProfile { public static final boolean DEBUG; /** - * In case no OpenGL ES profiles are required - * and if one platform may have a buggy implementation, - * setting the property <code>jogl.disable.opengles</code> disables querying possible existing OpenGL ES profiles. - */ - public static final boolean disableOpenGLES; - - /** * In case no native OpenGL core profiles are required * and if one platform may have a buggy implementation, * setting the property <code>jogl.disable.openglcore</code> disables querying possible existing native OpenGL core profiles. @@ -100,12 +95,43 @@ public class GLProfile { * context creation extension is buggy on one platform, * setting the property <code>jogl.disable.openglarbcontext</code> disables utilizing it. * <p> + * This exclusion also disables {@link #disableOpenGLES OpenGL ES}. + * </p> + * <p> * This exclusion is disabled for {@link Platform.OSType#MACOS}. * </p> */ public static final boolean disableOpenGLARBContext; /** + * In case no OpenGL ES profiles are required + * and if one platform may have a buggy implementation, + * setting the property <code>jogl.disable.opengles</code> disables querying possible existing OpenGL ES profiles. + */ + public static final boolean disableOpenGLES; + + /** + * In case no OpenGL desktop profiles are required + * and if one platform may have a buggy implementation, + * setting the property <code>jogl.disable.opengldesktop</code> disables querying possible existing OpenGL desktop profiles. + */ + public static final boolean disableOpenGLDesktop; + + /** + * Disable surfaceless OpenGL context capability and its probing + * by setting the property <code>jogl.disable.surfacelesscontext</code>. + * <p> + * By default surfaceless OpenGL context capability is probed, + * i.e. whether an OpenGL context can be made current without a default framebuffer. + * </p> + * <p> + * If probing fails or if this property is set, the {@link GLRendererQuirks quirk} {@link GLRendererQuirks#NoSurfacelessCtx} + * is being set. + * </p> + */ + public static final boolean disableSurfacelessContext; + + /** * We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome. * When run in the mentioned browsers, the eglInitialize(..) implementation crashes. * <p> @@ -121,9 +147,11 @@ public class GLProfile { final boolean isOSX = Platform.OSType.MACOS == Platform.getOSType(); DEBUG = Debug.debug("GLProfile"); - disableOpenGLES = PropertyAccess.isPropertyDefined("jogl.disable.opengles", true); disableOpenGLCore = PropertyAccess.isPropertyDefined("jogl.disable.openglcore", true) && !isOSX; disableOpenGLARBContext = PropertyAccess.isPropertyDefined("jogl.disable.openglarbcontext", true) && !isOSX; + disableOpenGLES = disableOpenGLARBContext || PropertyAccess.isPropertyDefined("jogl.disable.opengles", true); + disableOpenGLDesktop = PropertyAccess.isPropertyDefined("jogl.disable.opengldesktop", true); + disableSurfacelessContext = PropertyAccess.isPropertyDefined("jogl.disable.surfacelesscontext", true); enableANGLE = PropertyAccess.isPropertyDefined("jogl.enable.ANGLE", true); } @@ -175,7 +203,7 @@ public class GLProfile { justInitialized = true; if(DEBUG) { System.err.println("GLProfile.initSingleton() - thread "+Thread.currentThread().getName()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if(ReflectionUtil.DEBUG_STATS_FORNAME) { @@ -233,7 +261,7 @@ public class GLProfile { /** * Manual shutdown method, may be called after your last JOGL use * within the running JVM.<br> - * It releases all temporary created resources, ie issues {@link javax.media.opengl.GLDrawableFactory#shutdown()}.<br> + * It releases all temporary created resources, ie issues {@link com.jogamp.opengl.GLDrawableFactory#shutdown()}.<br> * The shutdown implementation is called via the JVM shutdown hook, if not manually invoked.<br> * <p> * This method shall not need to be called for other reasons than issuing a proper shutdown of resources at a defined time. @@ -246,7 +274,7 @@ public class GLProfile { initialized = false; if(DEBUG) { System.err.println("GLProfile.shutdown() - thread "+Thread.currentThread().getName()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } GLDrawableFactory.shutdown(); } @@ -1047,7 +1075,7 @@ public class GLProfile { return usesNativeGLES2(profileImpl) || usesNativeGLES1(profileImpl); } - /** @return {@link javax.media.nativewindow.NativeWindowFactory#isAWTAvailable()} and + /** @return {@link com.jogamp.nativewindow.NativeWindowFactory#isAWTAvailable()} and JOGL's AWT part */ public static boolean isAWTAvailable() { return isAWTAvailable; } @@ -1065,17 +1093,17 @@ public class GLProfile { return "GL_FLOAT"; case GL.GL_FIXED: return "GL_FIXED"; - case javax.media.opengl.GL2ES2.GL_INT: + case com.jogamp.opengl.GL2ES2.GL_INT: return "GL_INT"; case GL.GL_UNSIGNED_INT: return "GL_UNSIGNED_INT"; - case javax.media.opengl.GL2GL3.GL_DOUBLE: + case com.jogamp.opengl.GL2GL3.GL_DOUBLE: return "GL_DOUBLE"; - case javax.media.opengl.GL2.GL_2_BYTES: + case com.jogamp.opengl.GL2.GL_2_BYTES: return "GL_2_BYTES"; - case javax.media.opengl.GL2.GL_3_BYTES: + case com.jogamp.opengl.GL2.GL_3_BYTES: return "GL_3_BYTES"; - case javax.media.opengl.GL2.GL_4_BYTES: + case com.jogamp.opengl.GL2.GL_4_BYTES: return "GL_4_BYTES"; } return null; @@ -1305,18 +1333,18 @@ public class GLProfile { case GL.GL_FLOAT: case GL.GL_FIXED: return true; - case javax.media.opengl.GL2ES2.GL_INT: + case com.jogamp.opengl.GL2ES2.GL_INT: case GL.GL_UNSIGNED_INT: if( isGL2ES2() ) { return true; } - case javax.media.opengl.GL2GL3.GL_DOUBLE: + case com.jogamp.opengl.GL2GL3.GL_DOUBLE: if( isGL3() ) { return true; } - case javax.media.opengl.GL2.GL_2_BYTES: - case javax.media.opengl.GL2.GL_3_BYTES: - case javax.media.opengl.GL2.GL_4_BYTES: + case com.jogamp.opengl.GL2.GL_2_BYTES: + case com.jogamp.opengl.GL2.GL_3_BYTES: + case com.jogamp.opengl.GL2.GL_4_BYTES: if( isGL2() ) { return true; } @@ -1451,9 +1479,9 @@ public class GLProfile { case GL.GL_UNSIGNED_SHORT: case GL.GL_SHORT: case GL.GL_FLOAT: - case javax.media.opengl.GL2ES2.GL_INT: + case com.jogamp.opengl.GL2ES2.GL_INT: case GL.GL_UNSIGNED_INT: - case javax.media.opengl.GL2GL3.GL_DOUBLE: + case com.jogamp.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1480,8 +1508,8 @@ public class GLProfile { switch(type) { case GL.GL_SHORT: case GL.GL_FLOAT: - case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2GL3.GL_DOUBLE: + case com.jogamp.opengl.GL2ES2.GL_INT: + case com.jogamp.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1507,8 +1535,8 @@ public class GLProfile { case GL.GL_BYTE: case GL.GL_SHORT: case GL.GL_FLOAT: - case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2GL3.GL_DOUBLE: + case com.jogamp.opengl.GL2ES2.GL_INT: + case com.jogamp.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1534,9 +1562,9 @@ public class GLProfile { case GL.GL_UNSIGNED_SHORT: case GL.GL_SHORT: case GL.GL_FLOAT: - case javax.media.opengl.GL2ES2.GL_INT: + case com.jogamp.opengl.GL2ES2.GL_INT: case GL.GL_UNSIGNED_INT: - case javax.media.opengl.GL2GL3.GL_DOUBLE: + case com.jogamp.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1560,8 +1588,8 @@ public class GLProfile { switch(type) { case GL.GL_SHORT: case GL.GL_FLOAT: - case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2GL3.GL_DOUBLE: + case com.jogamp.opengl.GL2ES2.GL_INT: + case com.jogamp.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1699,7 +1727,7 @@ public class GLProfile { final ClassLoader classloader = GLProfile.class.getClassLoader(); isAWTAvailable = NativeWindowFactory.isAWTAvailable() && - ReflectionUtil.isClassAvailable("javax.media.opengl.awt.GLCanvas", classloader) ; // JOGL + ReflectionUtil.isClassAvailable("com.jogamp.opengl.awt.GLCanvas", classloader) ; // JOGL initGLCtorImpl(); @@ -1717,7 +1745,7 @@ public class GLProfile { try { desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getFactoryImpl(GL2); if(null != desktopFactory) { - final DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(0); + final DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(GL2); if(null!=glLookupHelper) { hasDesktopGLFactory = glLookupHelper.isLibComplete() && hasGL234Impl; } @@ -1754,8 +1782,8 @@ public class GLProfile { if(null != eglFactory) { hasEGLFactory = true; // update hasGLES1Impl, hasGLES3Impl based on EGL - hasGLES3Impl = null!=eglFactory.getGLDynamicLookupHelper(2) && hasGLES3Impl; - hasGLES1Impl = null!=eglFactory.getGLDynamicLookupHelper(1) && hasGLES1Impl; + hasGLES3Impl = null!=eglFactory.getGLDynamicLookupHelper(GLES2) && hasGLES3Impl; + hasGLES1Impl = null!=eglFactory.getGLDynamicLookupHelper(GLES1) && hasGLES1Impl; } } catch (final LinkageError le) { t=le; @@ -1894,7 +1922,7 @@ public class GLProfile { // also test GLES1, GLES2 and GLES3 on desktop, since we have implementations / emulations available. if( deviceIsEGLCompatible && ( hasGLES3Impl || hasGLES1Impl ) ) { // 1st pretend we have all EGL profiles .. - computeProfileMap(device, false /* desktopCtxUndef*/, true /* esCtxUndef */); + computeProfileMap(device, true /* desktopCtxUndef*/, true /* esCtxUndef */); // Triggers eager initialization of share context in GLDrawableFactory for the device, // hence querying all available GLProfiles @@ -1933,9 +1961,7 @@ public class GLProfile { } } - if(!GLContext.getAvailableGLVersionsSet(device)) { - GLContext.setAvailableGLVersionsSet(device); - } + GLContext.setAvailableGLVersionsSet(device, true); if (DEBUG) { System.err.println("GLProfile.initProfilesForDevice: "+device.getConnection()+": added profile(s): desktop "+addedDesktopProfile+", egl "+addedEGLProfile); diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java index e4cd5c5d9..55c02d92a 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java @@ -29,13 +29,12 @@ package com.jogamp.opengl; import java.util.IdentityHashMap; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.opengl.GLCapabilitiesImmutable; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.opengl.GLCapabilitiesImmutable; import com.jogamp.common.os.Platform; - -import jogamp.opengl.egl.EGL; -import jogamp.opengl.egl.EGLExt; +import com.jogamp.opengl.egl.EGL; +import com.jogamp.opengl.egl.EGLExt; /** * GLRendererQuirks contains information of known bugs of various GL renderer. @@ -348,7 +347,7 @@ public class GLRendererQuirks { * Some drivers wrongly claim to support pbuffers * with accumulation buffers. However, the creation of such pbuffer fails: * <pre> - * javax.media.opengl.GLException: pbuffer creation error: Couldn't find a suitable pixel format + * com.jogamp.opengl.GLException: pbuffer creation error: Couldn't find a suitable pixel format * </pre> * </p> * <p> @@ -402,7 +401,7 @@ public class GLRendererQuirks { * Some drivers wrongly claim to support ARB_create_context. * However, the creation of such context fails: * <pre> - * javax.media.opengl.GLException: AWT-EventQueue-0: WindowsWGLContex.createContextImpl ctx !ARB, profile > GL2 + * com.jogamp.opengl.GLException: AWT-EventQueue-0: WindowsWGLContex.createContextImpl ctx !ARB, profile > GL2 * requested (OpenGL >= 3.0.1). Requested: GLProfile[GL3bc/GL3bc.hw], current: 2.1 (Compat profile, FBO, hardware) * - 2.1.8787 * </pre> @@ -419,8 +418,36 @@ public class GLRendererQuirks { */ public static final int NoARBCreateContext = 21; + /** + * No support for ES or desktop GL >= 3.0 current context without surface, + * i.e. without a default framebuffer as read- and write drawables. + * <p> + * See <i>OpenGL spec 3.0, chapter 2.1 OpenGL Fundamentals, page 7</i> or<br> + * <i>OpenGL ES spec 3.0.2, chapter 2.1 OpenGL Fundamentals, page 6</i>: + * <pre> + * It is possible to use a GL context without a default framebuffer, in which case + * a framebuffer object must be used to perform all rendering. This is useful for + * applications neeting to perform offscreen rendering. + * </pre> + * </p> + * <p> + * The feature will be attempted at initialization and this quirk will be set if failing. + * </p> + * <p> + * Known drivers failing the specification: + * <ul> + * <li>GNU/Linux X11 Nvidia proprietary driver + * <ul> + * <li>GL_VERSION 4.4.0 NVIDIA 340.24</li> + * <li>Platform GNU/Linux X11</li> + * </ul></li> + * </ul> + * </p> + */ + public static final int NoSurfacelessCtx = 22; + /** Return the number of known quirks. */ - public static final int getCount() { return 22; } + public static final int getCount() { return 23; } private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval", "NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard", @@ -429,7 +456,7 @@ public class GLRendererQuirks { "NoFullFBOSupport", "GLSLNonCompliant", "GL4NeedsGL3Request", "GLSharedContextBuggy", "GLES3ViaEGLES2Config", "SingletonEGLDisplayOnly", "NoMultiSamplingBuffers", "BuggyColorRenderbuffer", "NoPBufferWithAccum", - "NeedSharedObjectSync", "NoARBCreateContext" + "NeedSharedObjectSync", "NoARBCreateContext", "NoSurfacelessCtx" }; private static final IdentityHashMap<String, GLRendererQuirks> stickyDeviceQuirks = new IdentityHashMap<String, GLRendererQuirks>(); diff --git a/src/jogl/classes/javax/media/opengl/GLRunnable.java b/src/jogl/classes/com/jogamp/opengl/GLRunnable.java index ad68662ce..97a72d6cd 100644 --- a/src/jogl/classes/javax/media/opengl/GLRunnable.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRunnable.java @@ -26,12 +26,12 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; /** * <p> * Declares a one-shot OpenGL command usable for injection - * via {@link GLAutoDrawable#invoke(boolean, javax.media.opengl.GLRunnable)}.<br> + * via {@link GLAutoDrawable#invoke(boolean, com.jogamp.opengl.GLRunnable)}.<br> * {@link GLAutoDrawable} executes the GLRunnables within it's {@link GLAutoDrawable#display() display()} * method after all registered {@link GLEventListener}s * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)} diff --git a/src/jogl/classes/javax/media/opengl/GLRunnable2.java b/src/jogl/classes/com/jogamp/opengl/GLRunnable2.java index 5f0393257..4b0c63da0 100644 --- a/src/jogl/classes/javax/media/opengl/GLRunnable2.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRunnable2.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; /** * <p> diff --git a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java b/src/jogl/classes/com/jogamp/opengl/GLSharedContextSetter.java index b8aef126b..852ebcaa7 100644 --- a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java +++ b/src/jogl/classes/com/jogamp/opengl/GLSharedContextSetter.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl; +package com.jogamp.opengl; import com.jogamp.opengl.GLRendererQuirks; @@ -45,7 +45,7 @@ import com.jogamp.opengl.GLRendererQuirks; * i.e. the <i>slave</i> {@link GLAutoDrawable} will not be realized before their associated <i>master</i>. * </p> * <p> - * Using the nearest or same {@link GLCapabilitiesImmutable#getVisualID(javax.media.nativewindow.VisualIDHolder.VIDType) visual ID} + * Using the nearest or same {@link GLCapabilitiesImmutable#getVisualID(com.jogamp.nativewindow.VisualIDHolder.VIDType) visual ID} * or {@link GLCapabilitiesImmutable caps} across the shared {@link GLDrawable}s will yield best compatibility. * </p> * <h5><a name="lifecycle">Lifecycle Considerations</a></h5> @@ -70,7 +70,7 @@ import com.jogamp.opengl.GLRendererQuirks; * <i>or</i> the <i>slaves</i> validate whether the resources are still valid. * </p> * <p> - * To simplify above lifecycle issues, one may use a {@link GLDrawableFactory#createDummyDrawable(javax.media.nativewindow.AbstractGraphicsDevice, boolean, GLCapabilitiesImmutable, GLCapabilitiesChooser) dummy} + * To simplify above lifecycle issues, one may use a {@link GLDrawableFactory#createDummyDrawable(com.jogamp.nativewindow.AbstractGraphicsDevice, boolean, GLCapabilitiesImmutable, GLCapabilitiesChooser) dummy} * {@link GLDrawable} and it's {@link GLContext} as the <i>master</i> of all shared <i>slave</i> {@link GLContext}. * Since this <i>dummy instance</i> does not depend on any native windowing system, it can be controlled easily w/o being <i>in sight</i>.<br> * Below code creates a {@link GLAutoDrawable} based on a <i>dummy GLDrawable</i>: diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/com/jogamp/opengl/GLUniformData.java index 47f07539b..44f7f29c7 100644 --- a/src/jogl/classes/javax/media/opengl/GLUniformData.java +++ b/src/jogl/classes/com/jogamp/opengl/GLUniformData.java @@ -1,5 +1,5 @@ -package javax.media.opengl; +package com.jogamp.opengl; import java.nio.*; diff --git a/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java b/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java index 3693f647a..46971d168 100644 --- a/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java +++ b/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java @@ -29,8 +29,8 @@ package com.jogamp.opengl; import java.util.List; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.opengl.DefaultGLCapabilitiesChooser; /** * Ignores windowSystemRecommendedChoice parameter, diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java index 8d6765036..5070f3e4e 100644 --- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java +++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java @@ -29,7 +29,7 @@ package com.jogamp.opengl; import com.jogamp.common.GlueGenVersion; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionUtil; @@ -37,7 +37,7 @@ import com.jogamp.common.util.JogampVersion; import java.util.List; import java.util.jar.Manifest; -import javax.media.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsDevice; public class JoglVersion extends JogampVersion { @@ -51,7 +51,7 @@ public class JoglVersion extends JogampVersion { if(null == jogampCommonVersionInfo) { // volatile: ok synchronized(JoglVersion.class) { if( null == jogampCommonVersionInfo ) { - final String packageName = "javax.media.opengl"; + final String packageName = "com.jogamp.opengl"; final Manifest mf = VersionUtil.getManifest(JoglVersion.class.getClassLoader(), packageName); jogampCommonVersionInfo = new JoglVersion(packageName, mf); } diff --git a/src/jogl/classes/javax/media/opengl/Threading.java b/src/jogl/classes/com/jogamp/opengl/Threading.java index c8d8d0071..852c8081f 100644 --- a/src/jogl/classes/javax/media/opengl/Threading.java +++ b/src/jogl/classes/com/jogamp/opengl/Threading.java @@ -38,7 +38,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl; +package com.jogamp.opengl; import jogamp.opengl.ThreadingImpl; @@ -147,7 +147,7 @@ public class Threading { return ThreadingImpl.getMode(); } - /** If an implementation of the javax.media.opengl APIs offers a + /** If an implementation of the com.jogamp.opengl APIs offers a multithreading option but the default behavior is single-threading, this API provides a mechanism for end users to disable single-threading in this implementation. Users are strongly discouraged from @@ -189,7 +189,7 @@ public class Threading { } /** Executes the passed Runnable on the single thread used for all - OpenGL work in this javax.media.opengl API implementation. It is + OpenGL work in this com.jogamp.opengl API implementation. It is not specified exactly which thread is used for this purpose. This method should only be called if the single-thread model is in use and if the current thread is not the OpenGL diff --git a/src/jogl/classes/javax/media/opengl/TraceGL2.java b/src/jogl/classes/com/jogamp/opengl/TraceGL2.java index 94d391d43..1609398e7 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL2.java +++ b/src/jogl/classes/com/jogamp/opengl/TraceGL2.java @@ -1,4 +1,4 @@ -package javax.media.opengl; +package com.jogamp.opengl; import java.io.PrintStream; diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3.java b/src/jogl/classes/com/jogamp/opengl/TraceGL3.java index 96e655902..fd95d6392 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL3.java +++ b/src/jogl/classes/com/jogamp/opengl/TraceGL3.java @@ -1,4 +1,4 @@ -package javax.media.opengl; +package com.jogamp.opengl; import java.io.PrintStream; diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java b/src/jogl/classes/com/jogamp/opengl/TraceGL3bc.java index 2a8590236..7daa9e392 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java +++ b/src/jogl/classes/com/jogamp/opengl/TraceGL3bc.java @@ -1,4 +1,4 @@ -package javax.media.opengl; +package com.jogamp.opengl; import java.io.PrintStream; diff --git a/src/jogl/classes/javax/media/opengl/TraceGL4.java b/src/jogl/classes/com/jogamp/opengl/TraceGL4.java index d48f9926a..b0c817105 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL4.java +++ b/src/jogl/classes/com/jogamp/opengl/TraceGL4.java @@ -1,4 +1,4 @@ -package javax.media.opengl; +package com.jogamp.opengl; import java.io.PrintStream; diff --git a/src/jogl/classes/javax/media/opengl/TraceGLES2.java b/src/jogl/classes/com/jogamp/opengl/TraceGLES2.java index b58f169a7..7c7956b68 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGLES2.java +++ b/src/jogl/classes/com/jogamp/opengl/TraceGLES2.java @@ -1,4 +1,4 @@ -package javax.media.opengl; +package com.jogamp.opengl; import java.io.PrintStream; diff --git a/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java b/src/jogl/classes/com/jogamp/opengl/awt/AWTGLAutoDrawable.java index 2698678af..6e273e4e6 100644 --- a/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/awt/AWTGLAutoDrawable.java @@ -37,9 +37,9 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl.awt; +package com.jogamp.opengl.awt; -import javax.media.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLAutoDrawable; public interface AWTGLAutoDrawable extends GLAutoDrawable, ComponentEvents { /** Requests a new width and height for this AWTGLAutoDrawable. */ diff --git a/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java b/src/jogl/classes/com/jogamp/opengl/awt/ComponentEvents.java index 5feaa5760..996776c9b 100644 --- a/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java +++ b/src/jogl/classes/com/jogamp/opengl/awt/ComponentEvents.java @@ -37,9 +37,9 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl.awt; +package com.jogamp.opengl.awt; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import java.awt.event.*; import java.beans.PropertyChangeListener; diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java index a648e3bf6..11d217535 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java @@ -38,7 +38,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl.awt; +package com.jogamp.opengl.awt; import java.beans.Beans; import java.lang.reflect.Method; @@ -61,32 +61,32 @@ import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.OffscreenLayerOption; -import javax.media.nativewindow.ScalableSurface; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.WindowClosingProtocol; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GL; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.GLSharedContextSetter; -import javax.media.opengl.Threading; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.OffscreenLayerOption; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.WindowClosingProtocol; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.GLSharedContextSetter; +import com.jogamp.opengl.Threading; import com.jogamp.common.GlueGenVersion; import com.jogamp.common.util.VersionUtil; @@ -178,9 +178,10 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private volatile JAWTWindow jawtWindow; // the JAWTWindow presentation of this AWT Canvas, bound to the 'drawable' lifecycle private volatile GLContextImpl context; // volatile: avoid locking for read-only access private volatile boolean sendReshape = false; // volatile: maybe written by EDT w/o locking - private final int[] nativePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; - private final int[] hasPixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; - final int[] reqPixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + private final float[] minPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + private final float[] maxPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + private final float[] hasPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + final float[] reqPixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; // copy of the cstr args, mainly for recreation private final GLCapabilitiesImmutable capsReqUser; @@ -224,7 +225,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing See details about <a href="#contextSharing">OpenGL context sharing</a>. </p> * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. - * @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice) + * @see GLCanvas#GLCanvas(com.jogamp.opengl.GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesChooser, com.jogamp.opengl.GLContext, java.awt.GraphicsDevice) */ public GLCanvas(final GLCapabilitiesImmutable capsReqUser) throws GLException { this(capsReqUser, null, null); @@ -642,38 +643,73 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setSurfaceScale(final int[] pixelScale) { - SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG ? getClass().getSimpleName() : null); - if( isRealized() ) { - final ScalableSurface ns = jawtWindow; - if( null != ns ) { - ns.setSurfaceScale(reqPixelScale); - final int hadPixelScaleX = hasPixelScale[0]; - final int hadPixelScaleY = hasPixelScale[1]; - ns.getCurrentSurfaceScale(hasPixelScale); - if( hadPixelScaleX != hasPixelScale[0] || hadPixelScaleY != hasPixelScale[1] ) { - reshapeImpl(getWidth(), getHeight()); - display(); - } - } + public final boolean setSurfaceScale(final float[] pixelScale) { + System.arraycopy(pixelScale, 0, reqPixelScale, 0, 2); + if( isRealized() && isShowing ) { + Threading.invoke(true, setSurfaceScaleOnEDTAction, getTreeLock()); + return true; + } else { + return false; + } + } + private final Runnable setSurfaceScaleOnEDTAction = new Runnable() { + @Override + public void run() { + final RecursiveLock _lock = lock; + _lock.lock(); + try { + if( null != drawable && drawable.isRealized() ) { + if( setSurfaceScaleImpl(jawtWindow) ) { + reshapeImpl(getWidth(), getHeight()); + if( !helper.isAnimatorAnimatingOnOtherThread() ) { + helper.invokeGL(drawable, context, displayAction, initAction); // display + } + } + } + } finally { + _lock.unlock(); + } + } }; + private final boolean setSurfaceScaleImpl(final ScalableSurface ns) { + if( ns.setSurfaceScale(reqPixelScale) ) { + ns.getCurrentSurfaceScale(hasPixelScale); + return true; + } else { + return false; + } + } + + private final boolean updatePixelScale() { + if( jawtWindow.hasPixelScaleChanged() ) { + jawtWindow.getMaximumSurfaceScale(maxPixelScale); + jawtWindow.getMinimumSurfaceScale(minPixelScale); + return setSurfaceScaleImpl(jawtWindow); + } else { + return false; } } @Override - public final int[] getRequestedSurfaceScale(final int[] result) { + public final float[] getRequestedSurfaceScale(final float[] result) { System.arraycopy(reqPixelScale, 0, result, 0, 2); return result; } @Override - public final int[] getCurrentSurfaceScale(final int[] result) { + public final float[] getCurrentSurfaceScale(final float[] result) { System.arraycopy(hasPixelScale, 0, result, 0, 2); return result; } @Override - public int[] getNativeSurfaceScale(final int[] result) { - System.arraycopy(nativePixelScale, 0, result, 0, 2); + public float[] getMinimumSurfaceScale(final float[] result) { + System.arraycopy(minPixelScale, 0, result, 0, 2); + return result; + } + + @Override + public float[] getMaximumSurfaceScale(final float[] result) { + System.arraycopy(maxPixelScale, 0, result, 0, 2); return result; } @@ -681,13 +717,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if ( !Beans.isDesignTime() ) { jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig); jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer); - jawtWindow.setSurfaceScale(reqPixelScale); jawtWindow.lockSurface(); try { + jawtWindow.setSurfaceScale(reqPixelScale); drawable = (GLDrawableImpl) GLDrawableFactory.getFactory(capsReqUser.getGLProfile()).createGLDrawable(jawtWindow); createContextImpl(drawable); jawtWindow.getCurrentSurfaceScale(hasPixelScale); - jawtWindow.getNativeSurfaceScale(nativePixelScale); + jawtWindow.getMinimumSurfaceScale(minPixelScale); + jawtWindow.getMaximumSurfaceScale(maxPixelScale); } finally { jawtWindow.unlockSurface(); } @@ -785,10 +822,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing reshapeImpl(width, height); } } - private void reshapeImpl(final int width, final int height) { - final int scaledWidth = width * hasPixelScale[0]; - final int scaledHeight = height * hasPixelScale[1]; + final int scaledWidth = SurfaceScaleUtils.scale(width, hasPixelScale[0]); + final int scaledHeight = SurfaceScaleUtils.scale(height, hasPixelScale[1]); if(DEBUG) { final NativeSurface ns = getNativeSurface(); @@ -1187,12 +1223,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing @Override public int getSurfaceWidth() { - return getWidth() * hasPixelScale[0]; + return SurfaceScaleUtils.scale(getWidth(), hasPixelScale[0]); } @Override public int getSurfaceHeight() { - return getHeight() * hasPixelScale[1]; + return SurfaceScaleUtils.scale(getHeight(), hasPixelScale[1]); } @Override @@ -1239,7 +1275,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing // Internals only below this point // - private final String getPixelScaleStr() { return hasPixelScale[0]+"x"+hasPixelScale[1]; } + private final String getPixelScaleStr() { return "["+hasPixelScale[0]+", "+hasPixelScale[1]+"]"; } private final Runnable destroyOnEDTAction = new Runnable() { @Override @@ -1322,7 +1358,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * The drawable and context handle are null'ed as well, assuming {@link #destroy()} has been called already. * </p> * - * @see #chooseGraphicsConfiguration(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, java.awt.GraphicsDevice) + * @see #chooseGraphicsConfiguration(com.jogamp.opengl.GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesChooser, java.awt.GraphicsDevice) */ private final Runnable disposeJAWTWindowAndAWTDeviceOnEDT = new Runnable() { @Override @@ -1339,8 +1375,10 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; - nativePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; - nativePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; + minPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; + minPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; + maxPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; + maxPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; if(null != awtConfig) { final AbstractGraphicsConfiguration aconfig = awtConfig.getNativeGraphicsConfiguration(); @@ -1391,6 +1429,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing _lock.lock(); try { if( null != drawable && drawable.isRealized() ) { + if( GLCanvas.this.updatePixelScale() ) { + GLCanvas.this.reshapeImpl(getWidth(), getHeight()); + } helper.invokeGL(drawable, context, displayAction, initAction); } } finally { diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/com/jogamp/opengl/awt/GLJPanel.java index 8d23d79ff..91b2f5e0c 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/com/jogamp/opengl/awt/GLJPanel.java @@ -38,7 +38,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.opengl.awt; +package com.jogamp.opengl.awt; import java.awt.Color; import java.awt.EventQueue; @@ -58,31 +58,32 @@ import java.beans.Beans; import java.nio.IntBuffer; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ScalableSurface; -import javax.media.nativewindow.SurfaceUpdatedListener; -import javax.media.nativewindow.WindowClosingProtocol; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLFBODrawable; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.GLSharedContextSetter; -import javax.media.opengl.Threading; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.SurfaceUpdatedListener; +import com.jogamp.nativewindow.WindowClosingProtocol; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLFBODrawable; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.GLSharedContextSetter; +import com.jogamp.opengl.Threading; import javax.swing.JPanel; import jogamp.nativewindow.SurfaceScaleUtils; @@ -261,16 +262,19 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private boolean handleReshape = false; private boolean sendReshape = true; - private final int[] nativePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; - private final int[] hasPixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; - private final int[] reqPixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + private final float[] minPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + private final float[] maxPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + private final float[] hasPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + private final float[] reqPixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; - // For handling reshape events lazily: reshapeWidth -> panelWidth -> backend.width + /** For handling reshape events lazily: reshapeWidth -> panelWidth -> backend.width in pixel units (scaled) */ private int reshapeWidth; + /** For handling reshape events lazily: reshapeHeight -> panelHeight -> backend.height in pixel units (scaled) */ private int reshapeHeight; - // Width of the actual GLJPanel: reshapeWidth -> panelWidth -> backend.width + /** Scaled pixel width of the actual GLJPanel: reshapeWidth -> panelWidth -> backend.width */ private int panelWidth = 0; + /** Scaled pixel height of the actual GLJPanel: reshapeHeight -> panelHeight -> backend.height */ private int panelHeight = 0; // These are always set to (0, 0) except when the Java2D / OpenGL @@ -447,20 +451,20 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing @Override public void display() { - if( isShowing || ( printActive && isVisible() ) ) { - if (EventQueue.isDispatchThread()) { - // Want display() to be synchronous, so call paintImmediately() - paintImmediately(0, 0, getWidth(), getHeight()); - } else { - // Multithreaded redrawing of Swing components is not allowed, - // so do everything on the event dispatch thread - try { - EventQueue.invokeAndWait(paintImmediatelyAction); - } catch (final Exception e) { - throw new GLException(e); + if( isShowing || ( printActive && isVisible() ) ) { + if (EventQueue.isDispatchThread()) { + // Want display() to be synchronous, so call paintImmediately() + paintImmediatelyAction.run(); + } else { + // Multithreaded redrawing of Swing components is not allowed, + // so do everything on the event dispatch thread + try { + EventQueue.invokeAndWait(paintImmediatelyAction); + } catch (final Exception e) { + throw new GLException(e); + } } - } - } + } } protected void dispose(final Runnable post) { @@ -553,6 +557,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // re-creating it -- tricky to do properly while the context is // current if( !printActive ) { + updatePixelScale(backend); if ( handleReshape ) { handleReshape = false; sendReshape = handleReshape(); @@ -576,36 +581,76 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setSurfaceScale(final int[] pixelScale) { // HiDPI support - SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG ? getClass().getSimpleName() : null); + public final boolean setSurfaceScale(final float[] pixelScale) { // HiDPI support + System.arraycopy(pixelScale, 0, reqPixelScale, 0, 2); final Backend b = backend; - if ( isInitialized && null != b ) { - final int hadPixelScaleX = hasPixelScale[0]; - final int hadPixelScaleY = hasPixelScale[1]; - SurfaceScaleUtils.computePixelScale(hasPixelScale, hasPixelScale, reqPixelScale, nativePixelScale, DEBUG ? getClass().getSimpleName() : null); - if( hadPixelScaleX != hasPixelScale[0] || hadPixelScaleY != hasPixelScale[1] ) { - updateWrappedSurfaceScale(b.getDrawable()); - reshapeImpl(getWidth(), getHeight()); - display(); + if ( isInitialized && null != b && isShowing ) { + if( isShowing || ( printActive && isVisible() ) ) { + if (EventQueue.isDispatchThread()) { + setSurfaceScaleAction.run(); + } else { + try { + EventQueue.invokeAndWait(setSurfaceScaleAction); + } catch (final Exception e) { + throw new GLException(e); + } + } } + return true; + } else { + return false; + } + } + private final Runnable setSurfaceScaleAction = new Runnable() { + @Override + public void run() { + final Backend b = backend; + if( null != b && setSurfaceScaleImpl(b) ) { + if( !helper.isAnimatorAnimatingOnOtherThread() ) { + paintImmediatelyAction.run(); // display + } + } + } + }; + + private final boolean setSurfaceScaleImpl(final Backend b) { + if( SurfaceScaleUtils.setNewPixelScale(hasPixelScale, hasPixelScale, reqPixelScale, minPixelScale, maxPixelScale, DEBUG ? getClass().getSimpleName() : null) ) { + reshapeImpl(getWidth(), getHeight()); + updateWrappedSurfaceScale(b.getDrawable()); + return true; + } + return false; + } + + private final boolean updatePixelScale(final Backend b) { + if( JAWTUtil.getPixelScale(getGraphicsConfiguration(), minPixelScale, maxPixelScale) ) { + return setSurfaceScaleImpl(b); + } else { + return false; } } @Override - public final int[] getRequestedSurfaceScale(final int[] result) { + public final float[] getRequestedSurfaceScale(final float[] result) { System.arraycopy(reqPixelScale, 0, result, 0, 2); return result; } @Override - public final int[] getCurrentSurfaceScale(final int[] result) { + public final float[] getCurrentSurfaceScale(final float[] result) { System.arraycopy(hasPixelScale, 0, result, 0, 2); return result; } @Override - public int[] getNativeSurfaceScale(final int[] result) { - System.arraycopy(nativePixelScale, 0, result, 0, 2); + public float[] getMinimumSurfaceScale(final float[] result) { + System.arraycopy(minPixelScale, 0, result, 0, 2); + return result; + } + + @Override + public float[] getMaximumSurfaceScale(final float[] result) { + System.arraycopy(maxPixelScale, 0, result, 0, 2); return result; } @@ -621,12 +666,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing awtWindowClosingProtocol.addClosingListener(); // HiDPI support - { - final int ps = JAWTUtil.getPixelScale(getGraphicsConfiguration()); - nativePixelScale[0] = ps; - nativePixelScale[1] = ps; - } - SurfaceScaleUtils.computePixelScale(hasPixelScale, hasPixelScale, reqPixelScale, nativePixelScale, DEBUG ? getClass().getSimpleName() : null); + JAWTUtil.getPixelScale(getGraphicsConfiguration(), minPixelScale, maxPixelScale); + SurfaceScaleUtils.setNewPixelScale(hasPixelScale, hasPixelScale, reqPixelScale, minPixelScale, maxPixelScale, DEBUG ? getClass().getSimpleName() : null); if (DEBUG) { System.err.println(getThreadName()+": GLJPanel.addNotify()"); @@ -646,8 +687,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing dispose(null); hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; - nativePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; - nativePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; + minPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; + minPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; + maxPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; + maxPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; super.removeNotify(); } @@ -667,8 +710,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } private void reshapeImpl(final int width, final int height) { - final int scaledWidth = width * hasPixelScale[0]; - final int scaledHeight = height * hasPixelScale[1]; + final int scaledWidth = SurfaceScaleUtils.scale(width, hasPixelScale[0]); + final int scaledHeight = SurfaceScaleUtils.scale(height, hasPixelScale[1]); if( !printActive && ( handleReshape || scaledWidth != panelWidth || scaledHeight != panelHeight ) ) { reshapeWidth = scaledWidth; reshapeHeight = scaledHeight; @@ -823,8 +866,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // trigger reshape, i.e. gl-viewport and -listener - this component might got resized! final int awtWidth = GLJPanel.this.getWidth(); final int awtHeight= GLJPanel.this.getHeight(); - final int scaledAWTWidth = awtWidth * hasPixelScale[0]; - final int scaledAWTHeight= awtHeight * hasPixelScale[1]; + final int scaledAWTWidth = SurfaceScaleUtils.scale(awtWidth, hasPixelScale[0]); + final int scaledAWTHeight= SurfaceScaleUtils.scale(awtHeight, hasPixelScale[1]); final GLDrawable drawable = GLJPanel.this.getDelegatedDrawable(); if( scaledAWTWidth != panelWidth || scaledAWTHeight != panelHeight || drawable.getSurfaceWidth() != panelWidth || drawable.getSurfaceHeight() != panelHeight ) { @@ -1339,7 +1382,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } - private final String getPixelScaleStr() { return hasPixelScale[0]+"x"+hasPixelScale[1]; } + private final String getPixelScaleStr() { return "["+hasPixelScale[0]+", "+hasPixelScale[1]+"]"; } @Override public WindowClosingMode getDefaultCloseOperation() { @@ -1882,27 +1925,36 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing alignment = 4; } - final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, componentCount); + final PixelFormat awtPixelFormat = pixelBufferProvider.getAWTPixelFormat(gl.getGLProfile(), componentCount); + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, componentCount, true); if( useSingletonBuffer ) { // attempt to fetch the latest AWTGLPixelBuffer - pixelBuffer = (AWTGLPixelBuffer) ((SingletonGLPixelBufferProvider)pixelBufferProvider).getSingleBuffer(pixelAttribs); + pixelBuffer = (AWTGLPixelBuffer) ((SingletonGLPixelBufferProvider)pixelBufferProvider).getSingleBuffer(awtPixelFormat.comp, pixelAttribs, true); } if( null != pixelBuffer && pixelBuffer.requiresNewBuffer(gl, panelWidth, panelHeight, 0) ) { pixelBuffer.dispose(); pixelBuffer = null; alignedImage = null; } + final boolean DEBUG_INIT; if ( null == pixelBuffer ) { if (0 >= panelWidth || 0 >= panelHeight ) { return; } - pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, panelWidth, panelHeight, 1, true, 0); + pixelBuffer = pixelBufferProvider.allocate(gl, awtPixelFormat.comp, pixelAttribs, true, panelWidth, panelHeight, 1, 0); if(DEBUG) { System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" pixelBufferProvider isSingletonBufferProvider "+useSingletonBuffer+", 0x"+Integer.toHexString(pixelBufferProvider.hashCode())+", "+pixelBufferProvider.getClass().getSimpleName()); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" pixelBuffer 0x"+Integer.toHexString(pixelBuffer.hashCode())+", "+pixelBuffer+", alignment "+alignment); - System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" flippedVertical "+flipVertical+", glslTextureRaster "+(null!=glslTextureRaster)); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" flippedVertical "+flipVertical+", glslTextureRaster "+(null!=glslTextureRaster)+", isGL2ES3 "+gl.isGL2ES3()); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" panelSize "+panelWidth+"x"+panelHeight+" @ scale "+getPixelScaleStr()); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" pixelAttribs "+pixelAttribs); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" awtPixelFormat "+awtPixelFormat); + DEBUG_INIT = true; + } else { + DEBUG_INIT = false; } + } else { + DEBUG_INIT = false; } if( offscreenDrawable.getSurfaceWidth() != panelWidth || offscreenDrawable.getSurfaceHeight() != panelHeight ) { throw new InternalError("OffscreenDrawable panelSize mismatch (reshape missed): panelSize "+panelWidth+"x"+panelHeight+" != drawable "+offscreenDrawable.getSurfaceWidth()+"x"+offscreenDrawable.getSurfaceHeight()+", on thread "+getThreadName()); @@ -1937,6 +1989,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing final GL2ES3 gl2es3 = gl.getGL2ES3(); psm.setPackRowLength(gl2es3, panelWidth); gl2es3.glReadBuffer(gl2es3.getDefaultReadBuffer()); + if( DEBUG_INIT ) { + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: fboDrawable "+offscreenDrawable); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: isGL2ES3, readBuffer 0x"+Integer.toHexString(gl2es3.getDefaultReadBuffer())); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: def-readBuffer 0x"+Integer.toHexString(gl2es3.getDefaultReadBuffer())); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: def-readFBO 0x"+Integer.toHexString(gl2es3.getDefaultReadFramebuffer())); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: bound-readFBO 0x"+Integer.toHexString(gl2es3.getBoundFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER))); + } } if(null != glslTextureRaster) { // implies flippedVertical @@ -1965,9 +2024,26 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // gl.glClear(GL.GL_DEPTH_BUFFER_BIT); // fboFlipped runs w/o DEPTH! glslTextureRaster.display(gl.getGL2ES2()); + if( DEBUG_INIT ) { + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: fboDrawable "+fboDrawable); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: read from fbo-rb "+fboFlipped.getReadFramebuffer()+", fbo "+fboFlipped); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: isGL2ES3, readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer())); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: def-readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer())); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: def-readFBO 0x"+Integer.toHexString(gl.getDefaultReadFramebuffer())); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: bound-readFBO 0x"+Integer.toHexString(gl.getBoundFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER))); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: "+GLJPanel.this.getName()+" pixelAttribs "+pixelAttribs); + } gl.glReadPixels(0, 0, panelWidth, panelHeight, pixelAttribs.format, pixelAttribs.type, readBackInts); fboFlipped.unbind(gl); + if( DEBUG_INIT ) { + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: fboDrawable "+fboDrawable); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: read from fbo-rb "+fboFlipped.getReadFramebuffer()+", fbo "+fboFlipped); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: isGL2ES3, readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer())); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: def-readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer())); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: def-readFBO 0x"+Integer.toHexString(gl.getDefaultReadFramebuffer())); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: bound-readFBO 0x"+Integer.toHexString(gl.getBoundFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER))); + } if( viewportChange ) { gl.glViewport(usrViewport[0], usrViewport[1], usrViewport[2], usrViewport[3]); } @@ -2022,7 +2098,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.doPaintComponent.drawImage: - frameCount "+frameCount); } // Draw resulting image in one shot - g.drawImage(alignedImage, 0, 0, alignedImage.getWidth()/hasPixelScale[0], alignedImage.getHeight()/hasPixelScale[1], null); // Null ImageObserver since image data is ready. + g.drawImage(alignedImage, 0, 0, + SurfaceScaleUtils.scaleInv(alignedImage.getWidth(), hasPixelScale[0]), + SurfaceScaleUtils.scaleInv(alignedImage.getHeight(), hasPixelScale[1]), null); // Null ImageObserver since image data is ready. } frameCount++; } diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLLightingFunc.java index 001f4f05b..cf7b9da46 100644 --- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java +++ b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLLightingFunc.java @@ -27,7 +27,7 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl.fixedfunc; +package com.jogamp.opengl.fixedfunc; public interface GLLightingFunc { public static final int GL_LIGHT0 = 0x4000; diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLMatrixFunc.java index 87a23d12a..90f13faf1 100644 --- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java +++ b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLMatrixFunc.java @@ -27,11 +27,11 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl.fixedfunc; +package com.jogamp.opengl.fixedfunc; import java.nio.*; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; /** * Subset of OpenGL fixed function pipeline's matrix operations. diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFunc.java index 4aff24b36..852d4ebba 100644 --- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java +++ b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFunc.java @@ -27,9 +27,9 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl.fixedfunc; +package com.jogamp.opengl.fixedfunc; -import javax.media.opengl.*; +import com.jogamp.opengl.*; public interface GLPointerFunc { public static final int GL_VERTEX_ARRAY = 0x8074; diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFuncUtil.java index 3264062e8..cb1ff3827 100644 --- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFuncUtil.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.opengl.fixedfunc; +package com.jogamp.opengl.fixedfunc; public class GLPointerFuncUtil { public static final String mgl_Vertex = "mgl_Vertex"; diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUnurbs.java b/src/jogl/classes/com/jogamp/opengl/glu/GLUnurbs.java index 2641115d0..0dbd54674 100644 --- a/src/jogl/classes/javax/media/opengl/glu/GLUnurbs.java +++ b/src/jogl/classes/com/jogamp/opengl/glu/GLUnurbs.java @@ -1,4 +1,4 @@ -package javax.media.opengl.glu; +package com.jogamp.opengl.glu; /** * Wrapper for a GLU NURBS object. diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUquadric.java b/src/jogl/classes/com/jogamp/opengl/glu/GLUquadric.java index 49451a34b..45b2d054d 100644 --- a/src/jogl/classes/javax/media/opengl/glu/GLUquadric.java +++ b/src/jogl/classes/com/jogamp/opengl/glu/GLUquadric.java @@ -1,6 +1,6 @@ -package javax.media.opengl.glu; +package com.jogamp.opengl.glu; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; import com.jogamp.opengl.util.ImmModeSink; /** diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellator.java b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellator.java index f98bbe158..ce9fda8e7 100644 --- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellator.java +++ b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellator.java @@ -50,7 +50,7 @@ ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ -package javax.media.opengl.glu; +package com.jogamp.opengl.glu; /** * The <b>GLUtessellator</b> object is used to hold the data, such as the diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellatorCallback.java index 0f05619a4..c616bca38 100644 --- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java +++ b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellatorCallback.java @@ -50,7 +50,7 @@ ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ -package javax.media.opengl.glu; +package com.jogamp.opengl.glu; /** * <b>GLUtessellatorCallback</b> interface provides methods that the user will @@ -63,7 +63,7 @@ package javax.media.opengl.glu; public interface GLUtessellatorCallback { /** * The <b>begin</b> callback method is invoked like - * {@link javax.media.opengl.GL#glBegin glBegin} to indicate the start of a + * {@link com.jogamp.opengl.GL#glBegin glBegin} to indicate the start of a * (triangle) primitive. The method takes a single argument of type int. If * the <b>GLU_TESS_BOUNDARY_ONLY</b> property is set to <b>GL_FALSE</b>, then * the argument is set to either <b>GL_TRIANGLE_FAN</b>, @@ -104,7 +104,7 @@ public interface GLUtessellatorCallback { /** * The <b>edgeFlag</b> callback method is similar to - * {@link javax.media.opengl.GL#glEdgeFlag glEdgeFlag}. The method takes + * {@link com.jogamp.opengl.GL#glEdgeFlag glEdgeFlag}. The method takes * a single boolean boundaryEdge that indicates which edges lie on the * polygon boundary. If the boundaryEdge is <b>GL_TRUE</b>, then each vertex * that follows begins an edge that lies on the polygon boundary, that is, @@ -149,7 +149,7 @@ public interface GLUtessellatorCallback { /** * The <b>vertex</b> callback method is invoked between the {@link * #begin begin} and {@link #end end} callback methods. It is - * similar to {@link javax.media.opengl.GL#glVertex3f glVertex3f}, + * similar to {@link com.jogamp.opengl.GL#glVertex3f glVertex3f}, * and it defines the vertices of the triangles created by the * tessellation process. The method takes a reference as its only * argument. This reference is identical to the opaque reference @@ -186,7 +186,7 @@ public interface GLUtessellatorCallback { /** * The end callback serves the same purpose as - * {@link javax.media.opengl.GL#glEnd glEnd}. It indicates the end of a + * {@link com.jogamp.opengl.GL#glEnd glEnd}. It indicates the end of a * primitive and it takes no arguments. * * @see GLU#gluTessCallback gluTessCallback diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellatorCallbackAdapter.java index c293fbe18..b9503f12e 100644 --- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java +++ b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellatorCallbackAdapter.java @@ -50,7 +50,7 @@ ** Java Port: Pepijn Van Eeckhoudt, July 2003 ** Java Port: Nathan Parker Burg, August 2003 */ -package javax.media.opengl.glu; +package com.jogamp.opengl.glu; /** * The <b>GLUtessellatorCallbackAdapter</b> provides a default implementation of diff --git a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java index 1a8924c8f..a04055430 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java @@ -29,7 +29,7 @@ package com.jogamp.opengl.math; import java.nio.FloatBuffer; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GLException; import jogamp.opengl.Debug; @@ -491,16 +491,18 @@ public final class FloatUtil { * @param zNear * @param zFar * @return given matrix for chaining + * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, + * or if left == right, or bottom == top, or zNear == zFar. */ public static float[] makeFrustum(final float[] m, final int m_offset, final boolean initM, final float left, final float right, final float bottom, final float top, - final float zNear, final float zFar) { - if(zNear<=0.0f||zFar<0.0f) { + final float zNear, final float zFar) throws GLException { + if( zNear <= 0.0f || zFar < 0.0f ) { throw new GLException("GL_INVALID_VALUE: zNear and zFar must be positive, and zNear>0"); } - if(left==right || top==bottom) { - throw new GLException("GL_INVALID_VALUE: top,bottom and left,right must not be equal"); + if( left == right || top == bottom || zNear == zFar ) { + throw new GLException("GL_INVALID_VALUE: top,bottom and left,right and zNear,zFar must not be equal"); } if( initM ) { // m[m_offset+0+4*0] = 1f; @@ -563,9 +565,10 @@ public final class FloatUtil { * @param zNear * @param zFar * @return given matrix for chaining + * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar. */ public static float[] makePerspective(final float[] m, final int m_off, final boolean initM, - final float fovy_rad, final float aspect, final float zNear, final float zFar) { + final float fovy_rad, final float aspect, final float zNear, final float zFar) throws GLException { final float top = tan(fovy_rad/2f) * zNear; // use tangent of half-fov ! final float bottom = -1.0f * top; final float left = aspect * bottom; @@ -588,9 +591,10 @@ public final class FloatUtil { * @param zNear * @param zFar * @return given matrix for chaining + * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar. */ public static float[] makePerspective(final float[] m, final int m_offset, final boolean initM, - final FovHVHalves fovhv, final float zNear, final float zFar) { + final FovHVHalves fovhv, final float zNear, final float zFar) throws GLException { final FovHVHalves fovhvTan = fovhv.toTangents(); // use tangent of half-fov ! final float top = fovhvTan.top * zNear; final float bottom = -1.0f * fovhvTan.bottom * zNear; diff --git a/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java b/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java index 830f1a882..421bb909f 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java @@ -28,7 +28,8 @@ package com.jogamp.opengl.math; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.util.PMVMatrix; @@ -139,11 +140,28 @@ public class Matrix4 { multMatrix( FloatUtil.makeOrtho(mat4Tmp1, 0, true, left, right, bottom, top, zNear, zFar) ); } - public final void makeFrustum(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) { + /** + * @param left + * @param right + * @param bottom + * @param top + * @param zNear + * @param zFar + * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, + * or if left == right, or bottom == top, or zNear == zFar. + */ + public final void makeFrustum(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) throws GLException { multMatrix( FloatUtil.makeFrustum(mat4Tmp1, 0, true, left, right, bottom, top, zNear, zFar) ); } - public final void makePerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar) { + /** + * @param fovy_rad + * @param aspect + * @param zNear + * @param zFar + * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar. + */ + public final void makePerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar) throws GLException { multMatrix( FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_rad, aspect, zNear, zFar) ); } diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java index 28f572d7d..58b5bbcb9 100644 --- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java +++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java @@ -29,31 +29,31 @@ package com.jogamp.opengl.swt; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.VisualIDHolder.VIDType; -import javax.media.opengl.GL; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.GLSharedContextSetter; -import javax.media.opengl.Threading; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.VisualIDHolder.VIDType; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.GLSharedContextSetter; +import com.jogamp.opengl.Threading; import jogamp.nativewindow.x11.X11Util; import jogamp.opengl.Debug; diff --git a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java index 62df3faca..76d64963f 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java @@ -45,7 +45,7 @@ import java.util.Map; import javax.swing.JComponent; import javax.swing.RepaintManager; import javax.swing.SwingUtilities; -import javax.media.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.util.AnimatorBase.UncaughtAnimatorException; diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index b38a42ee3..066709316 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -40,8 +40,8 @@ package com.jogamp.opengl.util; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLException; /** <P> An Animator can be attached to one or more {@link GLAutoDrawable}s to drive their display() methods in a loop. </P> diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java index 5f2db20bd..aafdf63f8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java @@ -34,10 +34,12 @@ import jogamp.opengl.FPSCounterImpl; import java.io.PrintStream; import java.util.ArrayList; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; + +import com.jogamp.common.ExceptionUtils; /** * Base implementation of GLAnimatorControl<br> @@ -625,7 +627,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { " - " + getThreadName()); System.err.println(" - "+toString()); if(nok) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return res; diff --git a/src/jogl/classes/com/jogamp/opengl/util/CustomGLEventListener.java b/src/jogl/classes/com/jogamp/opengl/util/CustomGLEventListener.java index 86443087e..222833c7d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/CustomGLEventListener.java +++ b/src/jogl/classes/com/jogamp/opengl/util/CustomGLEventListener.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.util; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; /** * Extended {@link GLEventListener} interface diff --git a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java index 6b1485a6a..6cded29d9 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java @@ -35,7 +35,7 @@ package com.jogamp.opengl.util; import java.util.ArrayList; -import javax.media.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.util.AnimatorBase.UncaughtAnimatorException; diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java index 54d40f285..320873ede 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java @@ -42,8 +42,10 @@ package com.jogamp.opengl.util; import java.util.Timer; import java.util.TimerTask; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLException; + +import com.jogamp.common.ExceptionUtils; /** * An Animator subclass which attempts to achieve a target @@ -392,7 +394,7 @@ public class FPSAnimator extends AnimatorBase { if( null != task ) { if( DEBUG ) { System.err.println("FPSAnimator.resume() Ops: !pauseIssued, but task != null: "+toString()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } task.cancel(); task = null; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java index 1a9ec2782..542da4bf1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java @@ -35,9 +35,9 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLPointerFuncUtil; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLPointerFuncUtil; import jogamp.opengl.util.GLArrayHandler; import jogamp.opengl.util.GLFixedArrayHandler; @@ -67,7 +67,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * @param normalized Whether the data shall be normalized * @param initialElementCount * - * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) + * @see com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int) */ public static GLArrayDataClient createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int initialElementCount) throws GLException @@ -97,7 +97,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * @param stride * @param buffer the user define data * - * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) + * @see com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int) */ public static GLArrayDataClient createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int stride, final Buffer buffer) diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java index 9a0f1cb37..7524fe1d1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java @@ -1,7 +1,7 @@ package com.jogamp.opengl.util; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import java.nio.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java index 51c55e326..6b7c31d13 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java @@ -34,12 +34,12 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLArrayData; -import javax.media.opengl.GLBufferStorage; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLPointerFuncUtil; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLArrayData; +import com.jogamp.opengl.GLBufferStorage; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLPointerFuncUtil; import com.jogamp.common.nio.Buffers; @@ -79,7 +79,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param buffer the user define data * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} * - * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) + * @see com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int) */ public static GLArrayDataServer createFixed(final int index, final int compsPerElement, final int dataType, final boolean normalized, final int stride, final Buffer buffer, final int vboUsage) @@ -111,7 +111,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param initialElementCount * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} * - * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) + * @see com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int) */ public static GLArrayDataServer createFixed(final int index, final int compsPerElement, final int dataType, final boolean normalized, final int initialElementCount, final int vboUsage) diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java index 867bc00ac..3f759c6d8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java @@ -34,13 +34,13 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLArrayData; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLPointerFuncUtil; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLArrayData; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLPointerFuncUtil; import com.jogamp.common.nio.Buffers; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java index d4ab4e4f4..6a2a02387 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java @@ -41,14 +41,14 @@ package com.jogamp.opengl.util; import java.nio.Buffer; import java.nio.ByteBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLES2; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLES2; +import com.jogamp.opengl.GLException; import com.jogamp.common.nio.Buffers; @@ -372,29 +372,29 @@ public class GLBuffers extends Buffers { int skipImages = 0; if (pack) { - alignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT, tmp); + alignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT, tmp); // es2, es3, gl3 if( gl.isGL2ES3() ) { - rowLength = glGetInteger(gl, GL2ES3.GL_PACK_ROW_LENGTH, tmp); - skipRows = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_ROWS, tmp); - skipPixels = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_PIXELS, tmp); - if (depth > 1 && gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version120) >= 0 ) { - imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp); - skipImages = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_IMAGES, tmp); + rowLength = glGetInteger(gl, GL2ES3.GL_PACK_ROW_LENGTH, tmp); // es3, gl3 + skipRows = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_ROWS, tmp); // es3, gl3 + skipPixels = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_PIXELS, tmp); // es3, gl3 + if (depth > 1 && gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version1_2) >= 0 ) { + imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp); // gl3, GL_VERSION_1_2 + skipImages = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_IMAGES, tmp); // gl3, GL_VERSION_1_2 } } } else { - alignment = glGetInteger(gl, GL.GL_UNPACK_ALIGNMENT, tmp); + alignment = glGetInteger(gl, GL.GL_UNPACK_ALIGNMENT, tmp); // es2, es3, gl3 if( gl.isGL2ES3() ) { - rowLength = glGetInteger(gl, GL2ES2.GL_UNPACK_ROW_LENGTH, tmp); - skipRows = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_ROWS, tmp); - skipPixels = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_PIXELS, tmp); + rowLength = glGetInteger(gl, GL2ES2.GL_UNPACK_ROW_LENGTH, tmp); // es3, gl3 + skipRows = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_ROWS, tmp); // es3, gl3 + skipPixels = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_PIXELS, tmp); // es3, gl3 if( depth > 1 && ( gl.isGL3ES3() || - ( gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version120) >= 0 ) + ( gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version1_2) >= 0 ) ) ) { - imageHeight = glGetInteger(gl, GL2ES3.GL_UNPACK_IMAGE_HEIGHT, tmp); - skipImages = glGetInteger(gl, GL2ES3.GL_UNPACK_SKIP_IMAGES, tmp); + imageHeight = glGetInteger(gl, GL2ES3.GL_UNPACK_IMAGE_HEIGHT, tmp);// es3, gl3, GL_VERSION_1_2 + skipImages = glGetInteger(gl, GL2ES3.GL_UNPACK_SKIP_IMAGES, tmp); // es3, gl3, GL_VERSION_1_2 } } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java index 634cfeaed..4cf752b4c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java @@ -27,18 +27,18 @@ */ package com.jogamp.opengl.util; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLBase; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.Threading; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLBase; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.Threading; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.opengl.GLEventListenerState; @@ -215,7 +215,7 @@ public class GLDrawableUtil { * During operation, both {@link GLAutoDrawable auto-drawable's} * {@link GLAutoDrawable#getUpstreamLock() upstream-locks} and {@link GLAutoDrawable#getNativeSurface() surfaces} are locked, * hence atomicity of operation is guaranteed, - * see <a href="../../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>. + * see <a href="../../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>. * </p> * <p> * Because of above mentioned locking, if this method is not performed @@ -256,7 +256,7 @@ public class GLDrawableUtil { * During operation, both {@link GLAutoDrawable auto-drawable's} * {@link GLAutoDrawable#getUpstreamLock() upstream-locks} and {@link GLAutoDrawable#getNativeSurface() surfaces} are locked, * hence atomicity of operation is guaranteed, - * see <a href="../../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>. + * see <a href="../../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>. * </p> * <p> * Because of above mentioned locking, if this method is not performed @@ -333,7 +333,7 @@ public class GLDrawableUtil { * in which case {@link GLDrawable#swapBuffers() swap-buffers} shall happen <b>after</b> calling reading pixels, the default. * </p> * <p> - * However, <i>multisampling</i> offscreen {@link javax.media.opengl.GLFBODrawable}s + * However, <i>multisampling</i> offscreen {@link com.jogamp.opengl.GLFBODrawable}s * utilize {@link GLDrawable#swapBuffers() swap-buffers} to <i>downsample</i> * the multisamples into the readable sampling sink. * In this case, we require {@link GLDrawable#swapBuffers() swap-buffers} <b>before</b> reading pixels. diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java index a09321d75..4575de959 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java @@ -30,14 +30,14 @@ package com.jogamp.opengl.util; import java.nio.Buffer; import java.nio.ByteBuffer; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.texture.TextureData; @@ -58,41 +58,100 @@ public class GLPixelBuffer { /** Allow {@link GL2ES3#GL_PACK_ROW_LENGTH}, or {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. */ boolean getAllowRowStride(); - /** Called first to determine {@link GLPixelAttributes}. */ - GLPixelAttributes getAttributes(GL gl, int componentCount); + /** + * Returns RGB[A] {@link GLPixelAttributes} matching {@link GL}, {@code componentCount} and {@code pack}. + * + * @param gl the corresponding current {@link GL} context object + * @param componentCount RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA) + * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}. + * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}. + */ + GLPixelAttributes getAttributes(GL gl, int componentCount, boolean pack); + + /** + * Returns the host {@link PixelFormat.Composition} matching {@link GL} and {@code componentCount} + * if required by implementation, otherwise {@code null}. + * + * @param glp the corresponding current {@link GL} context object + * @param componentCount RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA) + */ + PixelFormat.Composition getHostPixelComp(final GLProfile glp, final int componentCount); /** * Allocates a new {@link GLPixelBuffer} object. * <p> - * Being called to gather the initial {@link GLPixelBuffer}, - * or a new replacement {@link GLPixelBuffer} if {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. - * </p> - * <p> * The minimum required {@link Buffer#remaining() remaining} byte size equals to <code>minByteSize</code>, if > 0, * otherwise utilize {@link GLBuffers#sizeof(GL, int[], int, int, int, int, int, boolean)} * to calculate it. * </p> * - * @param gl the corresponding current GL context object - * @param pixelAttributes the desired {@link GLPixelAttributes} + * @param gl the corresponding current {@link GL} context object + * @param hostPixComp host {@link PixelFormat pixel format}, i.e. of the source or sink depending on {@code pack}, + * e.g. fetched via {@link #getHostPixelComp(GLProfile, int)}. + * If {@code null}, {@code pixelAttributes} instance maybe used or an exception is thrown, + * depending on implementation semantics. + * @param pixelAttributes the desired {@link GLPixelAttributes}, e.g. fetched via {@link #getAttributes(GL, int, boolean)} + * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}. + * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}. * @param width in pixels * @param height in pixels * @param depth in pixels - * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU * @param minByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore. + * @see #getHostPixelComp(GLProfile, int) + * @see #getAttributes(GL, int, boolean) */ - GLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize); + GLPixelBuffer allocate(GL gl, PixelFormat.Composition hostPixComp, GLPixelAttributes pixelAttributes, + boolean pack, int width, int height, int depth, int minByteSize); } /** Single {@link GLPixelBuffer} provider. */ public static interface SingletonGLPixelBufferProvider extends GLPixelBufferProvider { - /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link GLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */ - GLPixelBuffer getSingleBuffer(GLPixelAttributes pixelAttributes); /** - * Initializes the single {@link GLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}. + * {@inheritDoc} + * <p> + * Being called to gather the initial {@link GLPixelBuffer}, + * or a new replacement {@link GLPixelBuffer} if {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. + * </p> + */ + @Override + GLPixelBuffer allocate(GL gl, PixelFormat.Composition hostPixComp, GLPixelAttributes pixelAttributes, + boolean pack, int width, int height, int depth, int minByteSize); + + /** + * Return the last {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocated} {@link GLPixelBuffer} + * matching the given parameter. + * <p> + * May return {@code null} if none has been allocated yet. + * </p> + * <p> + * Returned {@link GLPixelBuffer} may be {@link GLPixelBuffer#isValid() invalid}. + * </p> + * @param hostPixComp host {@link PixelFormat pixel format}, i.e. of the source or sink depending on {@code pack}, + * e.g. fetched via {@link #getHostPixelComp(GLProfile, int)}. + * If {@code null}, {@code pixelAttributes} instance maybe used or an exception is thrown, + * depending on implementation semantics. + * @param pixelAttributes the desired {@link GLPixelAttributes}, e.g. fetched via {@link #getAttributes(GL, int, boolean)} + * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}. + * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}. + */ + GLPixelBuffer getSingleBuffer(PixelFormat.Composition hostPixelComp, GLPixelAttributes pixelAttributes, boolean pack); + /** + * Initializes the single {@link GLPixelBuffer} w/ a given size, + * if not yet {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocated}. + * + * @param glp + * @param componentCount RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA) + * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}. + * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}. + * @param width + * @param height + * @param depth * @return the newly initialized single {@link GLPixelBuffer}, or null if already allocated. */ - GLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack); + GLPixelBuffer initSingleton(GLProfile glp, int componentCount, boolean pack, int width, int height, int depth); + + /** Dispose all resources.*/ + void dispose(); } public static class DefaultGLPixelBufferProvider implements GLPixelBufferProvider { @@ -110,36 +169,24 @@ public class GLPixelBuffer { public boolean getAllowRowStride() { return allowRowStride; } @Override - public GLPixelAttributes getAttributes(final GL gl, final int componentCount) { - final GLContext ctx = gl.getContext(); - final int dFormat, dType; - - if( 1 == componentCount ) { - if( gl.isGL3ES3() ) { - // RED is supported on ES3 and >= GL3 [core]; ALPHA is deprecated on core - dFormat = GL2ES2.GL_RED; - } else { - // ALPHA is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility - dFormat = GL.GL_ALPHA; - } - dType = GL.GL_UNSIGNED_BYTE; - } else if( 3 == componentCount ) { - dFormat = GL.GL_RGB; - dType = GL.GL_UNSIGNED_BYTE; - } else if( 4 == componentCount ) { - final int _dFormat = ctx.getDefaultPixelDataFormat(); - final int dComps = GLBuffers.componentCount(_dFormat); - if( dComps == componentCount ) { - dFormat = _dFormat; - dType = ctx.getDefaultPixelDataType(); - } else { - dFormat = GL.GL_RGBA; - dType = GL.GL_UNSIGNED_BYTE; - } - } else { + public GLPixelAttributes getAttributes(final GL gl, final int componentCount, final boolean pack) { + final GLPixelAttributes res = GLPixelAttributes.convert(gl, componentCount, pack); + if( null == res ) { throw new GLException("Unsupported componentCount "+componentCount+", contact maintainer to enhance"); + } else { + return res; } - return new GLPixelAttributes(componentCount, dFormat, dType); + } + + /** + * {@inheritDoc} + * <p> + * Returns {@code null}! + * </p> + */ + @Override + public PixelFormat.Composition getHostPixelComp(final GLProfile glp, final int componentCount) { + return null; } /** @@ -149,13 +196,15 @@ public class GLPixelBuffer { * </p> */ @Override - public GLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { + public GLPixelBuffer allocate(final GL gl, final PixelFormat.Composition hostPixComp, final GLPixelAttributes pixelAttributes, + final boolean pack, final int width, final int height, final int depth, final int minByteSize) { + // unused: hostPixComp if( minByteSize > 0 ) { - return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride()); + return new GLPixelBuffer(pixelAttributes, pack, width, height, depth, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride()); } else { final int[] tmp = { 0 }; - final int byteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.bytesPerPixel, width, height, depth, pack); - return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(byteSize), getAllowRowStride()); + final int byteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.pfmt.comp.bytesPerPixel(), width, height, depth, pack); + return new GLPixelBuffer(pixelAttributes, pack, width, height, depth, Buffers.newDirectByteBuffer(byteSize), getAllowRowStride()); } } } @@ -163,74 +212,190 @@ public class GLPixelBuffer { /** * Default {@link GLPixelBufferProvider} with {@link GLPixelBufferProvider#getAllowRowStride()} == <code>false</code>, * utilizing best match for {@link GLPixelAttributes} - * and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}. + * and {@link GLPixelBufferProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocating} a {@link ByteBuffer}. */ public static final GLPixelBufferProvider defaultProviderNoRowStride = new DefaultGLPixelBufferProvider(false); /** * Default {@link GLPixelBufferProvider} with {@link GLPixelBufferProvider#getAllowRowStride()} == <code>true</code>, * utilizing best match for {@link GLPixelAttributes} - * and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}. + * and {@link GLPixelBufferProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocating} a {@link ByteBuffer}. */ public static final GLPixelBufferProvider defaultProviderWithRowStride = new DefaultGLPixelBufferProvider(true); /** Pixel attributes. */ public static class GLPixelAttributes { /** Undefined instance of {@link GLPixelAttributes}, having componentCount:=0, format:=0 and type:= 0. */ - public static final GLPixelAttributes UNDEF = new GLPixelAttributes(0, 0, 0, false); - - /** Pixel <i>source</i> component count, i.e. number of meaningful components. */ - public final int componentCount; - /** The OpenGL pixel data format */ - public final int format; - /** The OpenGL pixel data type */ - public final int type; - /** The OpenGL pixel size in bytes */ - public final int bytesPerPixel; + public static final GLPixelAttributes UNDEF = new GLPixelAttributes(null, PixelFormat.LUMINANCE, 0, 0, true, false); /** - * Deriving {@link #componentCount} via GL <code>dataFormat</code>, i.e. {@link GLBuffers#componentCount(int)} if > 0. - * @param dataFormat GL data format - * @param dataType GL data type + * Returns the matching {@link PixelFormat} for the given GL format and type if exists, + * otherwise returns <code>null</code>. */ - public GLPixelAttributes(final int dataFormat, final int dataType) { - this(0 < dataFormat ? GLBuffers.componentCount(dataFormat) : 0, dataFormat, dataType); + public static final PixelFormat getPixelFormat(final int glFormat, final int glDataType) { + PixelFormat pixFmt = null; + + switch(glFormat) { + case GL.GL_ALPHA: + case GL.GL_LUMINANCE: + case GL2ES2.GL_RED: + pixFmt = PixelFormat.LUMINANCE; + break; + case GL.GL_RGB: + switch(glDataType) { + case GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV: + pixFmt = PixelFormat.RGB565; + break; + case GL.GL_UNSIGNED_SHORT_5_6_5: + pixFmt = PixelFormat.BGR565; + break; + case GL.GL_UNSIGNED_BYTE: + pixFmt = PixelFormat.RGB888; + break; + } + break; + case GL.GL_RGBA: + switch(glDataType) { + case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV: + pixFmt = PixelFormat.RGBA5551; + break; + case GL.GL_UNSIGNED_SHORT_5_5_5_1: + pixFmt = PixelFormat.ABGR1555; + break; + case GL.GL_UNSIGNED_BYTE: + pixFmt = PixelFormat.RGBA8888; + break; + case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: + pixFmt = PixelFormat.ABGR8888; + break; + } + break; + case GL2GL3.GL_BGR: + if( GL.GL_UNSIGNED_BYTE == glDataType ) { + pixFmt = PixelFormat.BGR888; + } + break; + case GL.GL_BGRA: + switch(glDataType) { + case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: + pixFmt = PixelFormat.ARGB8888; + break; + case GL.GL_UNSIGNED_BYTE: + pixFmt = PixelFormat.BGRA8888; + break; + } + break; + } + return pixFmt; } + /** - * Using user specified source {@link #componentCount}. - * @param componentCount source component count - * @param dataFormat GL data format - * @param dataType GL data type + * Returns the matching {@link GLPixelAttributes} for the given byte sized RGBA {@code componentCount} and {@link GL} if exists, + * otherwise returns {@code null}. + * + * @param gl the corresponding current {@link GL} context object + * @param componentCount RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA) + * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}. + * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}. */ - public GLPixelAttributes(final int componentCount, final int dataFormat, final int dataType) { - this(componentCount, dataFormat, dataType, true); + public static GLPixelAttributes convert(final GL gl, final int componentCount, final boolean pack) { + final int dFormat, dType; + final boolean glesReadMode = pack && gl.isGLES(); + + if( 1 == componentCount && !glesReadMode ) { + if( gl.isGL3ES3() ) { + // RED is supported on ES3 and >= GL3 [core]; ALPHA is deprecated on core + dFormat = GL2ES2.GL_RED; + } else { + // ALPHA is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility + dFormat = GL.GL_ALPHA; + } + dType = GL.GL_UNSIGNED_BYTE; + } else if( 3 == componentCount && !glesReadMode ) { + dFormat = GL.GL_RGB; + dType = GL.GL_UNSIGNED_BYTE; + } else if( 4 == componentCount || glesReadMode ) { + final GLContext ctx = gl.getContext(); + final int _dFormat = ctx.getDefaultPixelDataFormat(); + final int dComps = GLBuffers.componentCount(_dFormat); + if( dComps == componentCount || 4 == dComps ) { // accept if desired component count or 4 components + dFormat = _dFormat; + dType = ctx.getDefaultPixelDataType(); + } else { + dFormat = GL.GL_RGBA; + dType = GL.GL_UNSIGNED_BYTE; + } + } else { + return null; + } + return new GLPixelAttributes(dFormat, dType); } /** - * Returns the matching {@link GLPixelAttributes} for the given {@link PixelFormat} and {@link GLProfile} if exists, - * otherwise returns <code>null</code>. + * Returns the matching {@link GLPixelAttributes} for the given {@link GLProfile}, {@link PixelFormat} and {@code pack} if exists, + * otherwise returns {@code null}. + * @param glp the corresponding {@link GLProfile} + * @param pixFmt the to be matched {@link PixelFormat pixel format} + * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}. + * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}. */ - public static final GLPixelAttributes convert(final PixelFormat pixFmt, final GLProfile glp) { + public static final GLPixelAttributes convert(final GLProfile glp, final PixelFormat pixFmt, final boolean pack) { + final int[] df = new int[1]; + final int[] dt = new int[1]; + convert(glp, pixFmt, pack, df, dt); + if( 0 != df[0] ) { + return new GLPixelAttributes(null, pixFmt, df[0], dt[0], true /* not used */, true); + } + return null; + } + private static final int convert(final GLProfile glp, final PixelFormat pixFmt, final boolean pack, + final int[] dfRes, final int[] dtRes) { + final boolean glesReadMode = pack && glp.isGLES(); int df = 0; // format int dt = GL.GL_UNSIGNED_BYTE; // data type switch(pixFmt) { case LUMINANCE: - if( glp.isGL3ES3() ) { - // RED is supported on ES3 and >= GL3 [core]; ALPHA/LUMINANCE is deprecated on core - df = GL2ES2.GL_RED; - } else { - // ALPHA/LUMINANCE is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility - df = GL.GL_LUMINANCE; + if( !glesReadMode ) { + if( glp.isGL3ES3() ) { + // RED is supported on ES3 and >= GL3 [core]; ALPHA/LUMINANCE is deprecated on core + df = GL2ES2.GL_RED; + } else { + // ALPHA/LUMINANCE is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility + df = GL.GL_LUMINANCE; + } } break; - case BGR888: + case RGB565: if( glp.isGL2GL3() ) { - df = GL2GL3.GL_BGR; + df = GL.GL_RGB; dt = GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV; + } + break; + case BGR565: + if( glp.isGL2GL3() ) { + df = GL.GL_RGB; dt = GL.GL_UNSIGNED_SHORT_5_6_5; + } + break; + case RGBA5551: + if( glp.isGL2GL3() ) { + df = GL.GL_RGBA; dt = GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV; + } + break; + case ABGR1555: + if( glp.isGL2GL3() ) { + df = GL.GL_RGBA; dt = GL.GL_UNSIGNED_SHORT_5_5_5_1; } break; case RGB888: - df = GL.GL_RGB; + if( !glesReadMode ) { + df = GL.GL_RGB; + } + break; + case BGR888: + if( glp.isGL2GL3() ) { + df = GL2GL3.GL_BGR; + } break; + case RGBx8888: case RGBA8888: df = GL.GL_RGBA; break; @@ -239,85 +404,107 @@ public class GLPixelBuffer { df = GL.GL_RGBA; dt = GL2GL3.GL_UNSIGNED_INT_8_8_8_8; } break; - case BGRA8888: - df = GL.GL_BGRA; - break; case ARGB8888: if( glp.isGL2GL3() ) { df = GL.GL_BGRA; dt = GL2GL3.GL_UNSIGNED_INT_8_8_8_8; } break; - default: + case BGRx8888: + case BGRA8888: + if( glp.isGL2GL3() ) { // FIXME: or if( !glesReadMode ) ? BGRA n/a on GLES + df = GL.GL_BGRA; + } break; } - if( 0 != df ) { - return new GLPixelAttributes(pixFmt.componentCount, df, dt, true); - } - return null; + dfRes[0] = df; + dtRes[0] = dt; + return df; } - private GLPixelAttributes(final int componentCount, final int dataFormat, final int dataType, final boolean checkArgs) { - this.componentCount = componentCount; - this.format = dataFormat; - this.type = dataType; - this.bytesPerPixel = ( 0 < dataFormat && 0 < dataType ) ? GLBuffers.bytesPerPixel(dataFormat, dataType) : 0; - if( checkArgs ) { - if( 0 == componentCount || 0 == format || 0 == type ) { - throw new GLException("Zero components, format and/or type: "+this); - } - if( 0 == bytesPerPixel ) { - throw new GLException("Zero bytesPerPixel: "+this); - } + + /** The OpenGL pixel data format */ + public final int format; + /** The OpenGL pixel data type */ + public final int type; + + /** {@link PixelFormat} describing the {@link PixelFormat.Composition component} layout */ + public final PixelFormat pfmt; + + @Override + public final int hashCode() { + // 31 * x == (x << 5) - x + int hash = pfmt.hashCode(); + hash = ((hash << 5) - hash) + format; + return ((hash << 5) - hash) + type; + } + + @Override + public final boolean equals(final Object obj) { + if(this == obj) { return true; } + if( obj instanceof GLPixelAttributes ) { + final GLPixelAttributes other = (GLPixelAttributes) obj; + return format == other.format && + type == other.type && + pfmt.equals(other.pfmt); + } else { + return false; } } /** - * Returns the matching {@link PixelFormat} of this {@link GLPixelAttributes} if exists, - * otherwise returns <code>null</code>. + * Create a new {@link GLPixelAttributes} instance based on GL format and type. + * @param dataFormat GL data format + * @param dataType GL data type + * @throws GLException if {@link PixelFormat} could not be determined, see {@link #getPixelFormat(int, int)}. */ - public final PixelFormat getPixelFormat() { - final PixelFormat pixFmt; - // FIXME: Take 'type' into consideration and complete mapping! - switch(format) { - case GL.GL_ALPHA: - case GL.GL_LUMINANCE: - case GL2ES2.GL_RED: - pixFmt = PixelFormat.LUMINANCE; - break; - case GL.GL_RGB: - pixFmt = PixelFormat.RGB888; - break; - case GL.GL_RGBA: - pixFmt = PixelFormat.RGBA8888; - break; - case GL2GL3.GL_BGR: - pixFmt = PixelFormat.BGR888; - break; - case GL.GL_BGRA: - pixFmt = PixelFormat.BGRA8888; - break; - default: - switch( bytesPerPixel ) { - case 1: - pixFmt = PixelFormat.LUMINANCE; - break; - case 3: - pixFmt = PixelFormat.RGB888; - break; - case 4: - pixFmt = PixelFormat.RGBA8888; - break; - default: - pixFmt = null; - break; - } - break; + public GLPixelAttributes(final int dataFormat, final int dataType) throws GLException { + this(null, null, dataFormat, dataType, true /* not used */, true); + } + + /** + * Create a new {@link GLPixelAttributes} instance based on {@link GLProfile}, {@link PixelFormat} and {@code pack}. + * @param glp the corresponding {@link GLProfile} + * @param pixFmt the to be matched {@link PixelFormat pixel format} + * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}. + * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}. + * @throws GLException if GL format or type could not be determined, see {@link #convert(GLProfile, PixelFormat, boolean)}. + */ + public GLPixelAttributes(final GLProfile glp, final PixelFormat pixFmt, final boolean pack) throws GLException { + this(glp, pixFmt, 0, 0, pack, true); + } + + private GLPixelAttributes(final GLProfile glp, final PixelFormat pixFmt, + final int dataFormat, final int dataType, final boolean pack, final boolean checkArgs) throws GLException { + if( checkArgs && ( 0 == dataFormat || 0 == dataType ) ) { + if( null == pixFmt || null == glp ) { + throw new GLException("Zero format and/or type w/o pixFmt or glp: "+this); + } + final int[] df = new int[1]; + final int[] dt = new int[1]; + if( 0 == convert(glp, pixFmt, pack, df, dt) ) { + throw new GLException("Could not find format and type for "+pixFmt+" and "+glp+", "+this); + } + this.format = df[0]; + this.type = dt[0]; + this.pfmt = pixFmt; + } else { + this.format = dataFormat; + this.type = dataType; + this.pfmt = null != pixFmt ? pixFmt : getPixelFormat(dataFormat, dataType); + if( null == this.pfmt ) { + throw new GLException("Could not find PixelFormat for format and/or type: "+this); + } + } + if( checkArgs ) { + final int bytesPerPixel = GLBuffers.bytesPerPixel(this.format, this.type); + if( 0 == bytesPerPixel ) { + throw new GLException("Zero bytesPerPixel: "+this); + } } - return pixFmt; } @Override public String toString() { - return "PixelAttributes[comp "+componentCount+", fmt 0x"+Integer.toHexString(format)+", type 0x"+Integer.toHexString(type)+", bytesPerPixel "+bytesPerPixel+"]"; + return "PixelAttributes[fmt 0x"+Integer.toHexString(format)+", type 0x"+Integer.toHexString(type)+", "+pfmt+"]"; } } @@ -339,14 +526,18 @@ public class GLPixelBuffer { public final int height; /** Depth in pixels. */ public final int depth; - /** Data packing direction. If <code>true</code> for read mode GPU -> CPU, <code>false</code> for write mode CPU -> GPU. */ + /** + * Data packing direction. + * <p>{@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.</p> + * <p>{@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.</p> + */ public final boolean pack; /** Byte size of the buffer. Actually the number of {@link Buffer#remaining()} bytes when passed in ctor. */ public final int byteSize; /** * Buffer holding the pixel data. If {@link #rewind()}, it holds <code>byteSize</code> {@link Buffer#remaining()} bytes. * <p> - * By default the {@link Buffer} is a {@link ByteBuffer}, due to {@link DefProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int)}. + * By default the {@link Buffer} is a {@link ByteBuffer}, due to {@link DefProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int)}. * However, other {@link GLPixelBufferProvider} may utilize different {@link Buffer} types. * </p> */ @@ -375,14 +566,16 @@ public class GLPixelBuffer { /** * @param pixelAttributes the desired {@link GLPixelAttributes} + * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}. + * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}. * @param width in pixels * @param height in pixels * @param depth in pixels - * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU * @param buffer the backing array * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}. + * @param hostPixelComp the host {@link PixelFormat.Composition} */ - public GLPixelBuffer(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final Buffer buffer, final boolean allowRowStride) { + public GLPixelBuffer(final GLPixelAttributes pixelAttributes, final boolean pack, final int width, final int height, final int depth, final Buffer buffer, final boolean allowRowStride) { this.pixelAttributes = pixelAttributes; this.width = width; this.height = height; @@ -462,7 +655,7 @@ public class GLPixelBuffer { * @param newWidth new width in pixels * @param newHeight new height in pixels * @param newByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore. - * @see GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) + * @see GLPixelBufferProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) */ public boolean requiresNewBuffer(final GL gl, final int newWidth, final int newHeight, int newByteSize) { if( !isValid() ) { @@ -470,7 +663,7 @@ public class GLPixelBuffer { } if( 0 >= newByteSize ) { final int[] tmp = { 0 }; - newByteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.bytesPerPixel, newWidth, newHeight, 1, true); + newByteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.pfmt.comp.bytesPerPixel(), newWidth, newHeight, 1, true); } if( allowRowStride ) { return byteSize < newByteSize; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java index 290033e99..3f52a0d3c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java @@ -28,13 +28,13 @@ package com.jogamp.opengl.util; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; /** * Utility to safely set and restore the PACK and UNPACK pixel storage mode, @@ -180,7 +180,7 @@ public class GLPixelStorageModes { if( gl.isGL2GL3() ) { gl.glPixelStorei(GL2GL3.GL_PACK_SWAP_BYTES, GL.GL_FALSE); // gl3 gl.glPixelStorei(GL2GL3.GL_PACK_LSB_FIRST, GL.GL_FALSE); // gl3 - if( gl.getContext().getGLVersionNumber().compareTo(GLContext.Version120) >= 0 ) { + if( gl.getContext().getGLVersionNumber().compareTo(GLContext.Version1_2) >= 0 ) { gl.glPixelStorei(GL2GL3.GL_PACK_IMAGE_HEIGHT, 0); // gl3, GL_VERSION_1_2 gl.glPixelStorei(GL2GL3.GL_PACK_SKIP_IMAGES, 0); // gl3, GL_VERSION_1_2 } @@ -251,7 +251,7 @@ public class GLPixelStorageModes { gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, 0); // es3, gl3 gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, 0); // es3, gl3 if( gl.isGL2GL3() ) { - if( gl.getContext().getGLVersionNumber().compareTo(GLContext.Version120) >= 0 ) { + if( gl.getContext().getGLVersionNumber().compareTo(GLContext.Version1_2) >= 0 ) { gl.glPixelStorei(GL2ES3.GL_UNPACK_IMAGE_HEIGHT, 0); // es3, gl3, GL_VERSION_1_2 gl.glPixelStorei(GL2ES3.GL_UNPACK_SKIP_IMAGES, 0); // es3, gl3, GL_VERSION_1_2 } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java index e84a1d874..c2067a9f2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java @@ -31,11 +31,12 @@ package com.jogamp.opengl.util; import java.io.File; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLException; import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.texture.Texture; @@ -51,10 +52,10 @@ import com.jogamp.opengl.util.texture.TextureIO; */ public class GLReadBufferUtil { protected final GLPixelBufferProvider pixelBufferProvider; - protected final int componentCount, alignment; protected final Texture readTexture; protected final GLPixelStorageModes psm; + protected boolean hasAlpha; protected GLPixelBuffer readPixelBuffer = null; protected TextureData readTextureData = null; @@ -68,10 +69,9 @@ public class GLReadBufferUtil { public GLReadBufferUtil(final GLPixelBufferProvider pixelBufferProvider, final boolean alpha, final boolean write2Texture) { this.pixelBufferProvider = pixelBufferProvider; - this.componentCount = alpha ? 4 : 3 ; - this.alignment = alpha ? 4 : 1 ; this.readTexture = write2Texture ? new Texture(GL.GL_TEXTURE_2D) : null ; this.psm = new GLPixelStorageModes(); + this.hasAlpha = alpha; // preset } /** Returns the {@link GLPixelBufferProvider} used by this instance. */ @@ -81,7 +81,7 @@ public class GLReadBufferUtil { return null!=readTextureData && null!=readPixelBuffer && readPixelBuffer.isValid(); } - public boolean hasAlpha() { return 4 == componentCount ? true : false ; } + public boolean hasAlpha() { return hasAlpha; } public GLPixelStorageModes getGLPixelStorageModes() { return psm; } @@ -173,13 +173,13 @@ public class GLReadBufferUtil { if(GL.GL_NO_ERROR != glerr0) { System.err.println("Info: GLReadBufferUtil.readPixels: pre-exisiting GL error 0x"+Integer.toHexString(glerr0)); } - final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, componentCount); - final int internalFormat; - if(gl.isGL2GL3() && 3 == componentCount) { - internalFormat = GL.GL_RGB; - } else { - internalFormat = (4 == componentCount) ? GL.GL_RGBA : GL.GL_RGB; - } + final int reqCompCount = hasAlpha ? 4 : 3; + final PixelFormat.Composition hostPixelComp = pixelBufferProvider.getHostPixelComp(gl.getGLProfile(), reqCompCount); + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, reqCompCount, true); + final int componentCount = pixelAttribs.pfmt.comp.componenCount(); + hasAlpha = 0 <= pixelAttribs.pfmt.comp.find(PixelFormat.CType.A); + final int alignment = 4 == componentCount ? 4 : 1 ; + final int internalFormat = 4 == componentCount ? GL.GL_RGBA : GL.GL_RGB; final boolean flipVertically; if( drawable.isGLOriented() ) { @@ -189,11 +189,11 @@ public class GLReadBufferUtil { } final int tmp[] = new int[1]; - final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, width, height, 1, true); + final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.pfmt.comp.bytesPerPixel(), width, height, 1, true); boolean newData = false; if( null == readPixelBuffer || readPixelBuffer.requiresNewBuffer(gl, width, height, readPixelSize) ) { - readPixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, width, height, 1, true, readPixelSize); + readPixelBuffer = pixelBufferProvider.allocate(gl, hostPixelComp, pixelAttribs, true, width, height, 1, readPixelSize); Buffers.rangeCheckBytes(readPixelBuffer.buffer, readPixelSize); try { readTextureData = new TextureData( diff --git a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java index bab85e531..151c8255d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java @@ -39,9 +39,9 @@ package com.jogamp.opengl.util; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; import com.jogamp.common.util.locks.RecursiveLock; @@ -61,7 +61,7 @@ public class Gamma { private Gamma() {} /** - * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(javax.media.nativewindow.NativeSurface, float, float, float)}. + * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(com.jogamp.nativewindow.NativeSurface, float, float, float)}. * <p> * Use {@link #setDisplayGamma(GLAutoDrawable, float, float, float)} in case of using an {#link GLAutoDrawable}. * </p> @@ -71,7 +71,7 @@ public class Gamma { } /** - * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(javax.media.nativewindow.NativeSurface, float, float, float)} + * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(com.jogamp.nativewindow.NativeSurface, float, float, float)} * locking {@link GLAutoDrawable#getUpstreamLock()} to ensure proper atomic operation. */ public static boolean setDisplayGamma(final GLAutoDrawable drawable, final float gamma, final float brightness, final float contrast) throws IllegalArgumentException { @@ -85,7 +85,7 @@ public class Gamma { } /** - * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(javax.media.nativewindow.NativeSurface)}. + * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(com.jogamp.nativewindow.NativeSurface)}. * <p> * Use {@link #resetDisplayGamma(GLAutoDrawable)} in case of using an {#link GLAutoDrawable}. * </p> @@ -95,7 +95,7 @@ public class Gamma { } /** - * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(javax.media.nativewindow.NativeSurface)} + * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(com.jogamp.nativewindow.NativeSurface)} * locking {@link GLAutoDrawable#getUpstreamLock()} to ensure proper atomic operation. */ public static void resetDisplayGamma(final GLAutoDrawable drawable) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java index 150e92c2e..b627f244c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java +++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java @@ -8,14 +8,15 @@ import java.nio.ShortBuffer; import java.util.ArrayList; import java.util.Iterator; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; import jogamp.opengl.Debug; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.common.os.Platform; import com.jogamp.common.util.PropertyAccess; @@ -450,7 +451,7 @@ public class ImmModeSink { this.nElems=0; this.tElems=0; - this.pageSize = Platform.getMachineDescription().pageSizeInBytes(); + this.pageSize = Platform.getMachineDataInfo().pageSizeInBytes(); reallocateBuffer(initialElementCount); rewind(); @@ -1376,7 +1377,7 @@ public class ImmModeSink { if(DEBUG_BUFFER) { System.err.println("ImmModeSink.realloc.X: "+this.toString()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return true; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java index 11acb0c58..57f9301b8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java @@ -37,9 +37,9 @@ package com.jogamp.opengl.util; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import jogamp.common.os.PlatformPropsImpl; @@ -660,8 +660,14 @@ public final class PMVMatrix implements GLMatrixFunc { glMultMatrixf( FloatUtil.makeOrtho(mat4Tmp1, 0, true, left, right, bottom, top, zNear, zFar), 0 ); } + /** + * {@inheritDoc} + * + * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, + * or if left == right, or bottom == top, or zNear == zFar. + */ @Override - public final void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) { + public final void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) throws GLException { glMultMatrixf( FloatUtil.makeFrustum(mat4Tmp1, 0, true, left, right, bottom, top, zNear, zFar), 0 ); } @@ -676,8 +682,9 @@ public final class PMVMatrix implements GLMatrixFunc { * @param aspect aspect ratio width / height * @param zNear * @param zFar + * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar. */ - public final void gluPerspective(final float fovy_deg, final float aspect, final float zNear, final float zFar) { + public final void gluPerspective(final float fovy_deg, final float aspect, final float zNear, final float zFar) throws GLException { glMultMatrixf( FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_deg * FloatUtil.PI / 180.0f, aspect, zNear, zFar), 0 ); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java b/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java index 64da547c2..f28774afa 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java @@ -34,11 +34,11 @@ import java.io.OutputStream; import java.nio.ByteBuffer; import java.nio.IntBuffer; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.nativewindow.util.PixelRectangle; -import javax.media.nativewindow.util.PixelFormatUtil; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.PixelFormatUtil; import jogamp.opengl.Debug; import jogamp.opengl.util.pngj.ImageInfo; @@ -137,7 +137,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect { } else { destFmt = ddestFmt; // user choice } - final int destStrideInBytes = Math.max(destMinStrideInBytes, destFmt.bytesPerPixel() * width); + final int destStrideInBytes = Math.max(destMinStrideInBytes, destFmt.comp.bytesPerPixel() * width); final ByteBuffer destPixels = destDirectBuffer ? Buffers.newDirectByteBuffer(destStrideInBytes * height) : ByteBuffer.allocate(destStrideInBytes * height); { @@ -153,7 +153,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect { System.err.println("PNGPixelRect: indexed "+indexed+", alpha "+hasAlpha+", grayscale "+imgInfo.greyscale+", channels "+channels+"/"+imgInfo.channels+ ", bytesPerPixel "+bytesPerPixel+"/"+imgInfo.bytesPixel+ ", grayAlpha "+isGrayAlpha+", pixels "+width+"x"+height+", dpi "+dpiX+"x"+dpiY+", format "+srcFmt); - System.err.println("PNGPixelRect: destFormat "+destFmt+" ("+ddestFmt+", bytesPerPixel "+destFmt.bytesPerPixel()+", fast-path "+(destFmt==srcFmt)+"), destDirectBuffer "+destDirectBuffer+", destIsGLOriented (flip) "+destIsGLOriented); + System.err.println("PNGPixelRect: destFormat "+destFmt+" ("+ddestFmt+", fast-path "+(destFmt==srcFmt)+"), destDirectBuffer "+destDirectBuffer+", destIsGLOriented (flip) "+destIsGLOriented); System.err.println("PNGPixelRect: destStrideInBytes "+destStrideInBytes+" (destMinStrideInBytes "+destMinStrideInBytes+")"); } @@ -227,7 +227,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect { (byte)scanline[lineOff+1], // G (byte)scanline[lineOff+2], // B srcHasAlpha ? (byte)scanline[lineOff+3] : (byte)0xff); // A - final int dbpp = dest_fmt.bytesPerPixel(); + final int dbpp = dest_fmt.comp.bytesPerPixel(); d.put(dOff++, (byte) ( p )); // 1 if( 1 < dbpp ) { d.put(dOff++, (byte) ( p >>> 8 )); // 2 @@ -261,7 +261,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect { if(hasAlpha) { line.scanline[lineOff + 3] = 0xff & ( p >>> 24 ); // A } - return srcOff + pixelformat.bytesPerPixel(); + return srcOff + pixelformat.comp.bytesPerPixel(); } private static void setPixelRGBA8(final PixelFormat pixelformat, final ImageLine line, final int lineOff, final int srcPix, final int bytesPerPixel, final boolean hasAlpha) { @@ -304,7 +304,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect { public void write(final OutputStream outstream, final boolean closeOutstream) throws IOException { final int width = size.getWidth(); final int height = size.getHeight(); - final int bytesPerPixel = pixelformat.bytesPerPixel(); + final int bytesPerPixel = pixelformat.comp.bytesPerPixel(); final ImageInfo imi = new ImageInfo(width, height, 8 /* bitdepth */, (4 == bytesPerPixel) ? true : false /* alpha */, (1 == bytesPerPixel) ? true : false /* grayscale */, @@ -349,7 +349,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect { final OutputStream outstream, final boolean closeOutstream) throws IOException { final int width = size.getWidth(); final int height = size.getHeight(); - final int bytesPerPixel = pixelformat.bytesPerPixel(); + final int bytesPerPixel = pixelformat.comp.bytesPerPixel(); final ImageInfo imi = new ImageInfo(width, height, 8 /* bitdepth */, (4 == bytesPerPixel) ? true : false /* alpha */, (1 == bytesPerPixel) ? true : false /* grayscale */, diff --git a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java index 3b65b0824..94db6e9e4 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java @@ -27,10 +27,10 @@ */ package com.jogamp.opengl.util; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLException; import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; @@ -176,7 +176,7 @@ public class RandomTileRenderer extends TileRendererBase { final int srcY = 0; final int srcWidth = currentTileWidth; final int srcHeight = currentTileHeight; - final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, srcWidth, srcHeight, 1, true); + final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.pfmt.comp.bytesPerPixel(), srcWidth, srcHeight, 1, true); tileBuffer.clear(); if( tileBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) { throw new IndexOutOfBoundsException("Required " + readPixelSize + " bytes of buffer, only had " + tileBuffer); @@ -200,9 +200,9 @@ public class RandomTileRenderer extends TileRendererBase { psm.setPackRowLength(gl2es3, rowLength); /* read the tile into the final image */ - final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, srcWidth, srcHeight, 1, true); + final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.pfmt.comp.bytesPerPixel(), srcWidth, srcHeight, 1, true); - final int ibPos = ( currentTileXPos + ( currentTileYPos * rowLength ) ) * pixelAttribs.bytesPerPixel; // skipPixels + skipRows + final int ibPos = ( currentTileXPos + ( currentTileYPos * rowLength ) ) * pixelAttribs.pfmt.comp.bytesPerPixel(); // skipPixels + skipRows final int ibLim = ibPos + readPixelSize; imageBuffer.clear(); if( imageBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java index d8410a102..b4ddd4ed0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java @@ -36,11 +36,11 @@ */ package com.jogamp.opengl.util; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GLException; import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; @@ -479,7 +479,7 @@ public class TileRenderer extends TileRendererBase { final int srcY = tileBorder; final int srcWidth = tileSizeNB.getWidth(); final int srcHeight = tileSizeNB.getHeight(); - final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, srcWidth, srcHeight, 1, true); + final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.pfmt.comp.bytesPerPixel(), srcWidth, srcHeight, 1, true); tileBuffer.clear(); if( tileBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) { throw new IndexOutOfBoundsException("Required " + readPixelSize + " bytes of buffer, only had " + tileBuffer); @@ -503,11 +503,11 @@ public class TileRenderer extends TileRendererBase { psm.setPackRowLength(gl2es3, rowLength); /* read the tile into the final image */ - final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, srcWidth, srcHeight, 1, true); + final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.pfmt.comp.bytesPerPixel(), srcWidth, srcHeight, 1, true); final int skipPixels = currentColumn * tileSizeNB.getWidth(); final int skipRows = currentRow * tileSizeNB.getHeight(); - final int ibPos = ( skipPixels + ( skipRows * rowLength ) ) * pixelAttribs.bytesPerPixel; + final int ibPos = ( skipPixels + ( skipRows * rowLength ) ) * pixelAttribs.pfmt.comp.bytesPerPixel(); final int ibLim = ibPos + readPixelSize; imageBuffer.clear(); if( imageBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java index a1735766e..df73f6f3a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java @@ -36,15 +36,15 @@ */ package com.jogamp.opengl.util; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; import jogamp.opengl.Debug; /** diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java index 2ad102235..662cf74b7 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java @@ -27,9 +27,9 @@ */ package com.jogamp.opengl.util.av; -import javax.media.opengl.GL; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; import jogamp.opengl.Debug; diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java index 04bc0a15d..6b0b3784d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java @@ -36,10 +36,14 @@ import java.awt.image.SinglePixelPackedSampleModel; import java.awt.image.WritableRaster; import java.nio.Buffer; import java.nio.IntBuffer; +import java.util.Iterator; -import javax.media.opengl.GL; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLProfile; import com.jogamp.common.nio.Buffers; +import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.opengl.util.GLPixelBuffer; /** @@ -50,7 +54,7 @@ import com.jogamp.opengl.util.GLPixelBuffer; * </p> * <p> * {@link AWTGLPixelBuffer} can be produced via {@link AWTGLPixelBufferProvider}'s - * {@link AWTGLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocate(..)}. + * {@link AWTGLPixelBufferProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocate(..)}. * </p> * <p> * See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)} for {@link #allowRowStride} details. @@ -61,30 +65,49 @@ import com.jogamp.opengl.util.GLPixelBuffer; * </p> */ public class AWTGLPixelBuffer extends GLPixelBuffer { - public static final GLPixelAttributes awtPixelAttributesIntRGBA4 = new GLPixelAttributes(4, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE); - public static final GLPixelAttributes awtPixelAttributesIntRGB3 = new GLPixelAttributes(3, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE); + /** + * Ignoring componentCount, since otherwise no AWT/GL matching types are found. + * <p> + * Due to using RGBA and BGRA, pack/unpack usage has makes no difference. + * </p> + */ + private static final GLPixelAttributes awtPixelAttributesIntBGRA = new GLPixelAttributes(GL.GL_BGRA, GL.GL_UNSIGNED_BYTE); + private static final GLPixelAttributes awtPixelAttributesIntRGBA = new GLPixelAttributes(GL.GL_RGBA, GL.GL_UNSIGNED_BYTE); /** The underlying {@link BufferedImage}. */ public final BufferedImage image; + private final PixelFormat.Composition hostPixelComp; + private final int awtFormat; + /** - * + * @param hostPixelComp the host {@link PixelFormat.Composition} * @param pixelAttributes the desired {@link GLPixelAttributes} + * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}. + * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}. + * @param awtFormat the used AWT format, i.e. {@link AWTGLPixelBufferProvider#getAWTFormat(GLProfile, int)} * @param width in pixels * @param height in pixels * @param depth in pixels - * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU * @param image the AWT image * @param buffer the backing array * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}. * If <code>true</code>, user shall decide whether to use a {@link #getAlignedImage(int, int) width-aligned image}. */ - public AWTGLPixelBuffer(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final BufferedImage image, - final Buffer buffer, final boolean allowRowStride) { - super(pixelAttributes, width, height, depth, pack, buffer, allowRowStride); + public AWTGLPixelBuffer(final PixelFormat.Composition hostPixelComp, + final GLPixelAttributes pixelAttributes, + final boolean pack, + final int awtFormat, final int width, final int height, final int depth, + final BufferedImage image, final Buffer buffer, final boolean allowRowStride) { + super(pixelAttributes, pack, width, height, depth, buffer, allowRowStride); this.image = image; + this.hostPixelComp = hostPixelComp; + this.awtFormat = awtFormat; } + public final PixelFormat.Composition getHostPixelComp() { return hostPixelComp; } + public final int getAWTFormat() { return awtFormat; } + @Override public void dispose() { image.flush(); @@ -147,12 +170,57 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { public AWTGLPixelBufferProvider(final boolean allowRowStride) { this.allowRowStride = allowRowStride; } + @Override public boolean getAllowRowStride() { return allowRowStride; } @Override - public GLPixelAttributes getAttributes(final GL gl, final int componentCount) { - return 4 == componentCount ? awtPixelAttributesIntRGBA4 : awtPixelAttributesIntRGB3; + public GLPixelAttributes getAttributes(final GL gl, final int componentCount, final boolean pack) { + return gl.isGLES() ? awtPixelAttributesIntRGBA : awtPixelAttributesIntBGRA; + } + + public GLPixelAttributes getAttributes(final GLProfile glp, final int componentCount) { + return glp.isGLES() ? awtPixelAttributesIntRGBA : awtPixelAttributesIntBGRA; + } + + /** + * {@inheritDoc} + * <p> + * Returns a valid {@link PixelFormat.Composition} instance from {@link #getAWTPixelFormat(GLProfile, int)}. + * </p> + */ + @Override + public PixelFormat.Composition getHostPixelComp(final GLProfile glp, final int componentCount) { + return getAWTPixelFormat(glp, componentCount).comp; + } + + /** + * Returns one of + * <ul> + * <li>GL__, 4c -> 4c: {@link BufferedImage#TYPE_INT_ARGB} <-> {@link GL#GL_BGRA}</li> + * <li>GLES, 4c -> 4c: {@link BufferedImage#TYPE_INT_BGR} <-> {@link GL#GL_RGBA}</li> + * <li>GL__, 3c -> 4c: {@link BufferedImage#TYPE_INT_RGB} <-> {@link GL#GL_BGRA}</li> + * <li>GLES, 3c -> 4c: {@link BufferedImage#TYPE_INT_BGR} <-> {@link GL#GL_RGBA}</li> + * </ul> + * @param glp + * @param componentCount + * @return + */ + public int getAWTFormat(final GLProfile glp, final int componentCount) { + if( 4 == componentCount ) { + // FIXME: 4 component solution BufferedImage.TYPE_INT_ARGB: GLES format missing (i.e. GL_BGRA) + return glp.isGLES() ? BufferedImage.TYPE_INT_BGR : BufferedImage.TYPE_INT_ARGB; + } else { + return glp.isGLES() ? BufferedImage.TYPE_INT_BGR : BufferedImage.TYPE_INT_RGB; + } + } + + public PixelFormat getAWTPixelFormat(final GLProfile glp, final int componentCount) { + if( 4 == componentCount ) { + return glp.isGLES() ? PixelFormat.RGBx8888 : PixelFormat.BGRA8888; + } else { + return glp.isGLES() ? PixelFormat.RGBx8888 : PixelFormat.BGRx8888; + } } /** @@ -162,11 +230,17 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * </p> */ @Override - public AWTGLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { - final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB); + public AWTGLPixelBuffer allocate(final GL gl, final PixelFormat.Composition hostPixComp, final GLPixelAttributes pixelAttributes, final boolean pack, + final int width, final int height, final int depth, final int minByteSize) { + if( null == hostPixComp ) { + throw new IllegalArgumentException("Null hostPixComp"); + } + final int awtFormat = getAWTFormat(gl.getGLProfile(), hostPixComp.componenCount()); + final BufferedImage image = new BufferedImage(width, height, awtFormat); final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer ); - return new AWTGLPixelBuffer(pixelAttributes, width, height, depth, pack, image, ibuffer, allowRowStride); + return new AWTGLPixelBuffer(hostPixComp, pixelAttributes, pack, + awtFormat, width, height, depth, image, ibuffer, allowRowStride); } } @@ -174,15 +248,22 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * Provider for singleton {@link AWTGLPixelBuffer} instances. * <p> * Provider instance holds the last {@link AWTGLPixelBuffer} instance - * {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}. - * A new {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocation} + * {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocated}. + * A new {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocation} * will return same instance, if a new buffer is not {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int) required}. * The latter is true if size are compatible, hence <code>allowRowStride</code> should be enabled, if possible. * </p> */ public static class SingleAWTGLPixelBufferProvider extends AWTGLPixelBufferProvider implements SingletonGLPixelBufferProvider { - private AWTGLPixelBuffer singleRGBA4 = null; - private AWTGLPixelBuffer singleRGB3 = null; + private final IntObjectHashMap bufferMap = new IntObjectHashMap(8); + + private static int getHashCode(final PixelFormat.Composition hostPixelComp, final GLPixelAttributes pixelAttributes, final boolean pack) { + // 31 * x == (x << 5) - x + int hash = hostPixelComp.hashCode(); + hash = ((hash << 5) - hash) + pixelAttributes.hashCode(); + // hash = ((hash << 5) - hash) + (pack ? 100 : 0); // no difference due to RGBA/BGRA only modes. + return hash; + } /** * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. @@ -198,52 +279,72 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * </p> */ @Override - public AWTGLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { - if( 4 == pixelAttributes.componentCount ) { - if( null == singleRGBA4 || singleRGBA4.requiresNewBuffer(gl, width, height, minByteSize) ) { - singleRGBA4 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize); - } - return singleRGBA4; - } else { - if( null == singleRGB3 || singleRGB3.requiresNewBuffer(gl, width, height, minByteSize) ) { - singleRGB3 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize); + public AWTGLPixelBuffer allocate(final GL gl, PixelFormat.Composition hostPixComp, final GLPixelAttributes pixelAttributes, + final boolean pack, final int width, final int height, final int depth, final int minByteSize) { + if( null == hostPixComp ) { + hostPixComp = pixelAttributes.pfmt.comp; + } + final int bufferKey = getHashCode(hostPixComp, pixelAttributes, pack); + AWTGLPixelBuffer r = (AWTGLPixelBuffer) bufferMap.get(bufferKey); + if( null == r || r.requiresNewBuffer(gl, width, height, minByteSize) ) { + if( null != r ) { + r.dispose(); } - return singleRGB3; + r = allocateImpl(hostPixComp, pixelAttributes, pack, + getAWTFormat(gl.getGLProfile(), hostPixComp.componenCount()), width, height, depth, minByteSize); + bufferMap.put(bufferKey, r); } + return r; } - private AWTGLPixelBuffer allocateImpl(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { - final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB); + private AWTGLPixelBuffer allocateImpl(final PixelFormat.Composition hostPixComp, + final GLPixelAttributes pixelAttributes, + final boolean pack, + final int awtFormat, final int width, final int height, final int depth, + final int minByteSize) { + final BufferedImage image = new BufferedImage(width, height, awtFormat); final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer ); - return new AWTGLPixelBuffer(pixelAttributes, width, height, depth, pack, image, ibuffer, getAllowRowStride()); + return new AWTGLPixelBuffer(hostPixComp, pixelAttributes, pack, + awtFormat, width, height, depth, image, ibuffer, getAllowRowStride()); } - /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link AWTGLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */ + /** + * Return the last {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocated} + * {@link AWTGLPixelBuffer}, if compatible w/ the given {@link PixelFormat.Composition} and {@link GLPixelAttributes}. + **/ @Override - public AWTGLPixelBuffer getSingleBuffer(final GLPixelAttributes pixelAttributes) { - return 4 == pixelAttributes.componentCount ? singleRGBA4 : singleRGB3; + public AWTGLPixelBuffer getSingleBuffer(final PixelFormat.Composition hostPixelComp, final GLPixelAttributes pixelAttributes, final boolean pack) { + return (AWTGLPixelBuffer) bufferMap.get(getHashCode(hostPixelComp, pixelAttributes, pack)); } /** - * Initializes the single {@link AWTGLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}. + * Initializes the single {@link AWTGLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocated}. * @return the newly initialized single {@link AWTGLPixelBuffer}, or null if already allocated. */ @Override - public AWTGLPixelBuffer initSingleton(final int componentCount, final int width, final int height, final int depth, final boolean pack) { - if( 4 == componentCount ) { - if( null != singleRGBA4 ) { - return null; - } - singleRGBA4 = allocateImpl(AWTGLPixelBuffer.awtPixelAttributesIntRGBA4, width, height, depth, pack, 0); - return singleRGBA4; - } else { - if( null != singleRGB3 ) { - return null; - } - singleRGB3 = allocateImpl(AWTGLPixelBuffer.awtPixelAttributesIntRGB3, width, height, depth, pack, 0); - return singleRGB3; + public AWTGLPixelBuffer initSingleton(final GLProfile glp, final int componentCount, + final boolean pack, final int width, final int height, final int depth) { + final GLPixelAttributes pixelAttributes = getAttributes(glp, componentCount); + final PixelFormat awtPixelFormat = getAWTPixelFormat(glp, componentCount); + final int awtFormat = getAWTFormat(glp, componentCount); + final int bufferKey = getHashCode(awtPixelFormat.comp, pixelAttributes, pack); + AWTGLPixelBuffer r = (AWTGLPixelBuffer) bufferMap.get(bufferKey); + if( null != r ) { + return null; + } + r = allocateImpl(awtPixelFormat.comp, pixelAttributes, pack, awtFormat, width, height, depth, 0); + bufferMap.put(bufferKey, r); + return r; + } + + @Override + public void dispose() { + for(final Iterator<IntObjectHashMap.Entry> i=bufferMap.iterator(); i.hasNext(); ) { + final AWTGLPixelBuffer b = (AWTGLPixelBuffer)i.next().value; + b.dispose(); } + bufferMap.clear(); } } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java index b75ad3b17..aad94aae6 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java @@ -29,9 +29,9 @@ package com.jogamp.opengl.util.awt; import java.awt.image.BufferedImage; -import javax.media.opengl.GL; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.GLReadBufferUtil; diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java index a78bc9bb3..ee9e1314e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java @@ -41,7 +41,7 @@ package com.jogamp.opengl.util.awt; import java.awt.Graphics2D; -import javax.media.opengl.*; +import com.jogamp.opengl.*; /** Provides a Java 2D overlay on top of an arbitrary GLDrawable, making it easier to do things like draw text and images on top of diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java index fc0861eaa..e6f5aaa2e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java @@ -64,10 +64,10 @@ import java.nio.*; import java.text.*; import java.util.*; -import javax.media.opengl.*; -import javax.media.opengl.fixedfunc.GLPointerFunc; -import javax.media.opengl.glu.*; -import javax.media.opengl.awt.*; +import com.jogamp.opengl.*; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.glu.*; +import com.jogamp.opengl.awt.*; import jogamp.opengl.Debug; @@ -81,15 +81,15 @@ import jogamp.opengl.Debug; Using the {@link TextRenderer TextRenderer} is simple. Add a "<code>TextRenderer renderer;</code>" field to your {@link - javax.media.opengl.GLEventListener GLEventListener}. In your {@link - javax.media.opengl.GLEventListener#init init} method, add: + com.jogamp.opengl.GLEventListener GLEventListener}. In your {@link + com.jogamp.opengl.GLEventListener#init init} method, add: <PRE> renderer = new TextRenderer(new Font("SansSerif", Font.BOLD, 36)); </PRE> - <P> In the {@link javax.media.opengl.GLEventListener#display display} method of your - {@link javax.media.opengl.GLEventListener GLEventListener}, add: + <P> In the {@link com.jogamp.opengl.GLEventListener#display display} method of your + {@link com.jogamp.opengl.GLEventListener GLEventListener}, add: <PRE> renderer.beginRendering(drawable.getWidth(), drawable.getHeight()); // optionally set the color @@ -381,7 +381,7 @@ public class TextRenderer { @param width the width of the current on-screen OpenGL drawable @param height the height of the current on-screen OpenGL drawable - @throws javax.media.opengl.GLException If an OpenGL context is not current when this method is called + @throws com.jogamp.opengl.GLException If an OpenGL context is not current when this method is called */ public void beginRendering(final int width, final int height) throws GLException { beginRendering(width, height, true); diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java index ef59f9fa0..c8b365235 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java @@ -47,10 +47,10 @@ import java.awt.Image; import java.awt.Rectangle; import java.awt.image.*; -import javax.media.opengl.*; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.glu.gl2.*; +import com.jogamp.opengl.*; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.glu.gl2.*; import com.jogamp.opengl.util.texture.*; import com.jogamp.opengl.util.texture.awt.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java index 92cbd66da..752d56827 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java @@ -39,10 +39,10 @@ package com.jogamp.opengl.util.gl2; -import javax.media.opengl.*; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.glu.*; -import javax.media.opengl.glu.gl2.*; +import com.jogamp.opengl.*; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.glu.*; +import com.jogamp.opengl.glu.gl2.*; /** Subset of the routines provided by the GLUT interface. Note the signatures of many of the methods are necessarily different than diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java index 3b8706a24..bb1c5e9b1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java @@ -44,13 +44,13 @@ import java.util.Arrays; import java.util.Iterator; import java.util.Set; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL3; -import javax.media.opengl.GL4; -import javax.media.opengl.GLES2; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL3; +import com.jogamp.opengl.GL4; +import com.jogamp.opengl.GLES2; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; import jogamp.opengl.Debug; @@ -1049,7 +1049,7 @@ public class ShaderCode { public static final boolean requiresGL3DefaultPrecision(final GL2ES2 gl) { if( gl.isGL3() ) { final VersionNumber glslVersion = gl.getContext().getGLSLVersionNumber(); - return glslVersion.compareTo(GLContext.Version130) >= 0 && glslVersion.compareTo(GLContext.Version150) < 0 ; + return glslVersion.compareTo(GLContext.Version1_30) >= 0 && glslVersion.compareTo(GLContext.Version1_50) < 0 ; } else { return false; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java index a9b0bddc6..63455ba51 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java @@ -28,7 +28,7 @@ package com.jogamp.opengl.util.glsl; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.os.Platform; diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java index d758fc121..e06f7be00 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java @@ -32,14 +32,15 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLArrayData; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLArrayData; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; import jogamp.opengl.Debug; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.os.Platform; import com.jogamp.common.util.PropertyAccess; import com.jogamp.opengl.util.GLArrayDataEditable; @@ -161,7 +162,7 @@ public class ShaderState { final int newId = (null!=prog)?prog.id():-1; System.err.println("ShaderState: attachShaderProgram: "+curId+" -> "+newId+" (enable: "+enable+")\n\t"+shaderProgram+"\n\t"+prog); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } if(null!=shaderProgram) { @@ -340,7 +341,7 @@ public class ShaderState { * @throws GLException if no program is attached * @throws GLException if the program is already linked * - * @see javax.media.opengl.GL2ES2#glBindAttribLocation(int, int, String) + * @see com.jogamp.opengl.GL2ES2#glBindAttribLocation(int, int, String) * @see #getAttribLocation(GL2ES2, String) * @see #getCachedAttribLocation(String) */ @@ -361,7 +362,7 @@ public class ShaderState { * @throws GLException if no program is attached * @throws GLException if the program is already linked * - * @see javax.media.opengl.GL2ES2#glBindAttribLocation(int, int, String) + * @see com.jogamp.opengl.GL2ES2#glBindAttribLocation(int, int, String) * @see #getAttribLocation(GL2ES2, String) * @see #getCachedAttribLocation(String) * @see #getAttribute(String) @@ -405,7 +406,7 @@ public class ShaderState { } else if(verbose) { System.err.println("ShaderState: glGetAttribLocation failed, no location for: "+name+", loc: "+location); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } @@ -448,7 +449,7 @@ public class ShaderState { } else if(verbose) { System.err.println("ShaderState: glGetAttribLocation failed, no location for: "+name+", loc: "+location); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } @@ -483,7 +484,7 @@ public class ShaderState { if(verbose) { System.err.println("ShaderState: glEnableVertexAttribArray failed, no index for: "+name); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return false; @@ -558,7 +559,7 @@ public class ShaderState { if(verbose) { System.err.println("ShaderState: glDisableVertexAttribArray failed, no index for: "+name); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return false; @@ -860,7 +861,7 @@ public class ShaderState { * @throws GLException is the program is not linked * * @see #glGetUniformLocation - * @see javax.media.opengl.GL2ES2#glGetUniformLocation + * @see com.jogamp.opengl.GL2ES2#glGetUniformLocation * @see #getUniformLocation * @see ShaderProgram#glReplaceShader */ @@ -875,7 +876,7 @@ public class ShaderState { } else if(verbose) { System.err.println("ShaderState: glUniform failed, no location for: "+name+", index: "+location); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } @@ -898,7 +899,7 @@ public class ShaderState { * @throws GLException is the program is not linked * * @see #glGetUniformLocation - * @see javax.media.opengl.GL2ES2#glGetUniformLocation + * @see com.jogamp.opengl.GL2ES2#glGetUniformLocation * @see #getUniformLocation * @see ShaderProgram#glReplaceShader */ @@ -916,7 +917,7 @@ public class ShaderState { } else if(verbose) { System.err.println("ShaderState: glUniform failed, no location for: "+name+", index: "+location); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } @@ -935,8 +936,8 @@ public class ShaderState { * @return false, if the location could not be determined, otherwise true * * @see #glGetUniformLocation - * @see javax.media.opengl.GL2ES2#glGetUniformLocation - * @see javax.media.opengl.GL2ES2#glUniform + * @see com.jogamp.opengl.GL2ES2#glGetUniformLocation + * @see com.jogamp.opengl.GL2ES2#glUniform * @see #getUniformLocation * @see ShaderProgram#glReplaceShader */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java index 06f7d9268..165a5167a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java @@ -37,7 +37,7 @@ import java.io.PrintStream; import java.nio.*; import java.util.*; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.GLExtensions; @@ -221,7 +221,7 @@ public class ShaderUtil { /** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */ public static boolean isGeometryShaderSupported(final GL _gl) { final GLContext ctx = _gl.getContext(); - return ctx.getGLVersionNumber().compareTo(GLContext.Version320) >= 0 || + return ctx.getGLVersionNumber().compareTo(GLContext.Version3_2) >= 0 || ctx.isExtensionAvailable(GLExtensions.ARB_geometry_shader4); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java index 1ed875f27..37bca895a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java @@ -4,12 +4,12 @@ package com.jogamp.opengl.util.glsl.fixedfunc; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLPointerFuncUtil; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLPointerFuncUtil; import jogamp.opengl.util.glsl.fixedfunc.FixedFuncHook; import jogamp.opengl.util.glsl.fixedfunc.FixedFuncImpl; @@ -77,18 +77,18 @@ public class FixedFuncUtil { * Useful for uniq mapping of canonical array index names as listed. * * @see #mgl_Vertex - * @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_VERTEX_ARRAY + * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#GL_VERTEX_ARRAY * @see #mgl_Normal - * @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_NORMAL_ARRAY + * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#GL_NORMAL_ARRAY * @see #mgl_Color - * @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_COLOR_ARRAY + * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#GL_COLOR_ARRAY * @see #mgl_MultiTexCoord - * @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_TEXTURE_COORD_ARRAY - * @see javax.media.opengl.fixedfunc.GLPointerFunc#glEnableClientState - * @see javax.media.opengl.fixedfunc.GLPointerFunc#glVertexPointer - * @see javax.media.opengl.fixedfunc.GLPointerFunc#glColorPointer - * @see javax.media.opengl.fixedfunc.GLPointerFunc#glNormalPointer - * @see javax.media.opengl.fixedfunc.GLPointerFunc#glTexCoordPointer + * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#GL_TEXTURE_COORD_ARRAY + * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#glEnableClientState + * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#glVertexPointer + * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#glColorPointer + * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#glNormalPointer + * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#glTexCoordPointer */ public static String getPredefinedArrayIndexName(final int glArrayIndex) { return GLPointerFuncUtil.getPredefinedArrayIndexName(glArrayIndex); @@ -96,25 +96,25 @@ public class FixedFuncUtil { /** * String name for - * @see javax.media.opengl.GL2#GL_VERTEX_ARRAY + * @see com.jogamp.opengl.GL2#GL_VERTEX_ARRAY */ public static final String mgl_Vertex = GLPointerFuncUtil.mgl_Vertex; /** * String name for - * @see javax.media.opengl.GL2#GL_NORMAL_ARRAY + * @see com.jogamp.opengl.GL2#GL_NORMAL_ARRAY */ public static final String mgl_Normal = GLPointerFuncUtil.mgl_Normal; /** * String name for - * @see javax.media.opengl.GL2#GL_COLOR_ARRAY + * @see com.jogamp.opengl.GL2#GL_COLOR_ARRAY */ public static final String mgl_Color = GLPointerFuncUtil.mgl_Color; /** * String name for - * @see javax.media.opengl.GL2#GL_TEXTURE_COORD_ARRAY + * @see com.jogamp.opengl.GL2#GL_TEXTURE_COORD_ARRAY */ public static final String mgl_MultiTexCoord = GLPointerFuncUtil.mgl_MultiTexCoord; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java index 1d629131e..f5dec1cab 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java @@ -2,7 +2,7 @@ package com.jogamp.opengl.util.glsl.sdk; import com.jogamp.common.util.IOUtil; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.glsl.*; import java.io.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java index 9ff37c7ee..ae289acf7 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java @@ -1,6 +1,6 @@ package com.jogamp.opengl.util.glsl.sdk; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import java.io.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java index f70ebf928..fad07b026 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java @@ -27,12 +27,12 @@ */ package com.jogamp.opengl.util.stereo; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; import jogamp.opengl.GLDrawableHelper; import jogamp.opengl.GLDrawableHelper.GLEventListenerAction; diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java index d32c981a3..302e783a2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java +++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.util.stereo; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.PointImmutable; import jogamp.opengl.Debug; diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java index ab9ba99a1..68ae3241b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java @@ -27,9 +27,9 @@ */ package com.jogamp.opengl.util.stereo; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.opengl.GL; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.opengl.GL; import com.jogamp.opengl.math.FovHVHalves; @@ -45,8 +45,8 @@ import com.jogamp.opengl.math.FovHVHalves; * <li>device.{@link #updateEyePose(int)}</li> * <li>if device.{@link #ppAvailable()}: Set the render target, e.g. FBO</li> * <li>Set the viewport using {@link Eye#getViewport()}</li> - * <li>{@link StereoGLEventListener#reshapeForEye(javax.media.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, EyePose) upstream.reshapeEye(..)}</li> - * <li>{@link StereoGLEventListener#display(javax.media.opengl.GLAutoDrawable, int) upstream.display(..)}.</li> + * <li>{@link StereoGLEventListener#reshapeForEye(com.jogamp.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, EyePose) upstream.reshapeEye(..)}</li> + * <li>{@link StereoGLEventListener#display(com.jogamp.opengl.GLAutoDrawable, int) upstream.display(..)}.</li> * </ul></li> * <li>Reset the viewport</li> * <li>If device.{@link #ppAvailable()}:<ul> diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java index ec580cbf9..c1a06796c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java +++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.util.stereo; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.util.CustomGLEventListener; diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java index 3031013b8..3e4e7ccd9 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java @@ -75,7 +75,7 @@ public class StereoUtil { * <p> * This method merely exist as an example implementation to compute the matrices, * which shall be adopted by the - * {@link CustomGLEventListener#reshape(javax.media.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, EyePose) upstream client code}. + * {@link CustomGLEventListener#reshape(com.jogamp.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, EyePose) upstream client code}. * </p> * @param eyeNum eye denominator * @param zNear frustum near value diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java index f5ef5672f..0f51c2e14 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java @@ -32,9 +32,9 @@ import java.net.URLConnection; import java.util.ArrayList; import java.util.List; -import javax.media.opengl.GL; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import com.jogamp.common.util.IOUtil; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java index e7693f4a6..18a7527b6 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java @@ -39,9 +39,9 @@ package com.jogamp.opengl.util.texture; import java.nio.*; -import javax.media.opengl.*; -import javax.media.opengl.glu.*; -import javax.media.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.*; +import com.jogamp.opengl.glu.*; +import com.jogamp.nativewindow.NativeWindowFactory; import jogamp.opengl.*; @@ -346,8 +346,8 @@ public class Texture { * Returns the OpenGL "target" of this texture. * * @return the OpenGL target of this texture - * @see javax.media.opengl.GL#GL_TEXTURE_2D - * @see javax.media.opengl.GL2#GL_TEXTURE_RECTANGLE_ARB + * @see com.jogamp.opengl.GL#GL_TEXTURE_2D + * @see com.jogamp.opengl.GL2#GL_TEXTURE_RECTANGLE_ARB */ public int getTarget() { return target; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java index 5b2e4fc00..ce1acc6d7 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java @@ -39,7 +39,7 @@ package com.jogamp.opengl.util.texture; import java.nio.Buffer; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLProfile; import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.GLBuffers; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java index 6011afe7b..27571ae0d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java @@ -55,15 +55,15 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.Debug; @@ -1125,12 +1125,12 @@ public class TextureIO { final String fileSuffix) throws IOException { if (PNG.equals(fileSuffix)) { final PNGPixelRect image = PNGPixelRect.read(stream, null, true /* directBuffer */, 0 /* destMinStrideInBytes */, true /* destIsGLOriented */); - final GLPixelAttributes glpa = GLPixelAttributes.convert(image.getPixelformat(), glp); + final GLPixelAttributes glpa = new GLPixelAttributes(glp, image.getPixelformat(), false /* pack */); if ( 0 == pixelFormat ) { pixelFormat = glpa.format; } // else FIXME: Actually not supported w/ preset pixelFormat! if ( 0 == internalFormat ) { - final boolean hasAlpha = 4 == glpa.bytesPerPixel; + final boolean hasAlpha = 4 == glpa.pfmt.comp.bytesPerPixel(); if(glp.isGL2ES3()) { internalFormat = hasAlpha ? GL.GL_RGBA8 : GL.GL_RGB8; } else { @@ -1351,8 +1351,8 @@ public class TextureIO { final GLPixelAttributes pixelAttribs = data.getPixelAttributes(); final int pixelFormat = pixelAttribs.format; final int pixelType = pixelAttribs.type; - final int bytesPerPixel = pixelAttribs.bytesPerPixel; - final PixelFormat pixFmt = pixelAttribs.getPixelFormat(); + final int bytesPerPixel = pixelAttribs.pfmt.comp.bytesPerPixel(); + final PixelFormat pixFmt = pixelAttribs.pfmt; if ( ( 1 == bytesPerPixel || 3 == bytesPerPixel || 4 == bytesPerPixel) && ( pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { Buffer buf0 = data.getBuffer(); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java index 5add4f695..7147fd61b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java @@ -27,10 +27,10 @@ */ package com.jogamp.opengl.util.texture; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.util.TimeFrameI; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java index 467ab41c5..1866c5921 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java @@ -27,11 +27,11 @@ */ package com.jogamp.opengl.util.texture; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GL3; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GL3; +import com.jogamp.opengl.GLException; /** * Preserves a [ texture-unit, texture-target ] state. diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java index ccb3ecc3c..aa0be8e9b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java @@ -60,11 +60,11 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; import com.jogamp.opengl.util.texture.TextureData; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java index c3b3adc75..2b21ef8e4 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java @@ -41,7 +41,7 @@ package com.jogamp.opengl.util.texture.awt; import java.awt.image.*; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.texture.*; public class AWTTextureIO extends TextureIO { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java index 20fc92819..a71458837 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java @@ -50,7 +50,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.channels.FileChannel; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java index 66a486f9b..0d82528a2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java @@ -31,7 +31,7 @@ import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; import jogamp.opengl.Debug; import jogamp.opengl.util.jpeg.JPEGDecoder; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java index 461ddceb8..700de593f 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java @@ -43,7 +43,7 @@ import java.io.*; import java.nio.*; import java.nio.channels.FileChannel; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.util.IOUtil; import com.jogamp.opengl.util.texture.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java index 27549dfe3..9088dc48e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java @@ -40,7 +40,7 @@ package com.jogamp.opengl.util.texture.spi; import java.io.*; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.util.IOUtil; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java index 28823abb3..bb872714c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java @@ -42,7 +42,7 @@ package com.jogamp.opengl.util.texture.spi; import java.io.*; import java.nio.*; import java.nio.channels.*; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.util.IOUtil; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java index 0299531b1..e84f300e2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java @@ -41,7 +41,7 @@ package com.jogamp.opengl.util.texture.spi; import java.io.*; import java.net.*; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.texture.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java index 4174adf52..ba762baf3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java @@ -44,7 +44,7 @@ import java.awt.image.*; import java.io.*; import java.net.*; import javax.imageio.*; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.Debug; import com.jogamp.opengl.util.texture.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java index 60ac5680e..35a2f8422 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java @@ -45,7 +45,7 @@ import java.io.*; import java.nio.*; import javax.imageio.*; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.util.IOUtil; import com.jogamp.opengl.util.awt.*; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java index fbd40ebdd..3010fa5ff 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java @@ -29,9 +29,9 @@ package jogamp.graph.curve.opengl; import java.nio.FloatBuffer; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL; -import javax.media.opengl.GLUniformData; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLUniformData; import jogamp.graph.curve.opengl.shader.AttributeNames; import jogamp.graph.curve.opengl.shader.UniformNames; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java index 8f1de9157..092cc55c1 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java @@ -29,9 +29,9 @@ package jogamp.graph.curve.opengl; import java.nio.FloatBuffer; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL; -import javax.media.opengl.GLUniformData; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLUniformData; import jogamp.graph.curve.opengl.shader.AttributeNames; import jogamp.graph.curve.opengl.shader.UniformNames; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 46e991866..a8e74aed5 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -29,9 +29,9 @@ package jogamp.graph.curve.opengl; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLUniformData; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLUniformData; import jogamp.graph.curve.opengl.shader.AttributeNames; import jogamp.graph.curve.opengl.shader.UniformNames; diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java index da651cca9..68586dfc5 100644 --- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java @@ -35,7 +35,7 @@ import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GLException; import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.graph.font.Font; diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java index bbf022657..e4b0cb2a8 100644 --- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java @@ -29,9 +29,11 @@ package jogamp.graph.font; import java.io.IOException; import java.io.InputStream; +import java.net.URLConnection; import com.jogamp.common.net.Uri; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.common.util.JarUtil; import com.jogamp.common.util.cache.TempJarCache; @@ -170,20 +172,26 @@ public class UbuntuFontLoader implements FontSet { } } private Font abspathImpl(final String fname, final int family, final int style) throws IOException { - final Exception[] privErr = { null }; - final InputStream stream = AccessController.doPrivileged(new PrivilegedAction<InputStream>() { - @Override - public InputStream run() { - try { - final Uri uri = TempJarCache.getResourceUri(fname); - return null != uri ? uri.toURL().openConnection().getInputStream() : null; - } catch (final Exception e) { - privErr[0] = e; - return null; - } - } } ); - if( null != privErr[0] ) { - throw new IOException(privErr[0]); + final InputStream stream; + if( useTempJARCache ) { + final Exception[] privErr = { null }; + stream = AccessController.doPrivileged(new PrivilegedAction<InputStream>() { + @Override + public InputStream run() { + try { + final Uri uri = TempJarCache.getResourceUri(fname); + return null != uri ? uri.toURL().openConnection().getInputStream() : null; + } catch (final Exception e) { + privErr[0] = e; + return null; + } + } } ); + if( null != privErr[0] ) { + throw new IOException(privErr[0]); + } + } else { + final URLConnection urlConn = IOUtil.getResource(UbuntuFontLoader.class, fname); + stream = null != urlConn ? urlConn.getInputStream() : null; } if(null != stream) { final Font f= FontFactory.get ( stream, true ) ; diff --git a/src/jogl/classes/jogamp/opengl/Debug.java b/src/jogl/classes/jogamp/opengl/Debug.java index 5bee56d4b..5273eead7 100644 --- a/src/jogl/classes/jogamp/opengl/Debug.java +++ b/src/jogl/classes/jogamp/opengl/Debug.java @@ -51,7 +51,7 @@ public class Debug extends PropertyAccess { verbose = isPropertyDefined("jogl.verbose", true); debugAll = isPropertyDefined("jogl.debug", true); if (verbose) { - final Package p = Package.getPackage("javax.media.opengl"); + final Package p = Package.getPackage("com.jogamp.opengl"); System.err.println("JOGL specification version " + p.getSpecificationVersion()); System.err.println("JOGL implementation version " + p.getImplementationVersion()); System.err.println("JOGL implementation vendor " + p.getImplementationVendor()); diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java index 1b33e1a8b..331414869 100644 --- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java +++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java @@ -43,10 +43,10 @@ package jogamp.opengl; import java.util.HashMap; import java.util.StringTokenizer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; import com.jogamp.common.util.VersionNumber; diff --git a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java index d7ac6eb1e..7f8f262e9 100644 --- a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java +++ b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java @@ -30,7 +30,7 @@ package jogamp.opengl; import java.io.PrintStream; import java.util.concurrent.TimeUnit; -import javax.media.opengl.FPSCounter; +import com.jogamp.opengl.FPSCounter; /** * Default implementation of FPSCounter to be used for FPSCounter implementing renderer. diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index 8fa4c581a..19fd6c7e1 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -31,24 +31,24 @@ package jogamp.opengl; import java.io.PrintStream; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.WindowClosingProtocol; -import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; -import javax.media.opengl.FPSCounter; -import javax.media.opengl.GL; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.GLSharedContextSetter; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.WindowClosingProtocol; +import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode; +import com.jogamp.opengl.FPSCounter; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.GLSharedContextSetter; import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.locks.RecursiveLock; diff --git a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java index 7e49b3464..2fa282d6e 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java @@ -32,8 +32,9 @@ import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; -import javax.media.opengl.*; +import com.jogamp.opengl.*; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.common.util.PropertyAccess; @@ -266,7 +267,7 @@ public class GLBufferObjectTracker { if( null == objOld ) { if (DEBUG) { System.err.printf("%s: %s.notifyBuffersDeleted()[%d/%d]: Buffer %d not tracked%n", warning, msgClazzName, i+1, count, bufferName); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return; } @@ -409,7 +410,7 @@ public class GLBufferObjectTracker { if ( 0 == addr ) { if( DEBUG ) { System.err.printf("%s.%s: %s MapBuffer null result for target 0x%X -> %d: %s, off %d, len %d, acc 0x%X%n", msgClazzName, msgMapBuffer, warning, target, bufferName, store, offset, length, access); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } // User shall handle the glError ! } else { @@ -442,14 +443,14 @@ public class GLBufferObjectTracker { if( 0 == bufferName ) { if (DEBUG) { System.err.printf("%s: %s.%s: Buffer for target 0x%X not bound%n", warning, msgClazzName, msgUnmapped, target); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } store = null; } else { store = (GLBufferStorageImpl) bufferName2StorageMap.get(bufferName); if( DEBUG && null == store ) { System.err.printf("%s: %s.%s: Buffer %d not tracked%n", warning, msgClazzName, msgUnmapped, bufferName); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } final boolean res = dispatch.unmap(target, glProcAddress); @@ -459,7 +460,7 @@ public class GLBufferObjectTracker { if( DEBUG ) { System.err.printf("%s.%s %s target: 0x%X -> %d: %s%n", msgClazzName, msgUnmapped, res ? "OK" : "Failed", target, bufferName, store.toString(false)); if(!res) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return res; @@ -476,7 +477,7 @@ public class GLBufferObjectTracker { final GLBufferStorageImpl store = (GLBufferStorageImpl) bufferName2StorageMap.get(bufferName); if (DEBUG && null == store ) { System.err.printf("%s: %s.%s: Buffer %d not tracked%n", warning, msgClazzName, msgUnmapped, bufferName); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } final boolean res = dispatch.unmap(bufferName, glProcAddress); if( res && null != store ) { @@ -485,7 +486,7 @@ public class GLBufferObjectTracker { if (DEBUG) { System.err.printf("%s.%s %s %d: %s%n", msgClazzName, msgUnmapped, res ? "OK" : "Failed", bufferName, store.toString(false)); if(!res) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return res; @@ -505,7 +506,7 @@ public class GLBufferObjectTracker { public synchronized final void clear() { if (DEBUG) { System.err.printf("%s.clear() - Thread %s%n", msgClazzName, Thread.currentThread().getName()); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err); } bufferName2StorageMap.clear(); } diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java index 825ad0554..0742f7b05 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java @@ -40,7 +40,7 @@ package jogamp.opengl; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.util.IntIntHashMap; import com.jogamp.common.util.PropertyAccess; diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index a44075e90..1ff64725a 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -48,6 +48,7 @@ import java.security.PrivilegedAction; import java.util.HashMap; import java.util.Map; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.os.DynamicLookupHelper; import com.jogamp.common.os.Platform; import com.jogamp.common.util.ReflectionUtil; @@ -60,23 +61,24 @@ import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver; import com.jogamp.opengl.GLExtensions; import com.jogamp.opengl.GLRendererQuirks; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDebugListener; -import javax.media.opengl.GLDebugMessage; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLPipelineFactory; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDebugListener; +import com.jogamp.opengl.GLDebugMessage; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.GLProfile; public abstract class GLContextImpl extends GLContext { /** @@ -98,6 +100,9 @@ public abstract class GLContextImpl extends GLContext { private String glRenderer; private String glRendererLowerCase; private String glVersion; + private boolean glGetPtrInit = false; + private long glGetStringPtr = 0; + private long glGetIntegervPtr = 0; // Tracks lifecycle of buffer objects to avoid // repeated glGet calls upon glMapBuffer operations @@ -118,6 +123,12 @@ public abstract class GLContextImpl extends GLContext { protected GLDrawableImpl drawable; protected GLDrawableImpl drawableRead; + /** + * If GL >= 3.0 (ES or desktop) and not having {@link GLRendererQuirks#NoSurfacelessCtx}, + * being evaluated if not surface-handle is null and not yet set at makeCurrent(..). + */ + private boolean surfacelessOK = false; + private boolean pixelDataEvaluated; private int /* pixelDataInternalFormat, */ pixelDataFormat, pixelDataType; @@ -188,12 +199,16 @@ public abstract class GLContextImpl extends GLContext { glRenderer = glVendor; glRendererLowerCase = glRenderer; glVersion = glVendor; + glGetPtrInit = false; + glGetStringPtr = 0; + glGetIntegervPtr = 0; if ( !isInit && null != boundFBOTarget ) { // <init>: boundFBOTarget is not written yet boundFBOTarget[0] = 0; // draw boundFBOTarget[1] = 0; // read } + surfacelessOK = false; pixelDataEvaluated = false; super.resetStates(isInit); @@ -245,8 +260,9 @@ public abstract class GLContextImpl extends GLContext { if( drawable == readWrite && ( setWriteOnly || drawableRead == readWrite ) ) { return drawable; // no change. } - final GLDrawableImpl old = drawable; - if( isCreated() && null != old && old.isRealized() ) { + final GLDrawableImpl oldDrawableWrite = drawable; + final GLDrawableImpl oldDrawableRead = drawableRead; + if( isCreated() && null != oldDrawableWrite && oldDrawableWrite.isRealized() ) { if(!lockHeld) { makeCurrent(); } @@ -266,12 +282,36 @@ public abstract class GLContextImpl extends GLContext { drawableRetargeted |= null != drawable && readWrite != drawable; drawable = (GLDrawableImpl) readWrite ; if( isCreated() && null != drawable && drawable.isRealized() ) { - makeCurrent(true); // implicit: associateDrawable(true) + int res = CONTEXT_NOT_CURRENT; + Throwable gle = null; + try { + res = makeCurrent(true); // implicit: associateDrawable(true) + } catch ( final Throwable t ) { + gle = t; + } finally { + if( CONTEXT_NOT_CURRENT == res ) { + // Failure, recover and bail out w/ GLException + drawableRead = oldDrawableRead; + drawable = oldDrawableWrite; + if( drawable.isRealized() ) { + makeCurrent(true); // implicit: associateDrawable(true) + } + if( !lockHeld ) { + release(false); + } + final String msg = "Error: makeCurrent() failed with new drawable "+readWrite; + if( null != gle ) { + throw new GLException(msg, gle); + } else { + throw new GLException(msg); + } + } + } if( !lockHeld ) { release(false); } } - return old; + return oldDrawableWrite; } @Override @@ -305,7 +345,7 @@ public abstract class GLContextImpl extends GLContext { final String sgl1 = (null!=this.gl)?this.gl.getClass().getSimpleName()+", "+this.gl.toString():"<null>"; final String sgl2 = (null!=gl)?gl.getClass().getSimpleName()+", "+gl.toString():"<null>"; System.err.println("Info: setGL (OpenGL "+getGLVersion()+"): "+getThreadName()+", "+sgl1+" -> "+sgl2); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } this.gl = gl; return gl; @@ -383,7 +423,7 @@ public abstract class GLContextImpl extends GLContext { lastCtxReleaseStack = new Throwable(msg); if( TRACE_SWITCH ) { System.err.println(msg); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err, 0, 10); } } } @@ -419,7 +459,7 @@ public abstract class GLContextImpl extends GLContext { if ( DEBUG_TRACE_SWITCH ) { if ( lock.getHoldCount() > 2 ) { System.err.println(getThreadName() + ": GLContextImpl.destroy: Lock was hold more than once - makeCurrent/release imbalance: "+getTraceSwitchMsg()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } try { @@ -497,6 +537,8 @@ public abstract class GLContextImpl extends GLContext { //---------------------------------------------------------------------- // + protected final boolean isSurfacelessOK() { return surfacelessOK; } + /** * {@inheritDoc} * <p> @@ -564,11 +606,23 @@ public abstract class GLContextImpl extends GLContext { int res = CONTEXT_NOT_CURRENT; try { if ( drawable.isRealized() ) { - if ( 0 == drawable.getHandle() ) { - throw new GLException("drawable has invalid handle: "+drawable); - } lock.lock(); try { + if ( 0 == drawable.getHandle() && !surfacelessOK ) { + if( DEBUG ) { + System.err.println(getThreadName() +": GLContext.makeCurrent: Surfaceless evaluate"); + } + if( hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx) ) { + throw new GLException(String.format("Surfaceless not supported due to quirk %s: %s", + GLRendererQuirks.toString(GLRendererQuirks.NoSurfacelessCtx), toString())); + } + // Allow probing if ProxySurface && OPT_UPSTREAM_SURFACELESS + final NativeSurface surface = drawable.getNativeSurface(); + if( !(surface instanceof ProxySurface) || + !((ProxySurface)surface).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS ) ) { + throw new GLException(String.format("non-surfaceless drawable has zero-handle: %s", drawable.toString())); + } + } // One context can only be current by one thread, // and one thread can only have one context current! final GLContext current = getCurrent(); @@ -617,9 +671,19 @@ public abstract class GLContextImpl extends GLContext { } } - if (res != CONTEXT_NOT_CURRENT) { // still locked! + if ( CONTEXT_NOT_CURRENT != res ) { // still locked! + if( 0 == drawable.getHandle() && !surfacelessOK ) { + if( hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx) ) { + throw new GLException(String.format("Surfaceless not supported due to quirk %s: %s", + GLRendererQuirks.toString(GLRendererQuirks.NoSurfacelessCtx), toString())); + } + if( DEBUG ) { + System.err.println(getThreadName() +": GLContext.makeCurrent: Surfaceless OK - validated"); + } + surfacelessOK = true; + } setCurrent(this); - if(res == CONTEXT_CURRENT_NEW) { + if( CONTEXT_CURRENT_NEW == res ) { // check if the drawable's and the GL's GLProfile are equal // throws an GLException if not drawable.getGLProfile().verifyEquality(gl.getGLProfile()); @@ -627,13 +691,13 @@ public abstract class GLContextImpl extends GLContext { glDebugHandler.init( isGL2GL3() && isGLDebugEnabled() ); if(DEBUG_GL) { - setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ); + setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, gl, null) ); if(glDebugHandler.isEnabled()) { glDebugHandler.addListener(new GLDebugMessageHandler.StdErrGLDebugListener(true)); } } if(TRACE_GL) { - setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ); + setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, gl, new Object[] { System.err } ) ); } forceDrawableAssociation = true; @@ -698,12 +762,10 @@ public abstract class GLContextImpl extends GLContext { if( created && hasNoDefaultVAO() ) { final int[] tmp = new int[1]; final GL rootGL = gl.getRootGL(); - if( rootGL.isGL2ES3() ) { // FIXME remove if ES2 == ES3 later - final GL2ES3 gl2es3 = rootGL.getGL2ES3(); - gl2es3.glGenVertexArrays(1, tmp, 0); - defaultVAO = tmp[0]; - gl2es3.glBindVertexArray(defaultVAO); - } + final GL2ES3 gl2es3 = rootGL.getGL2ES3(); + gl2es3.glGenVertexArrays(1, tmp, 0); + defaultVAO = tmp[0]; + gl2es3.glBindVertexArray(defaultVAO); } } finally { if ( null != sharedMaster ) { @@ -712,7 +774,7 @@ public abstract class GLContextImpl extends GLContext { } if ( DEBUG_TRACE_SWITCH ) { System.err.println(getThreadName() + ": Create GL context "+(created?"OK":"FAILED")+": For " + getClass().getName()+" - "+getGLVersion()+" - "+getTraceSwitchMsg()); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err, 0, 10); } if(!created) { return CONTEXT_NOT_CURRENT; @@ -728,7 +790,7 @@ public abstract class GLContextImpl extends GLContext { if( 0 == ( ctxOptions & GLContext.CTX_PROFILE_ES) ) { // not ES profile final int reqMajor; final int reqProfile; - if( ctxVersion.compareTo(Version300) <= 0 ) { + if( ctxVersion.compareTo(Version3_0) <= 0 ) { reqMajor = 2; } else { reqMajor = ctxVersion.getMajor(); @@ -759,7 +821,7 @@ public abstract class GLContextImpl extends GLContext { GLContext.mapAvailableGLVersion(device, 3, reqProfile, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); } } - GLContext.setAvailableGLVersionsSet(device); + GLContext.setAvailableGLVersionsSet(device, true); if (DEBUG) { System.err.println(getThreadName() + ": createContextOLD-MapVersionsAvailable HAVE: " + device+" -> "+reqMajor+"."+reqProfile+ " -> "+getGLVersion()); @@ -868,7 +930,15 @@ public abstract class GLContextImpl extends GLContext { */ protected final long createContextARB(final long share, final boolean direct) { - if( GLProfile.disableOpenGLARBContext ) { + if( GLProfile.disableOpenGLARBContext || + GLRendererQuirks.existStickyDeviceQuirk(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(), + GLRendererQuirks.NoARBCreateContext) ) { + if( DEBUG ) { + System.err.println(getThreadName() + ": createContextARB: Disabled "+ + "- property disableOpenGLARBContext "+ GLProfile.disableOpenGLARBContext + + ", quirk NoARBCreateContext "+GLRendererQuirks.existStickyDeviceQuirk(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(), + GLRendererQuirks.NoARBCreateContext)); + } return 0; } final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); @@ -879,19 +949,21 @@ public abstract class GLContextImpl extends GLContext { GLContext.getAvailableGLVersionsSet(device)); } + final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final GLProfile glp = glCaps.getGLProfile(); + if ( !GLContext.getAvailableGLVersionsSet(device) ) { - if(!mapGLVersions(device)) { + if( !mapGLVersions(device) ) { // none of the ARB context creation calls was successful, bail out return 0; } } - final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final int[] reqMajorCTP = new int[] { 0, 0 }; - GLContext.getRequestMajorAndCompat(glCaps.getGLProfile(), reqMajorCTP); + GLContext.getRequestMajorAndCompat(glp, reqMajorCTP); if(DEBUG) { - System.err.println(getThreadName() + ": createContextARB: Requested "+GLContext.getGLVersion(reqMajorCTP[0], 0, reqMajorCTP[0], null)); + System.err.println(getThreadName() + ": createContextARB: Requested "+glp+" -> "+GLContext.getGLVersion(reqMajorCTP[0], 0, reqMajorCTP[1], null)); } final int _major[] = { 0 }; final int _minor[] = { 0 }; @@ -1023,7 +1095,7 @@ public abstract class GLContextImpl extends GLContext { } if(success) { // only claim GL versions set [and hence detected] if ARB context creation was successful - GLContext.setAvailableGLVersionsSet(device); + GLContext.setAvailableGLVersionsSet(device, true); if(DEBUG) { final long t1 = System.nanoTime(); System.err.println("GLContextImpl.mapGLVersions: "+device+", profileAliasing: "+PROFILE_ALIASING+", total "+(t1-t0)/1e6 +"ms"); @@ -1051,17 +1123,23 @@ public abstract class GLContextImpl extends GLContext { int majorMin, minorMin; final int major[] = new int[1]; final int minor[] = new int[1]; - if( 4 == reqMajor ) { - majorMax=4; minorMax=GLContext.getMaxMinor(ctp, majorMax); - majorMin=4; minorMin=0; - } else if( 3 == reqMajor ) { - majorMax=3; minorMax=GLContext.getMaxMinor(ctp, majorMax); - majorMin=3; minorMin=1; - } else /* if( glp.isGL2() ) */ { - // our minimum desktop OpenGL runtime requirements are 1.1, - // nevertheless we restrict ARB context creation to 2.0 to spare us futile attempts - majorMax=3; minorMax=0; - majorMin=2; minorMin=0; + + if( CTX_PROFILE_ES == reqProfile ) { + majorMax=reqMajor; minorMax=GLContext.getMaxMinor(ctp, majorMax); + majorMin=reqMajor; minorMin=0; + } else { + if( 4 == reqMajor ) { + majorMax=4; minorMax=GLContext.getMaxMinor(ctp, majorMax); + majorMin=4; minorMin=0; + } else if( 3 == reqMajor ) { + majorMax=3; minorMax=GLContext.getMaxMinor(ctp, majorMax); + majorMin=3; minorMin=1; + } else /* if( glp.isGL2() ) */ { + // our minimum desktop OpenGL runtime requirements are 1.1, + // nevertheless we restrict ARB context creation to 2.0 to spare us futile attempts + majorMax=3; minorMax=0; + majorMin=2; minorMin=0; + } } _context = createContextARBVersions(0, true, ctp, /* max */ majorMax, minorMax, @@ -1181,16 +1259,19 @@ public abstract class GLContextImpl extends GLContext { // Helpers for various context implementations // - private Object createInstance(final GLProfile glp, final boolean glObject, final Object[] cstrArgs) { + private final Object createInstance(final GLProfile glp, final boolean glObject, final Object[] cstrArgs) { return ReflectionUtil.createInstance(glp.getGLCtor(glObject), cstrArgs); } - private boolean verifyInstance(final GLProfile glp, final String suffix, final Object instance) { + private final boolean verifyInstance(final GLProfile glp, final String suffix, final Object instance) { return ReflectionUtil.instanceOf(instance, glp.getGLImplBaseClassName()+suffix); } - /** Create the GL for this context. */ - protected GL createGL(final GLProfile glp) { + /** + * Create the GL instance for this context, + * requires valid {@link #getGLProcAddressTable()} result! + */ + private final GL createGL(final GLProfile glp) { final GL gl = (GL) createInstance(glp, true, new Object[] { glp, this } ); /* FIXME: refactor dependence on Java 2D / JOGL bridge @@ -1219,6 +1300,8 @@ public abstract class GLContextImpl extends GLContext { } if( null != finalizeInit ) { ReflectionUtil.callMethod(gl, finalizeInit, new Object[]{ }); + } else { + throw new InternalError("Missing 'void finalizeInit(ProcAddressTable)' in "+gl.getClass().getName()); } } @@ -1290,43 +1373,58 @@ public abstract class GLContextImpl extends GLContext { } ); } + private final PrivilegedAction<Object> privInitGLGetPtrAction = new PrivilegedAction<Object>() { + @Override + public Object run() { + final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper(); + glDynLookupHelper.claimAllLinkPermission(); + try { + glGetStringPtr = glDynLookupHelper.dynamicLookupFunction("glGetString"); + glGetIntegervPtr = glDynLookupHelper.dynamicLookupFunction("glGetIntegerv"); + } finally { + glDynLookupHelper.releaseAllLinkPermission(); + } + return null; + } }; private final boolean initGLRendererAndGLVersionStrings() { - final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper(); - final long _glGetString = glDynLookupHelper.dynamicLookupFunction("glGetString"); - if(0 == _glGetString) { - System.err.println("Error: Entry point to 'glGetString' is NULL."); + if( !glGetPtrInit ) { + AccessController.doPrivileged(privInitGLGetPtrAction); + glGetPtrInit = true; + } + if( 0 == glGetStringPtr || 0 == glGetIntegervPtr ) { + System.err.println("Error: Could not lookup: glGetString "+toHexString(glGetStringPtr)+", glGetIntegerv "+toHexString(glGetIntegervPtr)); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } else { - final String _glVendor = glGetStringInt(GL.GL_VENDOR, _glGetString); + final String _glVendor = glGetStringInt(GL.GL_VENDOR, glGetStringPtr); if(null == _glVendor) { if(DEBUG) { System.err.println("Warning: GL_VENDOR is NULL."); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } glVendor = _glVendor; - final String _glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString); + final String _glRenderer = glGetStringInt(GL.GL_RENDERER, glGetStringPtr); if(null == _glRenderer) { if(DEBUG) { System.err.println("Warning: GL_RENDERER is NULL."); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } glRenderer = _glRenderer; glRendererLowerCase = glRenderer.toLowerCase(); - final String _glVersion = glGetStringInt(GL.GL_VERSION, _glGetString); + final String _glVersion = glGetStringInt(GL.GL_VERSION, glGetStringPtr); if(null == _glVersion) { // FIXME if(DEBUG) { System.err.println("Warning: GL_VERSION is NULL."); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } @@ -1337,6 +1435,26 @@ public abstract class GLContextImpl extends GLContext { } /** + * Returns false if <code>glGetIntegerv</code> is inaccessible, otherwise queries major.minor + * version for given arrays. + * <p> + * If the GL query fails, major will be zero. + * </p> + */ + private final void getGLIntVersion(final int[] glIntMajor, final int[] glIntMinor) { + glIntMajor[0] = 0; // clear + glIntMinor[0] = 0; // clear + if( 0 == glGetIntegervPtr ) { + // should not be reached, since initGLRendererAndGLVersionStrings(..)'s failure should abort caller! + throw new InternalError("Not initialized: glGetString "+toHexString(glGetStringPtr)+", glGetIntegerv "+toHexString(glGetIntegervPtr)); + } else { + glGetIntegervInt(GL2ES3.GL_MAJOR_VERSION, glIntMajor, 0, glGetIntegervPtr); + glGetIntegervInt(GL2ES3.GL_MINOR_VERSION, glIntMinor, 0, glGetIntegervPtr); + } + } + + + /** * Returns null if version string is invalid, otherwise a valid instance. * <p> * Note: Non ARB ctx is limited to GL 3.0. @@ -1356,30 +1474,6 @@ public abstract class GLContextImpl extends GLContext { return null; } - /** - * Returns false if <code>glGetIntegerv</code> is inaccessible, otherwise queries major.minor - * version for given arrays. - * <p> - * If the GL query fails, major will be zero. - * </p> - */ - private final boolean getGLIntVersion(final int[] glIntMajor, final int[] glIntMinor) { - glIntMajor[0] = 0; // clear - final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper(); - final long _glGetIntegerv = glDynLookupHelper.dynamicLookupFunction("glGetIntegerv"); - if( 0 == _glGetIntegerv ) { - System.err.println("Error: Entry point to 'glGetIntegerv' is NULL."); - if(DEBUG) { - Thread.dumpStack(); - } - return false; - } else { - glGetIntegervInt(GL2ES3.GL_MAJOR_VERSION, glIntMajor, 0, _glGetIntegerv); - glGetIntegervInt(GL2ES3.GL_MINOR_VERSION, glIntMinor, 0, _glGetIntegerv); - return true; - } - } - protected final int getCtxOptions() { return ctxOptions; } @@ -1396,9 +1490,9 @@ public abstract class GLContextImpl extends GLContext { * * @param force force the setting, even if is already being set. * This might be useful if you change the OpenGL implementation. - * @param major OpenGL major version - * @param minor OpenGL minor version - * @param ctxProfileBits OpenGL context profile and option bits, see {@link javax.media.opengl.GLContext#CTX_OPTION_ANY} + * @param major requested OpenGL major version + * @param minor requested OpenGL minor version + * @param ctxProfileBits OpenGL context profile and option bits, see {@link com.jogamp.opengl.GLContext#CTX_OPTION_ANY} * @param strictMatch if <code>true</code> the ctx must * <ul> * <li>be greater or equal than the requested <code>major.minor</code> version, and</li> @@ -1412,13 +1506,13 @@ public abstract class GLContextImpl extends GLContext { * If <code>strictMatch</code> is <code>false</code> method shall always return <code>true</code> or throw an exception. * If <code>false</code> is returned, no data has been cached or mapped, i.e. ProcAddressTable, Extensions, Version, etc. * @see #setContextVersion - * @see javax.media.opengl.GLContext#CTX_OPTION_ANY - * @see javax.media.opengl.GLContext#CTX_PROFILE_COMPAT - * @see javax.media.opengl.GLContext#CTX_IMPL_ES2_COMPAT + * @see com.jogamp.opengl.GLContext#CTX_OPTION_ANY + * @see com.jogamp.opengl.GLContext#CTX_PROFILE_COMPAT + * @see com.jogamp.opengl.GLContext#CTX_IMPL_ES2_COMPAT */ protected final boolean setGLFunctionAvailability(final boolean force, int major, int minor, int ctxProfileBits, final boolean strictMatch, final boolean withinGLVersionsMapping) { - if(null!=this.gl && null!=glProcAddressTable && !force) { + if( null != this.gl && null != glProcAddressTable && !force ) { return true; // already done and not forced } @@ -1426,11 +1520,6 @@ public abstract class GLContextImpl extends GLContext { throw new GLException("Invalid GL Version Request "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)); } - if(null==this.gl || !verifyInstance(gl.getGLProfile(), "Impl", this.gl)) { - setGL( createGL( drawable.getGLProfile() ) ); - } - updateGLXProcAddressTable(); - final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice(); final int reqCtxProfileBits = ctxProfileBits; @@ -1476,20 +1565,7 @@ public abstract class GLContextImpl extends GLContext { final VersionNumber hasGLVersionByInt; { final int[] glIntMajor = new int[] { 0 }, glIntMinor = new int[] { 0 }; - final boolean getGLIntVersionOK = getGLIntVersion(glIntMajor, glIntMinor); - if( !getGLIntVersionOK ) { - final String errMsg = "Fetching GL Integer Version failed. "+adevice+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null); - if( strictMatch ) { - // query mode .. simply fail - if(DEBUG) { - System.err.println("Warning: setGLFunctionAvailability: "+errMsg); - } - return false; - } else { - // unusable GL context - non query mode - hard fail! - throw new GLException(errMsg); - } - } + getGLIntVersion(glIntMajor, glIntMinor); hasGLVersionByInt = new VersionNumber(glIntMajor[0], glIntMinor[0], 0); } if (DEBUG) { @@ -1501,7 +1577,7 @@ public abstract class GLContextImpl extends GLContext { // - _and_ a valid int version was fetched, // otherwise cont. w/ version-string method -> 3.0 > Version || Version > MAX! // - if ( ( major >= 3 || hasGLVersionByString.compareTo(Version300) >= 0 ) && + if ( ( major >= 3 || hasGLVersionByString.compareTo(Version3_0) >= 0 ) && GLContext.isValidGLVersion(ctxProfileBits, hasGLVersionByInt.getMajor(), hasGLVersionByInt.getMinor()) ) { // Strict Match (GLVersionMapping): // Relaxed match for versions ( !isES && major < 3 ) requests, last resort! @@ -1622,54 +1698,67 @@ public abstract class GLContextImpl extends GLContext { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.0 validated FQN: "+contextFQN+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion)); } + updateGLXProcAddressTable(); + // // UpdateGLProcAddressTable functionality + // _and_ setup GL instance, which ctor requires valid getGLProcAddressTable() result! // - ProcAddressTable table = null; - synchronized(mappedContextTypeObjectLock) { - table = mappedGLProcAddress.get( contextFQN ); - if(null != table && !verifyInstance(gl.getGLProfile(), "ProcAddressTable", table)) { - throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+ - ") -> "+ table.getClass().getName()+" not matching "+gl.getGLProfile().getGLImplBaseClassName()); - } - } - if(null != table) { - glProcAddressTable = table; - if(DEBUG) { - System.err.println(getThreadName() + ": GLContext GL ProcAddressTable reusing key("+contextFQN+") -> "+toHexString(table.hashCode())); - } - } else { - glProcAddressTable = (ProcAddressTable) createInstance(gl.getGLProfile(), false, - new Object[] { new GLProcAddressResolver() } ); - resetProcAddressTable(getGLProcAddressTable()); + { + final GLProfile glp = drawable.getGLProfile(); + + ProcAddressTable table = null; synchronized(mappedContextTypeObjectLock) { - mappedGLProcAddress.put(contextFQN, getGLProcAddressTable()); + table = mappedGLProcAddress.get( contextFQN ); + if(null != table && !verifyInstance(glp, "ProcAddressTable", table)) { + throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+ + ") -> "+ table.getClass().getName()+" not matching "+glp.getGLImplBaseClassName()); + } + } + if(null != table) { + glProcAddressTable = table; if(DEBUG) { - System.err.println(getThreadName() + ": GLContext GL ProcAddressTable mapping key("+contextFQN+") -> "+toHexString(getGLProcAddressTable().hashCode())); + System.err.println(getThreadName() + ": GLContext GL ProcAddressTable reusing key("+contextFQN+") -> "+toHexString(table.hashCode())); + } + } else { + glProcAddressTable = (ProcAddressTable) createInstance(glp, false, + new Object[] { new GLProcAddressResolver() } ); + resetProcAddressTable( glProcAddressTable ); + synchronized(mappedContextTypeObjectLock) { + mappedGLProcAddress.put(contextFQN, glProcAddressTable); + if(DEBUG) { + System.err.println(getThreadName() + ": GLContext GL ProcAddressTable mapping key("+contextFQN+") -> "+toHexString(glProcAddressTable.hashCode())); + } } } + + if( null == this.gl || !verifyInstance(glp, "Impl", this.gl) ) { + setGL( createGL( glp ) ); + } } // // Update ExtensionAvailabilityCache // - ExtensionAvailabilityCache eCache; - synchronized(mappedContextTypeObjectLock) { - eCache = mappedExtensionAvailabilityCache.get( contextFQN ); - } - if(null != eCache) { - extensionAvailability = eCache; - if(DEBUG) { - System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache reusing key("+contextFQN+") -> "+toHexString(eCache.hashCode()) + " - entries: "+eCache.getTotalExtensionCount()); - } - } else { - extensionAvailability = new ExtensionAvailabilityCache(); - setContextVersion(major, minor, ctxProfileBits, vendorVersion, false); // pre-set of GL version, required for extension cache usage - extensionAvailability.reset(this); + { + ExtensionAvailabilityCache eCache; synchronized(mappedContextTypeObjectLock) { - mappedExtensionAvailabilityCache.put(contextFQN, extensionAvailability); + eCache = mappedExtensionAvailabilityCache.get( contextFQN ); + } + if(null != eCache) { + extensionAvailability = eCache; if(DEBUG) { - System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+toHexString(extensionAvailability.hashCode()) + " - entries: "+extensionAvailability.getTotalExtensionCount()); + System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache reusing key("+contextFQN+") -> "+toHexString(eCache.hashCode()) + " - entries: "+eCache.getTotalExtensionCount()); + } + } else { + extensionAvailability = new ExtensionAvailabilityCache(); + setContextVersion(major, minor, ctxProfileBits, vendorVersion, false); // pre-set of GL version, required for extension cache usage + extensionAvailability.reset(this); + synchronized(mappedContextTypeObjectLock) { + mappedExtensionAvailabilityCache.put(contextFQN, extensionAvailability); + if(DEBUG) { + System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+toHexString(extensionAvailability.hashCode()) + " - entries: "+extensionAvailability.getTotalExtensionCount()); + } } } } @@ -1770,6 +1859,38 @@ public abstract class GLContextImpl extends GLContext { } } } + if( GLProfile.disableSurfacelessContext ) { + final int quirk = GLRendererQuirks.NoSurfacelessCtx; + if(DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: disabled"); + } + quirks.addQuirk( quirk ); + if( withinGLVersionsMapping ) { + // Thread safe due to single threaded initialization! + GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk); + } else { + // FIXME: Remove when moving EGL/ES to ARB ctx creation + synchronized(GLContextImpl.class) { + GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk); + } + } + } + if( GLProfile.disableOpenGLARBContext ) { + final int quirk = GLRendererQuirks.NoARBCreateContext; + if(DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: disabled"); + } + quirks.addQuirk( quirk ); + if( withinGLVersionsMapping ) { + // Thread safe due to single threaded initialization! + GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk); + } else { + // FIXME: Remove when moving EGL/ES to ARB ctx creation + synchronized(GLContextImpl.class) { + GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk); + } + } + } // // OS related quirks @@ -1860,6 +1981,10 @@ public abstract class GLContextImpl extends GLContext { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", [Vendor "+glVendor+", Renderer "+glRenderer+" and Version "+glVersion+"]"); } quirks.addQuirk( quirk ); + if( withinGLVersionsMapping ) { + // Thread safe due to single threaded initialization! + GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk); + } } } } else if( isDriverIntel && glRenderer.equals("Intel Bear Lake B") ) { @@ -1903,7 +2028,7 @@ public abstract class GLContextImpl extends GLContext { // final int quirk = GLRendererQuirks.DontCloseX11Display; if( glRenderer.contains(MesaSP) ) { - if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version800) < 0 ) { + if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version8_0) < 0 ) { if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 Renderer=" + glRenderer + ", Version=[vendor " + vendorVersion + ", GL " + glVersion+"]"); } @@ -2114,7 +2239,7 @@ public abstract class GLContextImpl extends GLContext { @Override public final boolean isFunctionAvailable(final String glFunctionName) { // Check GL 1st (cached) - if(null!=glProcAddressTable) { // null if this context wasn't not created + if( null != glProcAddressTable ) { // null if this context wasn't not created try { if( glProcAddressTable.isFunctionAvailable( glFunctionName ) ) { return true; @@ -2135,15 +2260,24 @@ public abstract class GLContextImpl extends GLContext { // dynamic function lookup at last incl name aliasing (not cached) final DynamicLookupHelper dynLookup = getDrawableImpl().getGLDynamicLookupHelper(); final String tmpBase = GLNameResolver.normalizeVEN(GLNameResolver.normalizeARB(glFunctionName, true), true); - boolean res = false; - final int variants = GLNameResolver.getFuncNamePermutationNumber(tmpBase); - for(int i = 0; !res && i < variants; i++) { - final String tmp = GLNameResolver.getFuncNamePermutation(tmpBase, i); - try { - res = dynLookup.isFunctionAvailable(tmp); - } catch (final Exception e) { } - } - return res; + return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { + @Override + public Boolean run() { + boolean res = false; + dynLookup.claimAllLinkPermission(); + try { + final int variants = GLNameResolver.getFuncNamePermutationNumber(tmpBase); + for(int i = 0; !res && i < variants; i++) { + final String tmp = GLNameResolver.getFuncNamePermutation(tmpBase, i); + try { + res = dynLookup.isFunctionAvailable(tmp); + } catch (final Exception e) { } + } + } finally { + dynLookup.releaseAllLinkPermission(); + } + return Boolean.valueOf(res); + } } ).booleanValue(); } @Override @@ -2309,9 +2443,6 @@ public abstract class GLContextImpl extends GLContext { } switch(target) { case GL.GL_FRAMEBUFFER: - boundFBOTarget[0] = framebufferName; // draw - boundFBOTarget[1] = framebufferName; // read - break; case GL2ES3.GL_DRAW_FRAMEBUFFER: boundFBOTarget[0] = framebufferName; // draw break; diff --git a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java index aed611edd..61d6ad198 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java +++ b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java @@ -46,8 +46,8 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; /** Provides a deterministic mechanism by which OpenGL contexts can share textures diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java index 7519d568b..cd31d02fd 100644 --- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java +++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java @@ -31,15 +31,15 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; -import javax.media.nativewindow.NativeWindowException; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLDebugListener; -import javax.media.opengl.GLDebugMessage; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLDebugListener; +import com.jogamp.opengl.GLDebugMessage; +import com.jogamp.opengl.GLException; import jogamp.common.os.PlatformPropsImpl; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.os.Platform; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.opengl.GLExtensions; @@ -56,7 +56,7 @@ import com.jogamp.opengl.GLExtensions; * return as fast as possible.</p> * * <p>In case no <i>GL_ARB_debug_output</i> is available, but <i>GL_AMD_debug_output</i>, - * the messages are translated to <i>ARB</i> {@link GLDebugMessage}, using {@link GLDebugMessage#translateAMDEvent(javax.media.opengl.GLContext, long, int, int, int, String)}.</p> + * the messages are translated to <i>ARB</i> {@link GLDebugMessage}, using {@link GLDebugMessage#translateAMDEvent(com.jogamp.opengl.GLContext, long, int, int, int, String)}.</p> */ public class GLDebugMessageHandler { private static final boolean DEBUG = Debug.debug("GLDebugMessageHandler"); @@ -212,12 +212,12 @@ public class GLDebugMessageHandler { } /** - * @see javax.media.opengl.GLContext#isGLDebugSynchronous() + * @see com.jogamp.opengl.GLContext#isGLDebugSynchronous() */ public final boolean isSynchronous() { return synchronous; } /** - * @see javax.media.opengl.GLContext#setGLDebugSynchronous(boolean) + * @see com.jogamp.opengl.GLContext#setGLDebugSynchronous(boolean) */ public final void setSynchronous(final boolean synchronous) { this.synchronous = synchronous; @@ -239,7 +239,7 @@ public class GLDebugMessageHandler { } /** - * @see javax.media.opengl.GLContext#enableGLDebugMessage(boolean) + * @see com.jogamp.opengl.GLContext#enableGLDebugMessage(boolean) */ public final void enable(final boolean enable) throws GLException { ctx.validateCurrent(); @@ -308,7 +308,7 @@ public class GLDebugMessageHandler { public void messageSent(final GLDebugMessage event) { System.err.println(event); if(threadDump) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index b51f290e9..b7f861e13 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -46,27 +46,28 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.OffscreenLayerSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.MutableSurface; -import javax.media.nativewindow.UpstreamSurfaceHook; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLFBODrawable; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; - +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.OffscreenLayerSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.MutableSurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLFBODrawable; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; + +import com.jogamp.common.ExceptionUtils; import com.jogamp.nativewindow.MutableGraphicsConfiguration; import com.jogamp.nativewindow.DelegatedUpstreamSurfaceHookWithSurfaceSize; import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; @@ -87,11 +88,97 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } /** + * Returns {@code true} if context is capable of operating without a surface, + * otherwise returns {@code false} and sets the {@link GLRendererQuirks#NoSurfacelessCtx}. + * <p> + * Method will skip probing in case {@link GLRendererQuirks#NoSurfacelessCtx} has been already set. + * </p> + * <p> + * Caller shall skip probing in case surfaceless support is not possible, + * e.g. OpenGL ES without {@code EGL_KHR_surfaceless_context} or EGL < 1.5, + * or desktop OpenGL context < 3.0 and instead call {@link #setNoSurfacelessCtxQuirk(GLContext)}! + * </p> + * + * @param context the context to probe, must be current + * @param restoreDrawable If {@code true}, the initial drawable will be restored after probing + * and the temporary {@code zeroDrawable} will be released. + * If {@code false}, the temporary {@code zeroDrawable} will be kept (bound) to the context. + * Restoration may be skipped, if the drawable and context will be destroyed anyways. + * + * @see GLRendererQuirks#NoSurfacelessCtx + */ + protected final boolean probeSurfacelessCtx(final GLContext context, final boolean restoreDrawable) { + final GLDrawable origDrawable = context.getGLDrawable(); + final AbstractGraphicsDevice device = origDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); + + final boolean noSurfacelessCtxQuirk = context.hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx); + boolean allowsSurfacelessCtx = false; + + if( !noSurfacelessCtxQuirk ) { + GLDrawable zeroDrawable = null; + try { + final GLCapabilitiesImmutable caps = origDrawable.getRequestedGLCapabilities(); + final ProxySurface zeroSurface = createSurfacelessImpl(device, true, caps, caps, null, 64, 64); + zeroDrawable = createOnscreenDrawableImpl(zeroSurface); + zeroDrawable.setRealized(true); + + // Since context is still current, + // will keep context current w/ zeroDrawable or throws GLException + context.setGLDrawable(zeroDrawable, false); + allowsSurfacelessCtx = true; // if setGLDrawable is successful, i.e. no GLException + + if( restoreDrawable ) { + context.setGLDrawable(origDrawable, false); + } + } catch (final Throwable t) { + if( DEBUG || GLContext.DEBUG ) { + ExceptionUtils.dumpThrowable("", t); + } + } finally { + if( null != zeroDrawable && restoreDrawable ) { + zeroDrawable.setRealized(false); + } + } + } + if( !noSurfacelessCtxQuirk && !allowsSurfacelessCtx ) { + setNoSurfacelessCtxQuirkImpl(device, context); + } + return allowsSurfacelessCtx; + } + + /** + * Method will set the {@link GLRendererQuirks#NoSurfacelessCtx} + * if it has not been set already. + * + * @param context the context to probe, must be current + * @see GLRendererQuirks#NoSurfacelessCtx + */ + protected final void setNoSurfacelessCtxQuirk(final GLContext context) { + final boolean noSurfacelessCtxQuirk = context.hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx); + if( !noSurfacelessCtxQuirk ) { + final GLDrawable origDrawable = context.getGLDrawable(); + final AbstractGraphicsDevice device = origDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); + setNoSurfacelessCtxQuirkImpl(device, context); + } + } + private final void setNoSurfacelessCtxQuirkImpl(final AbstractGraphicsDevice device, final GLContext context) { + final int quirk = GLRendererQuirks.NoSurfacelessCtx; + if(DEBUG || GLContext.DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+" -> "+device+": cause: probe"); + } + final GLRendererQuirks glrq = context.getRendererQuirks(); + if( null != glrq ) { + glrq.addQuirk(quirk); + } + GLRendererQuirks.addStickyDeviceQuirk(device, quirk); + } + + /** * Returns the shared resource mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()}, * either a pre-existing or newly created, or <code>null</code> if creation failed or not supported.<br> * Creation of the shared resource is tried only once. * - * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. + * @param device which {@link com.jogamp.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. */ protected final SharedResourceRunner.Resource getOrCreateSharedResource(AbstractGraphicsDevice device) { try { @@ -114,7 +201,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * either a pre-existing or newly created, or <code>null</code> if creation failed or <b>not supported</b>.<br> * Creation of the shared context is tried only once. * - * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. + * @param device which {@link com.jogamp.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. */ public final GLContext getOrCreateSharedContext(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); @@ -128,16 +215,16 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { protected final boolean createSharedResourceImpl(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { - return sr.isValid(); + return sr.isAvailable(); } return false; } @Override - public final GLRendererQuirks getRendererQuirks(final AbstractGraphicsDevice device) { + public final GLRendererQuirks getRendererQuirks(final AbstractGraphicsDevice device, final GLProfile glp) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { - return sr.getRendererQuirks(); + return sr.getRendererQuirks(glp); } return null; } @@ -147,7 +234,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * either a preexisting or newly created, or <code>null</code> if creation failed or not supported.<br> * Creation of the shared context is tried only once. * - * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device. + * @param device which {@link com.jogamp.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device. */ protected final AbstractGraphicsDevice getOrCreateSharedDevice(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); @@ -159,10 +246,11 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { /** * Returns the GLDynamicLookupHelper - * @param profile if EGL/ES, profile <code>1</code> refers to ES1 and <code>2</code> to ES2, + * @param profileName if EGL/ES, profile <code>1</code> refers to ES1 and <code>2</code> to ES2, * otherwise the profile is ignored. + * @throws GLException if no DynamicLookupHelper is installed */ - public abstract GLDynamicLookupHelper getGLDynamicLookupHelper(int profile); + public abstract GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) throws GLException; //--------------------------------------------------------------------------- // Dispatching GLDrawable construction in respect to the NativeSurface Capabilities @@ -195,7 +283,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { System.err.println("chosenCapsMod: "+chosenCapsMod); System.err.println("OffscreenLayerSurface: **** "+ols); System.err.println("Target: **** "+target); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if( ! ( target instanceof MutableSurface ) ) { throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen layered surface: "+target); @@ -271,9 +359,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { @Override public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(final AbstractGraphicsDevice deviceReq, - final GLCapabilitiesImmutable capsRequested, - final GLCapabilitiesChooser chooser, - final int width, final int height) { + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, final int height) { final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height ); try { drawable.setRealized(true); @@ -306,24 +394,32 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { @Override public final GLDrawable createOffscreenDrawable(final AbstractGraphicsDevice deviceReq, - final GLCapabilitiesImmutable capsRequested, - final GLCapabilitiesChooser chooser, - final int width, final int height) { + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, final int height) { if(width<=0 || height<=0) { throw new GLException("initial size must be positive (were (" + width + " x " + height + "))"); } - final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); - if(null == device) { + final SharedResourceRunner.Resource sr = getOrCreateSharedResource( deviceReq ); + if( null == sr ) { throw new GLException("No shared device for requested: "+deviceReq); } - + final AbstractGraphicsDevice device = sr.getDevice(); final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(capsRequested, this, device); if( capsChosen.isFBO() ) { // Use minimum GLCapabilities for the dummy surface w/ same profile - final ProxySurface dummySurface = createDummySurfaceImpl(device, true, new GLCapabilities(capsChosen.getGLProfile()), capsRequested, null, width, height); - final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface); - return new GLFBODrawableImpl.ResizeableImpl(this, dummyDrawable, dummySurface, capsChosen, 0); + final GLProfile glp = capsChosen.getGLProfile(); + final GLCapabilitiesImmutable glCapsMin = new GLCapabilities(glp); + final GLRendererQuirks glrq = sr.getRendererQuirks(glp); + final ProxySurface surface; + if( null != glrq && !glrq.exist(GLRendererQuirks.NoSurfacelessCtx) ) { + surface = createSurfacelessImpl(device, true, glCapsMin, capsRequested, null, width, height); + } else { + surface = createDummySurfaceImpl(device, true, glCapsMin, capsRequested, null, width, height); + } + final GLDrawableImpl drawable = createOnscreenDrawableImpl(surface); + return new GLFBODrawableImpl.ResizeableImpl(this, drawable, surface, capsChosen, 0); } return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser, new UpstreamSurfaceHookMutableSize(width, height) ) ); @@ -380,8 +476,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook); /** - * A dummy surface is not visible on screen and will not be used to render directly to, - * it maybe on- or offscreen. + * A dummy surface is not visible on screen, it may be on- or offscreen. * <p> * It is used to allow the creation of a {@link GLDrawable} and {@link GLContext} to query information. * It also allows creation of framebuffer objects which are used for rendering or using a shared GLContext w/o actually rendering to a usable framebuffer. @@ -389,7 +484,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * <p> * Creates a new independent device instance using <code>deviceReq</code> details. * </p> - * @param deviceReq which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device. + * @param deviceReq which {@link com.jogamp.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device. * @param requestedCaps * @param chooser the custom chooser, may be null for default * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()}, not the actual dummy surface width. @@ -409,8 +504,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } /** - * A dummy surface is not visible on screen and will not be used to render directly to, - * it maybe on- or offscreen. + * A dummy surface is not visible on screen and may be on- or offscreen. * <p> * It is used to allow the creation of a {@link GLDrawable} and {@link GLContext} to query information. * It also allows creation of framebuffer objects which are used for rendering or using a shared GLContext w/o actually rendering to a usable framebuffer. @@ -430,6 +524,27 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { public abstract ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height); + /** + * A surfaceless {@link ProxySurface} is a non-existing surface and will not be used as a render target. + * <p> + * It is used to allow the creation of a {@link GLDrawable} and {@link GLContext} w/o default framebuffer to query information. + * It also allows creation of framebuffer objects which are used for rendering or using a shared GLContext w/o actually rendering to a usable framebuffer. + * </p> + * @param device a valid platform dependent target device. + * @param createNewDevice if <code>true</code> a new device instance is created using <code>device</code> details, + * otherwise <code>device</code> instance is used as-is. + * @param chosenCaps + * @param requestedCaps + * @param chooser the custom chooser, may be null for default + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()}, not the actual dummy surface width. + * The latter is platform specific and small + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()}, not the actual dummy surface height, + * The latter is platform specific and small + * @return the created {@link ProxySurface} instance w/o defined surface handle but platform specific {@link UpstreamSurfaceHook}. + */ + public abstract ProxySurface createSurfacelessImpl(AbstractGraphicsDevice device, boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height); + //--------------------------------------------------------------------------- // // ProxySurface (Wrapped pre-existing native surface) construction diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 3847b4042..e9ee46a51 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -45,20 +45,20 @@ import java.util.ArrayList; import java.util.List; import java.util.HashSet; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; -import javax.media.opengl.GL; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLFBODrawable; -import javax.media.opengl.GLRunnable; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLFBODrawable; +import com.jogamp.opengl.GLRunnable; import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.PropertyAccess; @@ -227,7 +227,7 @@ public class GLDrawableHelper { * i.e. lock the involved {@link GLDrawable#getNativeSurface() drawable's} {@link NativeSurface}s * to avoid a race condition. In case {@link GLAutoDrawable auto-drawable's} are used, * their {@link GLAutoDrawable#getUpstreamLock() upstream-lock} must be locked beforehand - * see <a href="../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li> + * see <a href="../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li> * </ul> * </p> * @@ -355,7 +355,7 @@ public class GLDrawableHelper { } if( DEBUG && ( 0>=newWidth || 0>=newHeight) ) { System.err.println("WARNING: Odd size detected: "+newWidth+"x"+newHeight+", using safe size 1x1. Drawable "+drawable); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if( 0 >= newWidth ) { newWidth = 1; validateSize=false; } if( 0 >= newHeight ) { newHeight = 1; validateSize=false; } @@ -734,7 +734,7 @@ public class GLDrawableHelper { final int glerr0 = drawable.getGL().glGetError(); if( GL.GL_NO_ERROR != glerr0 ) { System.err.println("Info: GLDrawableHelper.reshape: pre-exisiting GL error 0x"+Integer.toHexString(glerr0)); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } drawable.getGL().glViewport(x, y, width, height); diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java index 544aaf064..849a08623 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java @@ -40,16 +40,18 @@ package jogamp.opengl; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; + +import com.jogamp.common.ExceptionUtils; public abstract class GLDrawableImpl implements GLDrawable { protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; @@ -67,8 +69,11 @@ public abstract class GLDrawableImpl implements GLDrawable { /** * Returns the DynamicLookupHelper + * @throws GLException if no DynamicLookupHelper is installed */ - public abstract GLDynamicLookupHelper getGLDynamicLookupHelper(); + public final GLDynamicLookupHelper getGLDynamicLookupHelper() throws GLException { + return getFactoryImpl().getGLDynamicLookupHelper( getGLProfile().getImplName() ); + } public final GLDrawableFactoryImpl getFactoryImpl() { return (GLDrawableFactoryImpl) getFactory(); @@ -176,7 +181,7 @@ public abstract class GLDrawableImpl implements GLDrawable { final boolean isProxySurface = surface instanceof ProxySurface; if(DEBUG) { System.err.println(getThreadName() + ": setRealized: drawable "+getClass().getSimpleName()+", surface "+surface.getClass().getSimpleName()+", isProxySurface "+isProxySurface+": "+realized+" -> "+realizedArg); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } final AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice(); if(realizedArg) { diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index 991a351e6..cddaebe25 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -1,16 +1,17 @@ package jogamp.opengl; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.GLFBODrawable; - +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLFBODrawable; + +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.VersionUtil; import com.jogamp.nativewindow.MutableGraphicsConfiguration; @@ -104,7 +105,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { private final void setupFBO(final GL gl, final int idx, final int width, final int height, final int samples, final boolean useAlpha, final int depthBits, final int stencilBits, - final boolean useTexture, final boolean realUnbind) { + final boolean useTexture, final boolean setupViewportScissors, final boolean realUnbind) { final FBObject fbo = new FBObject(); fbos[idx] = fbo; @@ -155,6 +156,11 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { // Also remedy for Bug 1020, i.e. OSX/Nvidia's FBO needs to be cleared before blitting, // otherwise first MSAA frame lacks antialiasing. fbo.bind(gl); + if( setupViewportScissors ) { + // Surfaceless: Set initial viewport/scissors + gl.glViewport(0, 0, width, height); + gl.glScissor(0, 0, width, height); + } if( useDepth ) { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); } else { @@ -171,7 +177,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { if( !initialized && !realize ) { if( DEBUG ) { System.err.println("GLFBODrawableImpl.initialize(): WARNING - Already unrealized!"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return; // NOP, no exception for de-init twice or no init! } @@ -216,7 +222,9 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { for(int i=0; i<fbosN; i++) { setupFBO(gl, i, width, height, samples, useAlpha, - chosenFBOCaps.getDepthBits(), chosenFBOCaps.getStencilBits(), useTexture, fbosN-1==i); + chosenFBOCaps.getDepthBits(), chosenFBOCaps.getStencilBits(), useTexture, + 0==i && 0 == parent.getHandle() /* setupViewportScissors for surfaceless */, + fbosN-1==i /* unbind */); } fbos[0].formatToGLCapabilities(chosenFBOCaps); chosenFBOCaps.setDoubleBuffered( chosenFBOCaps.getDoubleBuffered() || samples > 0 ); @@ -233,7 +241,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { if(DEBUG) { System.err.println("GLFBODrawableImpl.initialize("+realize+"): "+this); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } @@ -270,7 +278,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { // resetQuirk fallback fbos[idx].destroy(gl); final boolean useTexture = 0 != ( FBOMODE_USE_TEXTURE & fboModeBits ); - setupFBO(gl, idx, width, height, samples, useAlpha, depthBits, stencilBits, useTexture, true); + setupFBO(gl, idx, width, height, samples, useAlpha, depthBits, stencilBits, useTexture, false, true); } private final void reset(final GL gl, int newSamples) throws GLException { @@ -284,7 +292,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { final boolean ctxSwitch = null != curContext && curContext != ourContext; if(DEBUG) { System.err.println("GLFBODrawableImpl.reset(newSamples "+newSamples+"): BEGIN - ctxSwitch "+ctxSwitch+", "+this); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } Throwable tFBO = null; Throwable tGL = null; @@ -359,11 +367,6 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { // @Override - public final GLDynamicLookupHelper getGLDynamicLookupHelper() { - return parent.getGLDynamicLookupHelper(); - } - - @Override protected final int getDefaultDrawFramebuffer() { return initialized ? fbos[fboIBack].getWriteFramebuffer() : 0; } @Override diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java index 90d18eb60..9a8f72304 100644 --- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java @@ -29,11 +29,11 @@ package jogamp.opengl; import java.util.List; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeWindowException; -import javax.media.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.opengl.DefaultGLCapabilitiesChooser; public abstract class GLGraphicsConfigurationFactory extends GraphicsConfigurationFactory { diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java index 1fb27cfcf..e9670baa6 100644 --- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java +++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java @@ -28,12 +28,12 @@ package jogamp.opengl; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.GLRendererQuirks; @@ -204,7 +204,7 @@ public class GLGraphicsConfigurationUtil { final boolean fboAvailable = GLContext.isFBOAvailable(device, glp); final boolean pbufferAvailable = factory.canCreateGLPbuffer(device, glp); - final GLRendererQuirks glrq = factory.getRendererQuirks(device); + final GLRendererQuirks glrq = factory.getRendererQuirks(device, glp); final boolean bitmapAvailable; final boolean doubleBufferAvailable; diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java index 721dc7384..44eb07678 100644 --- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java @@ -28,12 +28,12 @@ package jogamp.opengl; -import javax.media.nativewindow.NativeWindowException; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLOffscreenAutoDrawable; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLOffscreenAutoDrawable; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.opengl.FBObject; diff --git a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java index ca1c1869e..1a6024bfa 100644 --- a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java +++ b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java @@ -28,8 +28,8 @@ package jogamp.opengl; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.GLAutoDrawable; /** * Helper class to provide a Runnable queue implementation with a Runnable wrapper diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java index dc49b35f4..d85fb1347 100644 --- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java @@ -39,7 +39,7 @@ package jogamp.opengl; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.util.IntIntHashMap; diff --git a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java index 131e6f3ac..c03cdea02 100644 --- a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java +++ b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java @@ -43,14 +43,14 @@ import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GLContext; /** Singleton thread upon which all OpenGL work is performed by default. Unfortunately many vendors' OpenGL drivers are not really thread-safe and stability is much improved by performing OpenGL work on at most one thread. This is the default behavior of the GLAutoDrawable implementations according to the {@link - javax.media.opengl.Threading Threading} class. The GLWorkerThread + com.jogamp.opengl.Threading Threading} class. The GLWorkerThread replaces the original AWT event queue thread-based mechanism for two reasons: first, more than one AWT event queue thread may be spawned, for example if a dialog is being shown; second, it avoids diff --git a/src/jogl/classes/jogamp/opengl/ProjectFloat.java b/src/jogl/classes/jogamp/opengl/ProjectFloat.java index 5921eb9a9..ee9560214 100644 --- a/src/jogl/classes/jogamp/opengl/ProjectFloat.java +++ b/src/jogl/classes/jogamp/opengl/ProjectFloat.java @@ -118,7 +118,8 @@ package jogamp.opengl; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.math.FloatUtil; @@ -169,8 +170,9 @@ public class ProjectFloat { * @param aspect * @param zNear * @param zFar + * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar. */ - public void gluPerspective(final GLMatrixFunc gl, final float fovy_deg, final float aspect, final float zNear, final float zFar) { + public void gluPerspective(final GLMatrixFunc gl, final float fovy_deg, final float aspect, final float zNear, final float zFar) throws GLException { gl.glMultMatrixf(FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_deg * FloatUtil.PI / 180.0f, aspect, zNear, zFar), 0); } diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java index 93a4eb32e..9b9093a87 100644 --- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java +++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java @@ -30,21 +30,24 @@ package jogamp.opengl; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.opengl.GLProfile; + +import com.jogamp.common.ExceptionUtils; import com.jogamp.opengl.GLRendererQuirks; public class SharedResourceRunner implements Runnable { protected static final boolean DEBUG = GLDrawableImpl.DEBUG; public static interface Resource { - boolean isValid(); + boolean isAvailable(); AbstractGraphicsDevice getDevice(); AbstractGraphicsScreen getScreen(); GLDrawableImpl getDrawable(); GLContextImpl getContext(); - GLRendererQuirks getRendererQuirks(); + GLRendererQuirks getRendererQuirks(GLProfile glp); } public static interface Implementation { @@ -52,19 +55,19 @@ public class SharedResourceRunner implements Runnable { * <p> * Called within synchronized block. * </p> - * @param connection for creation a {@link AbstractGraphicsDevice} instance. + * @param device for creation a {@link AbstractGraphicsDevice} instance. * @return <code>true</code> if the device supports all protocols required for the implementation, otherwise <code>false</code>. */ - boolean isDeviceSupported(String connection); + boolean isDeviceSupported(final AbstractGraphicsDevice device); /** * <p> * Called within synchronized block. * </p> - * @param connection for creation a {@link AbstractGraphicsDevice} instance. + * @param device for creation a {@link AbstractGraphicsDevice} instance. * @return A new shared resource instance */ - Resource createSharedResource(String connection); + Resource createSharedResource(final AbstractGraphicsDevice device); /** Called within synchronized block. */ void releaseSharedResource(Resource shared); @@ -72,9 +75,9 @@ public class SharedResourceRunner implements Runnable { void clear(); /** Called within synchronized block. */ - Resource mapPut(String connection, Resource resource); + Resource mapPut(final AbstractGraphicsDevice device, final Resource resource); /** Called within synchronized block. */ - Resource mapGet(String connection); + Resource mapGet(final AbstractGraphicsDevice device); /** Called within synchronized block. */ Collection<Resource> mapValues(); } @@ -86,17 +89,17 @@ public class SharedResourceRunner implements Runnable { boolean running; boolean ready; boolean shouldRelease; - String initConnection; - String releaseConnection; + AbstractGraphicsDevice initDevice; + AbstractGraphicsDevice releaseDevice; - private boolean getDeviceTried(final String connection) { // synchronized call - return devicesTried.contains(connection); + private boolean getDeviceTried(final AbstractGraphicsDevice device) { // synchronized call + return devicesTried.contains(device.getConnection()); } - private void addDeviceTried(final String connection) { // synchronized call - devicesTried.add(connection); + private void addDeviceTried(final AbstractGraphicsDevice device) { // synchronized call + devicesTried.add(device.getConnection()); } - private void removeDeviceTried(final String connection) { // synchronized call - devicesTried.remove(connection); + private void removeDeviceTried(final AbstractGraphicsDevice device) { // synchronized call + devicesTried.remove(device.getConnection()); } public SharedResourceRunner(final Implementation impl) { @@ -110,8 +113,8 @@ public class SharedResourceRunner implements Runnable { ready = false; running = false; shouldRelease = false; - initConnection = null; - releaseConnection = null; + initDevice = null; + releaseDevice = null; } /** @@ -176,20 +179,20 @@ public class SharedResourceRunner implements Runnable { if(null != device) { synchronized (this) { start(); - final String connection = device.getConnection(); - sr = impl.mapGet(connection); + sr = impl.mapGet(device); if (null == sr) { - if ( !getDeviceTried(connection) ) { - addDeviceTried(connection); + if ( !getDeviceTried(device) ) { + addDeviceTried(device); if (DEBUG) { - System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": trying - "+getThreadName()); + System.err.println("SharedResourceRunner.getOrCreateShared() " + device + ": trying - "+getThreadName()); + ExceptionUtils.dumpStack(System.err); } - if ( impl.isDeviceSupported(connection) ) { - doAndWait(connection, null); - sr = impl.mapGet(connection); + if ( impl.isDeviceSupported(device) ) { + doAndWait(device, null); + sr = impl.mapGet(device); } if (DEBUG) { - System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": "+ ( ( null != sr ) ? "success" : "failed" ) +" - "+getThreadName()); + System.err.println("SharedResourceRunner.getOrCreateShared() " + device + ": "+ ( ( null != sr ) ? "success" : "failed" ) +" - "+getThreadName()); } } } @@ -202,16 +205,15 @@ public class SharedResourceRunner implements Runnable { SharedResourceRunner.Resource sr = null; if(null != device) { synchronized (this) { - final String connection = device.getConnection(); - sr = impl.mapGet(connection); + sr = impl.mapGet(device); if (null != sr) { - removeDeviceTried(connection); + removeDeviceTried(device); if (DEBUG) { - System.err.println("SharedResourceRunner.releaseShared() " + connection + ": trying - "+getThreadName()); + System.err.println("SharedResourceRunner.releaseShared() " + device + ": trying - "+getThreadName()); } - doAndWait(null, connection); + doAndWait(null, device); if (DEBUG) { - System.err.println("SharedResourceRunner.releaseShared() " + connection + ": done - "+getThreadName()); + System.err.println("SharedResourceRunner.releaseShared() " + device + ": done - "+getThreadName()); } } } @@ -219,13 +221,13 @@ public class SharedResourceRunner implements Runnable { return sr; } - private final void doAndWait(final String initConnection, final String releaseConnection) { + private final void doAndWait(final AbstractGraphicsDevice initDevice, final AbstractGraphicsDevice releaseDevice) { synchronized (this) { // wait until thread becomes ready to init new device, // pass the device and release the sync final String threadName = getThreadName(); if (DEBUG) { - System.err.println("SharedResourceRunner.doAndWait() START init: " + initConnection + ", release: "+releaseConnection+" - "+threadName); + System.err.println("SharedResourceRunner.doAndWait() START init: " + initDevice + ", release: "+releaseDevice+" - "+threadName); } while (!ready && running) { try { @@ -233,20 +235,20 @@ public class SharedResourceRunner implements Runnable { } catch (final InterruptedException ex) { } } if (DEBUG) { - System.err.println("SharedResourceRunner.doAndWait() set command: " + initConnection + ", release: "+releaseConnection+" - "+threadName); + System.err.println("SharedResourceRunner.doAndWait() set command: " + initDevice + ", release: "+releaseDevice+" - "+threadName); } - this.initConnection = initConnection; - this.releaseConnection = releaseConnection; + this.initDevice = initDevice; + this.releaseDevice = releaseDevice; this.notifyAll(); // wait until thread has init/released the device - while ( running && ( !ready || null != this.initConnection || null != this.releaseConnection ) ) { + while ( running && ( !ready || null != this.initDevice || null != this.releaseDevice ) ) { try { this.wait(); } catch (final InterruptedException ex) { } } if (DEBUG) { - System.err.println("SharedResourceRunner.initializeAndWait END init: " + initConnection + ", release: "+releaseConnection+" - "+threadName); + System.err.println("SharedResourceRunner.initializeAndWait END init: " + initDevice + ", release: "+releaseDevice+" - "+threadName); } } // done @@ -283,40 +285,40 @@ public class SharedResourceRunner implements Runnable { if (!shouldRelease) { if (DEBUG) { - System.err.println("SharedResourceRunner.run(): WOKE UP for device connection init: " + initConnection + - ", release: " + releaseConnection + " - " + threadName); + System.err.println("SharedResourceRunner.run(): WOKE UP for device connection init: " + initDevice + + ", release: " + releaseDevice + " - " + threadName); } - if(null != initConnection) { + if(null != initDevice) { if (DEBUG) { - System.err.println("SharedResourceRunner.run(): create Shared for: " + initConnection + " - " + threadName); + System.err.println("SharedResourceRunner.run(): create Shared for: " + initDevice + " - " + threadName); } Resource sr = null; try { - sr = impl.createSharedResource(initConnection); + sr = impl.createSharedResource(initDevice); } catch (final Exception e) { e.printStackTrace(); } if (null != sr) { - impl.mapPut(initConnection, sr); + impl.mapPut(initDevice, sr); } } - if(null != releaseConnection) { + if(null != releaseDevice) { if (DEBUG) { - System.err.println("SharedResourceRunner.run(): release Shared for: " + releaseConnection + " - " + threadName); + System.err.println("SharedResourceRunner.run(): release Shared for: " + releaseDevice + " - " + threadName); } - final Resource sr = impl.mapGet(releaseConnection); + final Resource sr = impl.mapGet(releaseDevice); if (null != sr) { try { impl.releaseSharedResource(sr); - impl.mapPut(releaseConnection, null); + impl.mapPut(releaseDevice, null); } catch (final Exception e) { e.printStackTrace(); } } } } - initConnection = null; - releaseConnection = null; + initDevice = null; + releaseDevice = null; } if (DEBUG) { diff --git a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java index 7b405e524..8545f10bf 100644 --- a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java +++ b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java @@ -38,16 +38,16 @@ import java.lang.reflect.InvocationTargetException; import java.security.AccessController; import java.security.PrivilegedAction; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.Threading.Mode; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.Threading.Mode; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; -/** Implementation of the {@link javax.media.opengl.Threading} class. */ +/** Implementation of the {@link com.jogamp.opengl.Threading} class. */ public class ThreadingImpl { protected static final boolean DEBUG = Debug.debug("Threading"); @@ -127,7 +127,7 @@ public class ThreadingImpl { public static boolean isX11() { return _isX11; } public static Mode getMode() { return mode; } - /** If an implementation of the javax.media.opengl APIs offers a + /** If an implementation of the com.jogamp.opengl APIs offers a multithreading option but the default behavior is single-threading, this API provides a mechanism for end users to disable single-threading in this implementation. Users are strongly discouraged from @@ -144,7 +144,7 @@ public class ThreadingImpl { if( Mode.MT != mode ) { singleThreaded = false; if (Debug.verbose()) { - System.err.println("Application forced disabling of single-threading of javax.media.opengl implementation"); + System.err.println("Application forced disabling of single-threading of com.jogamp.opengl implementation"); } } } @@ -188,7 +188,7 @@ public class ThreadingImpl { } /** Executes the passed Runnable on the single thread used for all - OpenGL work in this javax.media.opengl API implementation. It is + OpenGL work in this com.jogamp.opengl API implementation. It is not specified exactly which thread is used for this purpose. This method should only be called if the single-thread model is in use and if the current thread is not the OpenGL diff --git a/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java b/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java index 06fb0fe91..0a28e85eb 100644 --- a/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java +++ b/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java @@ -40,7 +40,7 @@ package jogamp.opengl; -import javax.media.opengl.*; +import com.jogamp.opengl.*; public interface ToolkitThreadingPlugin { /** Indicates whether the current thread is the designated toolkit thread, @@ -48,13 +48,13 @@ public interface ToolkitThreadingPlugin { public boolean isToolkitThread() throws GLException; /** Indicates whether the current thread is the thread on - which this implementation of the javax.media.opengl APIs + which this implementation of the com.jogamp.opengl APIs performs all of its OpenGL-related work. This method should only be called if the single-thread model is in effect. */ public boolean isOpenGLThread() throws GLException; /** Executes the passed Runnable on the single thread used for all - OpenGL work in this javax.media.opengl API implementation. It is + OpenGL work in this com.jogamp.opengl API implementation. It is not specified exactly which thread is used for this purpose. This method should only be called if the single-thread model is in use and if the current thread is not the OpenGL diff --git a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java index 495887e0f..da81922a4 100644 --- a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java +++ b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java @@ -30,9 +30,9 @@ package jogamp.opengl.android.av; import java.io.IOException; import java.util.List; -import javax.media.opengl.GL; -import javax.media.opengl.GLES2; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLES2; +import com.jogamp.opengl.GLException; import com.jogamp.common.os.AndroidVersion; import com.jogamp.common.os.Platform; diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java index 3f8910fb5..be2d9609f 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java @@ -42,7 +42,7 @@ package jogamp.opengl.awt; import java.awt.EventQueue; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GLException; import com.jogamp.common.util.awt.AWTEDTExecutor; diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java index a5f5b4702..7cc009668 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java @@ -45,11 +45,12 @@ import java.util.Set; import java.util.Map.Entry; import javax.imageio.ImageIO; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; import jogamp.opengl.Debug; @@ -288,8 +289,9 @@ public class AWTTilePainter { final int tWidth = renderer.getParam(TileRenderer.TR_TILE_WIDTH); final int tHeight = renderer.getParam(TileRenderer.TR_TILE_HEIGHT); final AWTGLPixelBufferProvider printBufferProvider = new AWTGLPixelBufferProvider( true /* allowRowStride */ ); - final GLPixelAttributes pixelAttribs = printBufferProvider.getAttributes(gl, componentCount); - tBuffer = printBufferProvider.allocate(gl, pixelAttribs, tWidth, tHeight, 1, true, 0); + final PixelFormat.Composition hostPixelComp = printBufferProvider.getHostPixelComp(gl.getGLProfile(), componentCount); + final GLPixelAttributes pixelAttribs = printBufferProvider.getAttributes(gl, componentCount, true); + tBuffer = printBufferProvider.allocate(gl, hostPixelComp, pixelAttribs, true, tWidth, tHeight, 1, 0); renderer.setTileBuffer(tBuffer); if( flipVertical ) { vFlipImage = new BufferedImage(tBuffer.width, tBuffer.height, tBuffer.image.getType()); diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java index e34ec18b6..9a4d1f9a1 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java @@ -40,8 +40,8 @@ package jogamp.opengl.awt; import java.awt.GraphicsEnvironment; import java.lang.reflect.Method; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GLException; public class AWTUtil { // See whether we're running in headless mode diff --git a/src/jogl/classes/jogamp/opengl/awt/Java2D.java b/src/jogl/classes/jogamp/opengl/awt/Java2D.java index 55212025d..f8826f23d 100644 --- a/src/jogl/classes/jogamp/opengl/awt/Java2D.java +++ b/src/jogl/classes/jogamp/opengl/awt/Java2D.java @@ -51,11 +51,11 @@ import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import com.jogamp.common.os.Platform; diff --git a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java index 2f87f01a9..bc6ec3b54 100644 --- a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java +++ b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java @@ -11,14 +11,14 @@ import java.awt.event.WindowEvent; import java.util.List; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; import com.jogamp.common.GlueGenVersion; import com.jogamp.common.os.Platform; diff --git a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java index 8c6091273..245b6a945 100644 --- a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java @@ -28,9 +28,12 @@ package jogamp.opengl.egl; -import java.util.*; +import java.util.ArrayList; +import java.util.List; -import jogamp.opengl.*; +import com.jogamp.opengl.egl.EGL; + +import jogamp.opengl.GLDynamicLibraryBundleInfo; /** * Implementation of the DynamicLookupHelper for Desktop ES2 (AMD, ..) @@ -56,7 +59,7 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu @Override public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { - return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName); + return EGLContext.eglGetProcAddress(toolGetProcAddressHandle, funcName); } @Override diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index 964401244..910afcd22 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -40,30 +40,41 @@ import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Map; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableImpl; +import jogamp.opengl.egl.EGLExtImpl; +import jogamp.opengl.egl.EGLExtProcAddressTable; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; +import com.jogamp.opengl.egl.EGL; +import com.jogamp.opengl.egl.EGLExt; public class EGLContext extends GLContextImpl { - private boolean eglQueryStringInitialized; - private boolean eglQueryStringAvailable; - private EGLExt _eglExt; // Table that holds the addresses of the native C-language entry points for // EGL extension functions. private EGLExtProcAddressTable eglExtProcAddressTable; + private EGLExtImpl eglExtImpl; + + static final int CTX_PROFILE_COMPAT = GLContext.CTX_PROFILE_COMPAT; + static final int CTX_PROFILE_CORE = GLContext.CTX_PROFILE_CORE; + static final int CTX_PROFILE_ES = GLContext.CTX_PROFILE_ES; + + public static String getGLProfile(final int major, final int minor, final int ctp) throws GLException { + return GLContext.getGLProfile(major, minor, ctp); + } EGLContext(final GLDrawableImpl drawable, final GLContext shareWith) { @@ -72,10 +83,8 @@ public class EGLContext extends GLContextImpl { @Override protected void resetStates(final boolean isInit) { - eglQueryStringInitialized = false; - eglQueryStringAvailable = false; eglExtProcAddressTable = null; - // no inner state _eglExt = null; + eglExtImpl = null; super.resetStates(isInit); } @@ -84,11 +93,8 @@ public class EGLContext extends GLContextImpl { return getEGLExt(); } - public EGLExt getEGLExt() { - if (_eglExt == null) { - _eglExt = new EGLExtImpl(this); - } - return _eglExt; + public final EGLExt getEGLExt() { + return eglExtImpl; } @Override @@ -96,10 +102,6 @@ public class EGLContext extends GLContextImpl { return eglExtProcAddressTable; } - public final EGLExtProcAddressTable getEGLExtProcAddressTable() { - return eglExtProcAddressTable; - } - @Override protected Map<String, String> getFunctionNameMap() { return null; } @@ -113,16 +115,14 @@ public class EGLContext extends GLContextImpl { @Override protected void makeCurrentImpl() throws GLException { - if (EGL.eglGetCurrentContext() != contextHandle) { - final long dpy = drawable.getNativeSurface().getDisplayHandle(); - if (!EGL.eglMakeCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { - throw new GLException("Error making context " + toHexString(contextHandle) + - " current on Thread " + getThreadName() + - " with display " + toHexString(dpy) + - ", drawableWrite " + toHexString(drawable.getHandle()) + - ", drawableRead "+ toHexString(drawableRead.getHandle()) + - " - Error code " + toHexString(EGL.eglGetError()) + ", " + this); - } + final long dpy = drawable.getNativeSurface().getDisplayHandle(); + if ( !EGL.eglMakeCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) { + throw new GLException("Error making context " + toHexString(contextHandle) + + " current on Thread " + getThreadName() + + " with display " + toHexString(dpy) + + ", drawableWrite " + toHexString(drawable.getHandle()) + + ", drawableRead "+ toHexString(drawableRead.getHandle()) + + " - Error code " + toHexString(EGL.eglGetError()) + ", " + this); } } @@ -140,11 +140,6 @@ public class EGLContext extends GLContextImpl { } @Override - protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { - return 0; // FIXME - } - - @Override protected void destroyContextARBImpl(final long _context) { if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), _context)) { final int eglError = EGL.eglGetError(); @@ -155,14 +150,39 @@ public class EGLContext extends GLContextImpl { } } + private static final int ctx_attribs_idx_major = 0; + private static final int ctx_attribs_rom[] = { + /* 0 */ EGLExt.EGL_CONTEXT_MAJOR_VERSION_KHR, 0, // alias of EGL.EGL_CONTEXT_CLIENT_VERSION + /* 2 */ EGL.EGL_NONE, EGL.EGL_NONE, // EGLExt.EGL_CONTEXT_MINOR_VERSION_KHR + /* 4 */ EGL.EGL_NONE, EGL.EGL_NONE, // EGLExt.EGL_CONTEXT_FLAGS_KHR + /* 6 */ EGL.EGL_NONE, EGL.EGL_NONE, // EGLExt.EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR + /* 8 */ EGL.EGL_NONE, EGL.EGL_NONE, // EGLExt.EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR + /* 10 */ EGL.EGL_NONE + }; + @Override - protected boolean createImpl(final long shareWithHandle) throws GLException { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int reqMajor, final int reqMinor) { final EGLGraphicsConfiguration config = (EGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration(); - final long eglDisplay = config.getScreen().getDevice().getHandle(); - final GLProfile glProfile = drawable.getGLProfile(); + final EGLGraphicsDevice device = (EGLGraphicsDevice) config.getScreen().getDevice(); + final long eglDisplay = device.getHandle(); final long eglConfig = config.getNativeConfig(); - // 0 == EGL.EGL_NO_CONTEXT; - + final EGLDrawableFactory factory = (EGLDrawableFactory) drawable.getFactoryImpl(); + + final boolean hasOpenGLAPISupport = factory.hasOpenGLAPISupport(); + final boolean useKHRCreateContext = factory.hasDefaultDeviceKHRCreateContext(); + final boolean allowOpenGLAPI = hasOpenGLAPISupport && useKHRCreateContext; + final boolean ctDesktopGL = 0 == ( GLContext.CTX_PROFILE_ES & ctp ); + final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; + final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; + final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; + + if(DEBUG) { + System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: Start "+getGLVersion(reqMajor, reqMinor, ctp, "@creation") + + ", hasOpenGLAPISupport "+hasOpenGLAPISupport + + ", useKHRCreateContext "+useKHRCreateContext + + ", allowOpenGLAPI "+allowOpenGLAPI + + ", device "+device); + } if ( 0 == eglDisplay ) { throw new GLException("Error: attempted to create an OpenGL context without a display connection"); } @@ -170,72 +190,168 @@ public class EGLContext extends GLContextImpl { throw new GLException("Error: attempted to create an OpenGL context without a graphics configuration"); } + /** + * It has been experienced w/ Mesa 10.3.2 (EGL 1.4/Gallium) + * that even though initial OpenGL context can be created w/o 'EGL_KHR_create_context', + * switching the API via 'eglBindAPI(EGL_OpenGL_API)' the latter 'eglCreateContext(..)' fails w/ EGL_BAD_ACCESS. + * Hence we require both: OpenGL API support _and_ 'EGL_KHR_create_context'. + * + * FIXME: Evaluate this issue in more detail! + * + * FIXME: Utilization of eglBindAPI(..) must be re-evaluated in case we mix ES w/ OpenGL, see EGL 1.4 spec. + * This is due to new semantics, i.e. API is bound on a per thread base, + * hence it must be switched before makeCurrent w/ different APIs, see: + * eglWaitClient(); + */ + if( ctDesktopGL && !allowOpenGLAPI ) { + // if( ctDesktopGL && !hasOpenGLAPISupport ) { + if(DEBUG) { + System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: DesktopGL not avail "+getGLVersion(reqMajor, reqMinor, ctp, "@creation")); + } + return 0; // n/a + } + try { - // might be unavailable on EGL < 1.2 - if( !EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API) ) { - throw new GLException("Caught: eglBindAPI to ES failed , error "+toHexString(EGL.eglGetError())); + if( allowOpenGLAPI && device.getEGLVersion().compareTo(Version1_2) >= 0 ) { + EGL.eglWaitClient(); // EGL >= 1.2 + } + if( !EGL.eglBindAPI( ctDesktopGL ? EGL.EGL_OPENGL_API : EGL.EGL_OPENGL_ES_API) ) { + throw new GLException("Caught: eglBindAPI to "+(ctDesktopGL ? "ES" : "GL")+" failed , error "+toHexString(EGL.eglGetError())+" - "+getGLVersion(reqMajor, reqMinor, ctp, "@creation")); } } catch (final GLException glex) { if (DEBUG) { - glex.printStackTrace(); + ExceptionUtils.dumpThrowable("", glex); } } - // Cannot check extension 'EGL_KHR_create_context' before having one current! + final int useMajor; + if( reqMajor >= 3 && + GLRendererQuirks.existStickyDeviceQuirk( GLDrawableFactory.getEGLFactory().getDefaultDevice(), GLRendererQuirks.GLES3ViaEGLES2Config) ) { + useMajor = 2; + } else { + useMajor = reqMajor; + } + + final IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_attribs_rom); + if( useKHRCreateContext ) { + attribs.put(ctx_attribs_idx_major + 1, useMajor); - final IntBuffer contextAttrsNIO; - final int contextVersionReq, contextVersionAttr; - { - if ( glProfile.usesNativeGLES3() ) { - contextVersionReq = 3; - if( GLRendererQuirks.existStickyDeviceQuirk( GLDrawableFactory.getEGLFactory().getDefaultDevice(), GLRendererQuirks.GLES3ViaEGLES2Config) ) { - contextVersionAttr = 2; + int index = ctx_attribs_idx_major + 2; + + /** if( ctDesktopGL && reqMinor >= 0 ) { // FIXME: No minor version probing for ES currently! + attribs.put(index + 0, EGLExt.EGL_CONTEXT_MINOR_VERSION_KHR); + attribs.put(index + 1, reqMinor); + index += 2; + } */ + + if( ctDesktopGL && ( useMajor > 3 || useMajor == 3 && reqMinor >= 2 ) ) { + attribs.put(index + 0, EGLExt.EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR); + if( ctBwdCompat ) { + attribs.put(index + 1, EGLExt.EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR); } else { - contextVersionAttr = 3; + attribs.put(index + 1, EGLExt.EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR); + } + index += 2; + } + int flags = 0; + if( ctDesktopGL && useMajor >= 3 && !ctBwdCompat && ctFwdCompat ) { + flags |= EGLExt.EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; + } + if( ctDebug ) { + flags |= EGLExt.EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR; + } + // TODO: flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR + if( 0 != flags ) { + attribs.put(index + 0, EGLExt.EGL_CONTEXT_FLAGS_KHR); + attribs.put(index + 1, flags); + index += 2; + } + if(DEBUG) { + System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: attrs.1: major "+useMajor+", flags "+toHexString(flags)+", index "+index); + } + } else { + attribs.put(ctx_attribs_idx_major + 1, useMajor); + if(DEBUG) { + System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: attrs.2: major "+useMajor); + } + } + + long ctx=0; + try { + ctx = EGL.eglCreateContext(eglDisplay, eglConfig, share, attribs); + } catch (final RuntimeException re) { + if(DEBUG) { + System.err.println(getThreadName()+": Info: EGLContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(reqMajor, reqMinor, ctp, "@creation")); + ExceptionUtils.dumpThrowable("", re); + } + } + + if(0!=ctx) { + if (!EGL.eglMakeCurrent(eglDisplay, drawable.getHandle(), drawableRead.getHandle(), ctx)) { + if(DEBUG) { + System.err.println(getThreadName()+": EGLContext.createContextARBImpl couldn't make current "+getGLVersion(reqMajor, reqMinor, ctp, "@creation")+" - error "+toHexString(EGL.eglGetError())); } - } else if ( glProfile.usesNativeGLES2() ) { - contextVersionReq = 2; - contextVersionAttr = 2; - } else if ( glProfile.usesNativeGLES1() ) { - contextVersionReq = 1; - contextVersionAttr = 1; + // release & destroy + EGL.eglMakeCurrent(eglDisplay, EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT); + EGL.eglDestroyContext(eglDisplay, ctx); + ctx = 0; + } else if (DEBUG) { + System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: OK "+getGLVersion(reqMajor, reqMinor, ctp, "@creation")+", share "+share+", direct "+direct); + } + } else if (DEBUG) { + System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: NO "+getGLVersion(reqMajor, reqMinor, ctp, "@creation")+" - error "+toHexString(EGL.eglGetError())); + } + + return ctx; + } + + @Override + protected boolean createImpl(final long shareWithHandle) throws GLException { + final EGLGraphicsConfiguration config = (EGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration(); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); + final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final GLProfile glp = glCaps.getGLProfile(); + + contextHandle = createContextARB(shareWithHandle, true); + if (DEBUG) { + if( 0 != contextHandle ) { + System.err.println(getThreadName() + ": EGLContext.createImpl: OK (ARB) on eglDevice "+device+ + ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError())); } else { - throw new GLException("Error creating OpenGL context - invalid GLProfile: "+glProfile); + System.err.println(getThreadName() + ": EGLContext.createImpl: NOT OK (ARB) - creation failed on eglDevice "+device+ + ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError())); } - // EGLExt.EGL_CONTEXT_MAJOR_VERSION_KHR == EGL.EGL_CONTEXT_CLIENT_VERSION - final int[] contextAttrs = new int[] { EGL.EGL_CONTEXT_CLIENT_VERSION, contextVersionAttr, EGL.EGL_NONE }; - contextAttrsNIO = Buffers.newDirectIntBuffer(contextAttrs); } - contextHandle = EGL.eglCreateContext(eglDisplay, eglConfig, shareWithHandle, contextAttrsNIO); - if (contextHandle == 0) { - throw new GLException("Error creating OpenGL context: eglDisplay "+toHexString(eglDisplay)+ - ", eglConfig "+config+", "+glProfile+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError())); + if( 0 == contextHandle ) { + if( !glp.isGLES() ) { + throw new GLException(getThreadName()+": Unable to create desktop OpenGL context(ARB n/a) on eglDevice "+device+ + ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError())); + } + final int[] reqMajorCTP = new int[] { 0, 0 }; + GLContext.getRequestMajorAndCompat(glp, reqMajorCTP); + reqMajorCTP[1] |= getContextCreationFlags(); + + contextHandle = createContextARBImpl(shareWithHandle, true, reqMajorCTP[1], reqMajorCTP[0], 0); + if( 0 == contextHandle ) { + throw new GLException(getThreadName()+": Unable to create ES OpenGL context on eglDevice "+device+ + ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError())); + } + if( !setGLFunctionAvailability(true, reqMajorCTP[0], 0, reqMajorCTP[1], false /* strictMatch */, false /* withinGLVersionsMapping */) ) { + EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT); + EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle); + contextHandle = 0; + throw new InternalError("setGLFunctionAvailability !strictMatch failed"); + } } if (DEBUG) { - System.err.println(getThreadName() + ": Created OpenGL context 0x" + + System.err.println(getThreadName() + ": EGLContext.createImpl: Created OpenGL context 0x" + Long.toHexString(contextHandle) + ",\n\twrite surface 0x" + Long.toHexString(drawable.getHandle()) + ",\n\tread surface 0x" + Long.toHexString(drawableRead.getHandle())+ ",\n\t"+this+ ",\n\tsharing with 0x" + Long.toHexString(shareWithHandle)); } - if (!EGL.eglMakeCurrent(eglDisplay, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { - throw new GLException("Error making context " + - toHexString(contextHandle) + " current: error code " + toHexString(EGL.eglGetError())); - } - if( !setGLFunctionAvailability(true, contextVersionReq, 0, CTX_PROFILE_ES, - true /* strictMatch */, // always req. strict match - false /* withinGLVersionsMapping */) ) { - if(DEBUG) { - System.err.println(getThreadName() + ": createImpl: setGLFunctionAvailability FAILED delete "+toHexString(contextHandle)); - } - EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT); - EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle); - contextHandle = 0; - return false; - } else { - return true; - } + return 0 != contextHandle; } @Override @@ -246,8 +362,6 @@ public class EGLContext extends GLContextImpl { if (DEBUG) { System.err.println(getThreadName() + ": Initializing EGLextension address table: "+key); } - eglQueryStringInitialized = false; - eglQueryStringAvailable = false; ProcAddressTable table = null; synchronized(mappedContextTypeObjectLock) { @@ -258,31 +372,52 @@ public class EGLContext extends GLContextImpl { if(DEBUG) { System.err.println(getThreadName() + ": GLContext EGL ProcAddressTable reusing key("+key+") -> "+toHexString(table.hashCode())); } + if( null == eglExtImpl || eglExtImpl.getProcAdressTable() != eglExtProcAddressTable ) { + eglExtImpl = new EGLExtImpl(this, eglExtProcAddressTable); + } } else { eglExtProcAddressTable = new EGLExtProcAddressTable(new GLProcAddressResolver()); - resetProcAddressTable(getEGLExtProcAddressTable()); + resetProcAddressTable(eglExtProcAddressTable); synchronized(mappedContextTypeObjectLock) { - mappedGLXProcAddress.put(key, getEGLExtProcAddressTable()); + mappedGLXProcAddress.put(key, eglExtProcAddressTable); if(DEBUG) { - System.err.println(getThreadName() + ": GLContext EGL ProcAddressTable mapping key("+key+") -> "+toHexString(getEGLExtProcAddressTable().hashCode())); + System.err.println(getThreadName() + ": GLContext EGL ProcAddressTable mapping key("+key+") -> "+toHexString(eglExtProcAddressTable.hashCode())); } } + eglExtImpl = new EGLExtImpl(this, eglExtProcAddressTable); } } @Override protected final StringBuilder getPlatformExtensionsStringImpl() { + final EGLGraphicsDevice device = (EGLGraphicsDevice) drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); + return getPlatformExtensionsStringImpl(device); + } + final static StringBuilder getPlatformExtensionsStringImpl(final EGLGraphicsDevice device) { final StringBuilder sb = new StringBuilder(); - if (!eglQueryStringInitialized) { - eglQueryStringAvailable = getDrawableImpl().getGLDynamicLookupHelper().isFunctionAvailable("eglQueryString"); - eglQueryStringInitialized = true; - } - if (eglQueryStringAvailable) { - final String ret = EGL.eglQueryString(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_EXTENSIONS); + device.lock(); + try{ + final long handle = device.getHandle(); if (DEBUG) { - System.err.println("EGL extensions: " + ret); + System.err.println("EGL PlatformExtensions: Device "+device); + EGLDrawableFactory.dumpEGLInfo("EGL PlatformExtensions: ", handle); } - sb.append(ret); + if( device.getEGLVersion().compareTo(Version1_5) >= 0 ) { + final String ret = EGL.eglQueryString(EGL.EGL_NO_DISPLAY, EGL.EGL_EXTENSIONS); + if (DEBUG) { + System.err.println("EGL extensions (Client): " + ret); + } + sb.append(ret).append(" "); + } + if( 0 != handle ) { + final String ret = EGL.eglQueryString(handle, EGL.EGL_EXTENSIONS); + if (DEBUG) { + System.err.println("EGL extensions (Server): " + ret); + } + sb.append(ret).append(" "); + } + } finally { + device.unlock(); } return sb; } @@ -295,12 +430,22 @@ public class EGLContext extends GLContextImpl { return EGL.eglSwapInterval(drawable.getNativeSurface().getDisplayHandle(), interval); } + static long eglGetProcAddress(final long eglGetProcAddressHandle, final String procname) + { + if (0 == eglGetProcAddressHandle) { + throw new GLException("Passed null pointer for method \"eglGetProcAddress\""); + } + return dispatch_eglGetProcAddress0(procname, eglGetProcAddressHandle); + } + /** Entry point to C language function: <code> __EGLFuncPtr eglGetProcAddress(const char * procname) </code> <br>Part of <code>EGL_VERSION_1_X</code> */ + static private native long dispatch_eglGetProcAddress0(String procname, long procAddress); + // // Accessible .. // - /* pp */ void mapCurrentAvailableGLVersion(final AbstractGraphicsDevice device) { - mapStaticGLVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); + /* pp */ void mapCurrentAvailableGLESVersion(final AbstractGraphicsDevice device) { + mapStaticGLESVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); } /* pp */ int getContextOptions() { return ctxOptions; } /* pp */ static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps) { @@ -317,19 +462,19 @@ public class EGLContext extends GLContextImpl { if( !caps.getHardwareAccelerated() ) { reqMajorCTP[1] |= GLContext.CTX_IMPL_ACCEL_SOFT; } - mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]); + mapStaticGLESVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]); } - /* pp */ static void mapStaticGLVersion(final AbstractGraphicsDevice device, final int major, final int minor, final int ctp) { + /* pp */ static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final int major, final int minor, final int ctp) { if( 0 != ( ctp & GLContext.CTX_PROFILE_ES) ) { // ES1, ES2, ES3, .. - mapStaticGLVersion(device, major /* reqMajor */, major, minor, ctp); + mapStaticGLESVersion(device, major /* reqMajor */, major, minor, ctp); if( 3 == major ) { // map ES2 -> ES3 - mapStaticGLVersion(device, 2 /* reqMajor */, major, minor, ctp); + mapStaticGLESVersion(device, 2 /* reqMajor */, major, minor, ctp); } } } - private static void mapStaticGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int major, final int minor, final int ctp) { + private static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final int reqMajor, final int major, final int minor, final int ctp) { GLContext.mapAvailableGLVersion(device, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp); if(! ( device instanceof EGLGraphicsDevice ) ) { final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null); @@ -343,8 +488,8 @@ public class EGLContext extends GLContextImpl { protected static boolean getAvailableGLVersionsSet(final AbstractGraphicsDevice device) { return GLContext.getAvailableGLVersionsSet(device); } - protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device) { - GLContext.setAvailableGLVersionsSet(device); + protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device, final boolean set) { + GLContext.setAvailableGLVersionsSet(device, set); } protected static String toHexString(final int hex) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java index 9499c70f4..3d2d03403 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java @@ -31,16 +31,19 @@ package jogamp.opengl.egl; import java.nio.IntBuffer; import java.util.Iterator; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.ToolkitLock; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ToolkitLock; +import com.jogamp.opengl.GLException; import jogamp.opengl.Debug; +import com.jogamp.common.ExceptionUtils; +import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.LongObjectHashMap; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; /** * This implementation provides recursive calls to @@ -148,7 +151,7 @@ public class EGLDisplayUtil { if(DEBUG || verbose || openEGLDisplays.size() > 0 ) { System.err.println("EGLDisplayUtil.EGLDisplays: Shutdown (open: "+openEGLDisplays.size()+")"); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if( openEGLDisplays.size() > 0) { dumpOpenDisplayConnections(); @@ -198,17 +201,30 @@ public class EGLDisplayUtil { * * @see EGL#eglInitialize(long, IntBuffer, IntBuffer) */ - private static synchronized boolean eglInitialize(final long eglDisplay, final IntBuffer major, final IntBuffer minor) { + private static synchronized boolean eglInitialize(final long eglDisplay, final int[] major, final int[] minor) { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } - final EGLDisplayRef d = EGLDisplayRef.getOrCreateOpened(eglDisplay, major, minor); + final EGLDisplayRef d = EGLDisplayRef.getOrCreateOpened(eglDisplay, _eglMajorVersion, _eglMinorVersion); + final int _major = _eglMajorVersion.get(0); + final int _minor = _eglMinorVersion.get(0); + if( null != major && null != minor ) { + if( null != d ) { + major[0] = _major; + minor[0] = _minor; + } else { + major[0] = 0; + minor[0] = 0; + } + } if(DEBUG) { - System.err.println("EGLDisplayUtil.eglInitialize("+EGLContext.toHexString(eglDisplay)+" ...): "+d+" = "+(null != d)+", singletonEGLDisplay "+singletonEGLDisplay+" (use "+useSingletonEGLDisplay+")"); + System.err.println("EGLDisplayUtil.eglInitialize("+EGLContext.toHexString(eglDisplay)+" ...): "+d+" = "+(null != d)+", eglVersion "+_major+"."+_minor+", singletonEGLDisplay "+singletonEGLDisplay+" (use "+useSingletonEGLDisplay+")"); // Thread.dumpStack(); } return null != d; } + private static final IntBuffer _eglMajorVersion = Buffers.newDirectIntBuffer(1); + private static final IntBuffer _eglMinorVersion = Buffers.newDirectIntBuffer(1); /** * @param nativeDisplayID @@ -222,7 +238,7 @@ public class EGLDisplayUtil { * @see #eglGetDisplay(long) * @see #eglInitialize(long, IntBuffer, IntBuffer) */ - private static synchronized int eglGetDisplayAndInitialize(final long nativeDisplayID, final long[] eglDisplay, final int[] eglErr, final IntBuffer major, final IntBuffer minor) { + private static synchronized int eglGetDisplayAndInitialize(final long nativeDisplayID, final long[] eglDisplay, final int[] eglErr, final int[] major, final int[] minor) { eglDisplay[0] = EGL.EGL_NO_DISPLAY; final long _eglDisplay = eglGetDisplay( nativeDisplayID ); if ( EGL.EGL_NO_DISPLAY == _eglDisplay ) { @@ -244,13 +260,15 @@ public class EGLDisplayUtil { * * @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails incl fallback * @param nativeDisplayID in/out array of size 1, passing the requested nativeVisualID, may return a different revised nativeVisualID handle + * @param major + * @param minor * @return the initialized EGL display ID * @throws GLException if not successful */ - private static synchronized long eglGetDisplayAndInitialize(final long[] nativeDisplayID) { + private static synchronized long eglGetDisplayAndInitialize(final long[] nativeDisplayID, final int[] major, final int[] minor) { final long[] eglDisplay = new long[1]; final int[] eglError = new int[1]; - int eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(nativeDisplayID[0], eglDisplay, eglError, null, null); + int eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(nativeDisplayID[0], eglDisplay, eglError, major, minor); if( EGL.EGL_SUCCESS == eglRes ) { return eglDisplay[0]; } @@ -258,7 +276,7 @@ public class EGLDisplayUtil { if(DEBUG) { System.err.println("EGLDisplayUtil.eglGetAndInitDisplay failed with native "+EGLContext.toHexString(nativeDisplayID[0])+", error "+EGLContext.toHexString(eglRes)+"/"+EGLContext.toHexString(eglError[0])+" - fallback!"); } - eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(EGL.EGL_DEFAULT_DISPLAY, eglDisplay, eglError, null, null); + eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(EGL.EGL_DEFAULT_DISPLAY, eglDisplay, eglError, major, minor); if( EGL.EGL_SUCCESS == eglRes ) { nativeDisplayID[0] = EGL.EGL_DEFAULT_DISPLAY; return eglDisplay[0]; @@ -286,8 +304,8 @@ public class EGLDisplayUtil { private static final EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback = new EGLGraphicsDevice.EGLDisplayLifecycleCallback() { @Override - public long eglGetAndInitDisplay(final long[] nativeDisplayID) { - return eglGetDisplayAndInitialize(nativeDisplayID); + public long eglGetAndInitDisplay(final long[] nativeDisplayID, final int[] major, final int[] minor) { + return eglGetDisplayAndInitialize(nativeDisplayID, major, minor); } @Override public void eglTerminate(final long eglDisplayHandle) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java index bacf9f18e..e63a63634 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java @@ -36,114 +36,65 @@ package jogamp.opengl.egl; -import java.nio.IntBuffer; - -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.ProxySurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import jogamp.nativewindow.ProxySurfaceImpl; import jogamp.opengl.GLDrawableImpl; -import jogamp.opengl.GLDynamicLookupHelper; -import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; -public abstract class EGLDrawable extends GLDrawableImpl { +public class EGLDrawable extends GLDrawableImpl { + static boolean DEBUG = GLDrawableImpl.DEBUG; - protected EGLDrawable(final EGLDrawableFactory factory, final NativeSurface component) throws GLException { + protected EGLDrawable(final EGLDrawableFactory factory, final EGLSurface component) throws GLException { super(factory, component, false); } @Override - public abstract GLContext createContext(GLContext shareWith); - - protected abstract long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle); - - private final long createEGLSurface() { - final EGLWrappedSurface eglws = (EGLWrappedSurface) surface; - final EGLGraphicsConfiguration eglConfig = (EGLGraphicsConfiguration) eglws.getGraphicsConfiguration(); - final NativeSurface upstreamSurface = eglws.getUpstreamSurface(); - - long eglSurface = createSurface(eglConfig, eglws.getSurfaceWidth(), eglws.getSurfaceHeight(), upstreamSurface.getSurfaceHandle()); - - int eglError0; - if (EGL.EGL_NO_SURFACE == eglSurface) { - eglError0 = EGL.eglGetError(); - if(EGL.EGL_BAD_NATIVE_WINDOW == eglError0) { - // Try window handle if available and differs (Windows HDC / HWND). - // ANGLE impl. required HWND on Windows. - if(upstreamSurface instanceof NativeWindow) { - final NativeWindow nw = (NativeWindow) upstreamSurface; - if(nw.getWindowHandle() != nw.getSurfaceHandle()) { - if(DEBUG) { - System.err.println(getThreadName() + ": Info: Creation of window surface w/ surface handle failed: "+eglConfig+", error "+toHexString(eglError0)+", retry w/ windowHandle"); - } - eglSurface = createSurface(eglConfig, eglws.getSurfaceWidth(), eglws.getSurfaceHeight(), nw.getWindowHandle()); - if (EGL.EGL_NO_SURFACE == eglSurface) { - eglError0 = EGL.eglGetError(); - } - } - } - } - } else { - eglError0 = EGL.EGL_SUCCESS; - } - if (EGL.EGL_NO_SURFACE == eglSurface) { - throw new GLException("Creation of window surface failed: "+eglConfig+", "+surface+", error "+toHexString(eglError0)); - } - if(DEBUG) { - System.err.println(getThreadName() + ": createEGLSurface handle "+toHexString(eglSurface)); - } - return eglSurface; + public final GLContext createContext(final GLContext shareWith) { + return new EGLContext(this, shareWith); } @Override protected final void createHandle() { - final EGLWrappedSurface eglws = (EGLWrappedSurface) surface; + final EGLSurface eglSurf = (EGLSurface) surface; if(DEBUG) { - System.err.println(getThreadName() + ": createHandle of "+eglws); + System.err.println(getThreadName() + ": createHandle of "+eglSurf); + ProxySurfaceImpl.dumpHierarchy(System.err, eglSurf); } - if( eglws.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { - if( EGL.EGL_NO_SURFACE != eglws.getSurfaceHandle() ) { - throw new InternalError("Set surface but claimed to be invalid: "+eglws); + if( eglSurf.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { + if( EGL.EGL_NO_SURFACE != eglSurf.getSurfaceHandle() ) { + throw new InternalError("Set surface but claimed to be invalid: "+eglSurf); } - eglws.setSurfaceHandle( createEGLSurface() ); - } else if( EGL.EGL_NO_SURFACE == eglws.getSurfaceHandle() ) { - throw new InternalError("Nil surface but claimed to be valid: "+eglws); + if( !eglSurf.containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS ) ) { + eglSurf.setEGLSurfaceHandle(); + } + } else if( EGL.EGL_NO_SURFACE == eglSurf.getSurfaceHandle() ) { + throw new InternalError("Nil surface but claimed to be valid: "+eglSurf); } } @Override protected void destroyHandle() { - final EGLWrappedSurface eglws = (EGLWrappedSurface) surface; + final EGLSurface eglSurf = (EGLSurface) surface; + final long eglSurfHandle = eglSurf.getSurfaceHandle(); if(DEBUG) { - System.err.println(getThreadName() + ": destroyHandle of "+eglws); - } - if( EGL.EGL_NO_SURFACE == eglws.getSurfaceHandle() ) { - throw new InternalError("Nil surface but claimed to be valid: "+eglws); - } - final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) eglws.getGraphicsConfiguration().getScreen().getDevice(); - if( eglws.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { - EGL.eglDestroySurface(eglDevice.getHandle(), eglws.getSurfaceHandle()); - eglws.setSurfaceHandle(EGL.EGL_NO_SURFACE); + System.err.println(getThreadName() + ": destroyHandle of "+eglSurf); } - } - - protected static boolean isValidEGLSurface(final long eglDisplayHandle, final long surfaceHandle) { - if( 0 == surfaceHandle ) { - return false; + if( !eglSurf.containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS ) && + EGL.EGL_NO_SURFACE == eglSurfHandle ) { + throw new InternalError("Nil surface but claimed to be valid: "+eglSurf); } - final IntBuffer val = Buffers.newDirectIntBuffer(1); - final boolean eglSurfaceValid = EGL.eglQuerySurface(eglDisplayHandle, surfaceHandle, EGL.EGL_CONFIG_ID, val); - if( !eglSurfaceValid ) { - final int eglErr = EGL.eglGetError(); - if(DEBUG) { - System.err.println(getThreadName() + ": EGLDrawable.isValidEGLSurface eglQuerySuface failed: error "+toHexString(eglErr)+", "+toHexString(surfaceHandle)); + final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) eglSurf.getGraphicsConfiguration().getScreen().getDevice(); + if( eglSurf.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { + if( EGL.EGL_NO_SURFACE != eglSurfHandle ) { + EGL.eglDestroySurface(eglDevice.getHandle(), eglSurfHandle); + eglSurf.setSurfaceHandle(EGL.EGL_NO_SURFACE); } } - return eglSurfaceValid; } @Override @@ -165,19 +116,6 @@ public abstract class EGLDrawable extends GLDrawableImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper() { - if (getGLProfile().usesNativeGLES3()) { - return getFactoryImpl().getGLDynamicLookupHelper(3); - } else if (getGLProfile().usesNativeGLES2()) { - return getFactoryImpl().getGLDynamicLookupHelper(2); - } else if (getGLProfile().usesNativeGLES1()) { - return getFactoryImpl().getGLDynamicLookupHelper(1); - } else { - throw new GLException("Unsupported: "+getGLProfile()); - } - } - - @Override public String toString() { return getClass().getName()+"[realized "+isRealized()+ ",\n\tfactory "+getFactory()+ diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index 2edb22314..8e2535309 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -40,33 +40,31 @@ import java.nio.IntBuffer; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.MutableSurface; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.MutableSurface; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.common.os.PlatformPropsImpl; -import jogamp.nativewindow.WrappedSurface; import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableFactoryImpl; @@ -75,16 +73,22 @@ import jogamp.opengl.GLDynamicLookupHelper; import jogamp.opengl.GLGraphicsConfigurationUtil; import jogamp.opengl.SharedResourceRunner; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; +import com.jogamp.common.os.DynamicLookupHelper; import com.jogamp.common.os.Platform; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; +import com.jogamp.common.util.VersionNumber; +import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; +import com.jogamp.opengl.egl.EGL; public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; // allow package access + private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG; /* package */ static final boolean QUERY_EGL_ES_NATIVE_TK; @@ -93,8 +97,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { QUERY_EGL_ES_NATIVE_TK = PropertyAccess.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true); } + private static boolean eglDynamicLookupHelperInit = false; private static GLDynamicLookupHelper eglES1DynamicLookupHelper = null; private static GLDynamicLookupHelper eglES2DynamicLookupHelper = null; + private static GLDynamicLookupHelper eglGLnDynamicLookupHelper = null; private static final boolean isANGLE(final GLDynamicLookupHelper dl) { if(Platform.OSType.WINDOWS == PlatformPropsImpl.OS_TYPE) { @@ -112,50 +118,103 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { dl.isFunctionAvailable("glColorPointer"); } - public EGLDrawableFactory() { - super(); + private static class EGLFeatures { + public final String vendor; + public final VersionNumber version; + public final boolean hasGLAPI; + public final boolean hasKHRCreateContext; + public final boolean hasKHRSurfaceless; - // Register our GraphicsConfigurationFactory implementations - // The act of constructing them causes them to be registered - EGLGraphicsConfigurationFactory.registerFactory(); - - // Check for other underlying stuff .. - if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true)) { - hasX11 = true; - try { - ReflectionUtil.createInstance("jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory", EGLDrawableFactory.class.getClassLoader()); - } catch (final Exception jre) { /* n/a .. */ } + public EGLFeatures(final EGLGraphicsDevice device) { + final long eglDisplay = device.getHandle(); + vendor = EGL.eglQueryString(eglDisplay, EGL.EGL_VENDOR); + if(DEBUG) { + System.err.println("EGLFeatures on device "+device+", vendor "+vendor); + } + version = device.getEGLVersion(); + final boolean hasEGL_1_4 = version.compareTo(GLContext.Version1_4) >= 0; + final boolean hasEGL_1_5 = version.compareTo(GLContext.Version1_5) >= 0; + { + boolean _hasGLAPI = false; + final String eglClientAPIStr = EGL.eglQueryString(eglDisplay, EGL.EGL_CLIENT_APIS); + if( hasEGL_1_4 ) { + final String[] eglClientAPIs = eglClientAPIStr.split("\\s"); + for(int i=eglClientAPIs.length-1; i>=0; i--) { + _hasGLAPI = eglClientAPIs[i].equals("OpenGL"); + } + } + hasGLAPI = _hasGLAPI; + if(DEBUG) { + System.err.println(" Client APIs: "+eglClientAPIStr+"; has EGL 1.4 "+hasEGL_1_4+" -> has OpenGL "+hasGLAPI); + } + } + { + final String extensions = EGLContext.getPlatformExtensionsStringImpl(device).toString(); + if( hasEGL_1_5 ) { + // subsumed in EGL 1.5 + hasKHRCreateContext = true; + hasKHRSurfaceless = true; + } else { + if( hasEGL_1_4 ) { + // requires EGL 1.4 + hasKHRCreateContext = extensions.contains("EGL_KHR_create_context"); + } else { + hasKHRCreateContext = false; + } + hasKHRSurfaceless = extensions.contains("EGL_KHR_surfaceless_context"); + } + if(DEBUG) { + System.err.println(" Extensions: "+extensions); + System.err.println(" KHR_create_context: "+hasKHRCreateContext); + System.err.println(" KHR_surfaceless_context: "+hasKHRSurfaceless); + } + } + } + public final String toString() { + return "EGLFeatures[vendor "+vendor+", version "+version+ + ", has[GL-API "+hasGLAPI+", KHR[CreateContext "+hasKHRCreateContext+", Surfaceless "+hasKHRSurfaceless+"]]]"; } + } + + static class EGLAcc extends EGL { + protected static boolean resetProcAddressTable(final DynamicLookupHelper lookup) { + return EGL.resetProcAddressTable(lookup); + } + } + static final String eglInitializeFuncName = "eglInitialize"; - // FIXME: Probably need to move EGL from a static model - // to a dynamic one, where there can be 2 instances - // for each ES profile with their own ProcAddressTable. + public EGLDrawableFactory() { + super(); synchronized(EGLDrawableFactory.class) { - final boolean hasDesktopES2 = null != eglES2DynamicLookupHelper; + if( eglDynamicLookupHelperInit ) { + return; + } + eglDynamicLookupHelperInit = true; - if(!hasDesktopES2 && null==eglES1DynamicLookupHelper) { - GLDynamicLookupHelper tmp=null; + // Check for other underlying stuff .. + if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true)) { + hasX11 = true; try { - tmp = new GLDynamicLookupHelper(new EGLES1DynamicLibraryBundleInfo()); - } catch (final GLException gle) { - if(DEBUG) { - gle.printStackTrace(); - } - } - if(null!=tmp && tmp.isLibComplete()) { - eglES1DynamicLookupHelper = tmp; - EGL.resetProcAddressTable(eglES1DynamicLookupHelper); - final boolean isANGLEES1 = isANGLE(eglES1DynamicLookupHelper); - isANGLE |= isANGLEES1; - if (DEBUG || GLProfile.DEBUG) { - System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK, isANGLE: "+isANGLEES1); - } - } else if (DEBUG || GLProfile.DEBUG) { - System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE (ES1 lib)"); - } + ReflectionUtil.createInstance("jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory", EGLDrawableFactory.class.getClassLoader()); + } catch (final Exception jre) { /* n/a .. */ } } - if(!hasDesktopES2 && null==eglES2DynamicLookupHelper) { + + /** + * FIXME: Probably need to move EGL from a static model + * to a dynamic one, where there can be 2 instances + * for each ES profile with their own ProcAddressTable. + * + * Since EGL is designed to be static + * we validate the function address of 'eglInitialize' + * with all EGL/ES and EGL/GL combinations. + * In case this address doesn't match the primary tuple EGL/ES2 + * the profile is skipped! + */ + boolean eglTableReset = false; + long eglInitializeAddress = 0; + // Setup: eglES2DynamicLookupHelper[, eglES1DynamicLookupHelper] + { GLDynamicLookupHelper tmp=null; try { tmp = new GLDynamicLookupHelper(new EGLES2DynamicLibraryBundleInfo()); @@ -164,9 +223,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { gle.printStackTrace(); } } - if(null!=tmp && tmp.isLibComplete()) { + if( null != tmp && tmp.isLibComplete() && true == ( eglTableReset = EGLAcc.resetProcAddressTable(tmp) ) ) { + eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName); eglES2DynamicLookupHelper = tmp; - EGL.resetProcAddressTable(eglES2DynamicLookupHelper); final boolean includesES1 = null == eglES1DynamicLookupHelper && includesES1(eglES2DynamicLookupHelper); if(includesES1) { eglES1DynamicLookupHelper = tmp; @@ -174,7 +233,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { final boolean isANGLEES2 = isANGLE(eglES2DynamicLookupHelper); isANGLE |= isANGLEES2; if (DEBUG || GLProfile.DEBUG) { - System.err.println("Info: EGLDrawableFactory: EGL ES2 - OK (includesES1 "+includesES1+", isANGLE: "+isANGLEES2+")"); + System.err.println("Info: EGLDrawableFactory: EGL ES2 - OK (includesES1 "+includesES1+", isANGLE: "+isANGLEES2+", eglInitialize 0x"+Long.toHexString(eglInitializeAddress)+")"); if(includesES1) { System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK (ES2 lib)"); } @@ -183,7 +242,85 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { System.err.println("Info: EGLDrawableFactory: EGL ES2 - NOPE"); } } - if( null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper ) { + // Setup: eglES1DynamicLookupHelper + if( null == eglES1DynamicLookupHelper ) { + GLDynamicLookupHelper tmp=null; + try { + tmp = new GLDynamicLookupHelper(new EGLES1DynamicLibraryBundleInfo()); + } catch (final GLException gle) { + if(DEBUG) { + gle.printStackTrace(); + } + } + if( null != tmp && tmp.isLibComplete() ) { + final boolean ok; + final long _eglInitializeAddress; + if( !eglTableReset ) { + if( true == ( eglTableReset = EGLAcc.resetProcAddressTable(tmp) ) ) { + _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName); + eglInitializeAddress = _eglInitializeAddress; + ok = true; + } else { + _eglInitializeAddress = 0; + ok = false; + } + } else { + _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName); + ok = _eglInitializeAddress == eglInitializeAddress; + } + if( ok ) { + eglES1DynamicLookupHelper = tmp; + final boolean isANGLEES1 = isANGLE(eglES1DynamicLookupHelper); + isANGLE |= isANGLEES1; + if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK (isANGLE: "+isANGLEES1+", eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")"); + } + } else if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE (ES1 proc, eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")"); + } + } else if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE (ES1 lib)"); + } + } + // Setup: eglGLnDynamicLookupHelper + if( null == eglGLnDynamicLookupHelper ) { + GLDynamicLookupHelper tmp=null; + try { + tmp = new GLDynamicLookupHelper(new EGLGLnDynamicLibraryBundleInfo()); + } catch (final GLException gle) { + if(DEBUG) { + gle.printStackTrace(); + } + } + if( null != tmp && tmp.isLibComplete() ) { + final boolean ok; + final long _eglInitializeAddress; + if( !eglTableReset ) { + if( true == ( eglTableReset = EGLAcc.resetProcAddressTable(tmp) ) ) { + _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName); + eglInitializeAddress = _eglInitializeAddress; + ok = true; + } else { + _eglInitializeAddress = 0; + ok = false; + } + } else { + _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName); + ok = _eglInitializeAddress == eglInitializeAddress; + } + if( ok ) { + eglGLnDynamicLookupHelper = tmp; + if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL GLn - OK (eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")"); + } + } else if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL GLn - NOPE (GLn proc, eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")"); + } + } else if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL GLn - NOPE (GLn lib)"); + } + } + if( null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper || null != eglGLnDynamicLookupHelper ) { if(isANGLE && !GLProfile.enableANGLE) { if(DEBUG || GLProfile.DEBUG) { System.err.println("Info: EGLDrawableFactory.init - EGL/ES2 ANGLE disabled"); @@ -192,13 +329,22 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if( isANGLE && ( DEBUG || GLProfile.DEBUG ) ) { System.err.println("Info: EGLDrawableFactory.init - EGL/ES2 ANGLE enabled"); } - sharedMap = new HashMap<String /*uniqueKey*/, SharedResource>(); - sharedMapCreateAttempt = new HashSet<String>(); + // Register our GraphicsConfigurationFactory implementations + // The act of constructing them causes them to be registered + EGLGraphicsConfigurationFactory.registerFactory(); + + sharedMap = new HashMap<String, SharedResourceRunner.Resource>(); + // FIXME: defaultDevice.open() triggers eglInitialize(..) which crashed on Windows w/ Chrome/ANGLE, FF/ANGLE! defaultDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT); + + // Init shared resources off thread + // Will be released via ShutdownHook + sharedResourceRunner = new SharedResourceRunner(new SharedResourceImplementation()); + sharedResourceRunner.start(); } } - } + } // synchronized(EGLDrawableFactory.class) } @Override @@ -212,26 +358,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if( DEBUG ) { System.err.println("EGLDrawableFactory.shutdown"); } + if(null != sharedResourceRunner) { + sharedResourceRunner.stop(); + sharedResourceRunner = null; + } if(null != sharedMap) { - if(DEBUG) { - dumpMap(); - } - final Collection<SharedResource> srl = sharedMap.values(); - for(final Iterator<SharedResource> sri = srl.iterator(); sri.hasNext(); ) { - final SharedResource sr = sri.next(); - if(DEBUG) { - System.err.println("EGLDrawableFactory.shutdown: "+sr.device.toString()); - } - sr.device.close(); - } sharedMap.clear(); - sharedMapCreateAttempt.clear(); sharedMap = null; - sharedMapCreateAttempt = null; - } - if(null != defaultSharedResource) { - defaultSharedResource = null; } + if(null != defaultDevice) { defaultDevice.close(); defaultDevice = null; @@ -247,6 +382,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { // eglES2DynamicLookupHelper.destroy(); eglES2DynamicLookupHelper = null; } + if(null != eglGLnDynamicLookupHelper) { + // eglGLDynamicLookupHelper.destroy(); + eglGLnDynamicLookupHelper = null; + } EGLGraphicsConfigurationFactory.unregisterFactory(); EGLDisplayUtil.shutdown(DEBUG); } @@ -258,65 +397,59 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { final Set<String> keys = sharedMap.keySet(); for(final Iterator<String> keyI = keys.iterator(); keyI.hasNext(); i++) { final String key = keyI.next(); - final SharedResource sr = sharedMap.get(key); - System.err.println("EGLDrawableFactory.map["+i+"] "+key+" -> "+sr.getDevice()+", "+ - "es1 [avail "+sr.wasES1ContextCreated+", pbuffer "+sr.hasPBufferES1+", quirks "+sr.rendererQuirksES1+", ctp "+EGLContext.getGLVersion(1, 0, sr.ctpES1, null)+"], "+ - "es2/3 [es2 "+sr.wasES2ContextCreated+", es3 "+sr.wasES3ContextCreated+", [pbuffer "+sr.hasPBufferES3ES2+", quirks "+sr.rendererQuirksES3ES2+", ctp "+EGLContext.getGLVersion(2, 0, sr.ctpES3ES2, null)+"]]"); + final SharedResource sr = (SharedResource) sharedMap.get(key); + System.err.println("EGLDrawableFactory.map["+i+"] "+key+" -> "+sr.getDevice()+", avail "+sr.isAvailable+ + "gln [quirks "+sr.rendererQuirksGLn+", ctp "+EGLContext.getGLVersion(3, 0, sr.ctpGLn, null)+"], "+ + "es1 [quirks "+sr.rendererQuirksES1+", ctp "+EGLContext.getGLVersion(1, 0, sr.ctpES1, null)+"], "+ + "es2/3 [quirks "+sr.rendererQuirksES3ES2+", ctp "+EGLContext.getGLVersion(2, 0, sr.ctpES3ES2, null)+"]"); } ; } } - private HashMap<String /*uniqueKey*/, SharedResource> sharedMap = null; - private HashSet<String> sharedMapCreateAttempt = null; - private EGLGraphicsDevice defaultDevice = null; - private SharedResource defaultSharedResource = null; private boolean isANGLE = false; private boolean hasX11 = false; + private EGLGraphicsDevice defaultDevice = null; + private EGLFeatures defaultDeviceEGLFeatures; + private SharedResourceRunner sharedResourceRunner; + private HashMap<String /* uniqueKey */, SharedResourceRunner.Resource> sharedMap; static class SharedResource implements SharedResourceRunner.Resource { - private final EGLGraphicsDevice device; + private EGLGraphicsDevice device; // private final EGLContext contextES1; // private final EGLContext contextES2; // private final EGLContext contextES3; - private final boolean wasES1ContextCreated; - private final boolean wasES2ContextCreated; - private final boolean wasES3ContextCreated; - private final GLRendererQuirks rendererQuirksES1; - private final GLRendererQuirks rendererQuirksES3ES2; - private final int ctpES1; - private final int ctpES3ES2; - private final boolean hasPBufferES1; - private final boolean hasPBufferES3ES2; - - SharedResource(final EGLGraphicsDevice dev, - final boolean wasContextES1Created, final boolean hasPBufferES1, final GLRendererQuirks rendererQuirksES1, final int ctpES1, - final boolean wasContextES2Created, final boolean wasContextES3Created, - final boolean hasPBufferES3ES2, final GLRendererQuirks rendererQuirksES3ES2, final int ctpES3ES2) { + final boolean isAvailable; + final GLRendererQuirks rendererQuirksGLn; + final GLRendererQuirks rendererQuirksES1; + final GLRendererQuirks rendererQuirksES3ES2; + final int ctpGLn; + final int ctpES1; + final int ctpES3ES2; + + SharedResource(final EGLGraphicsDevice dev, final boolean isAvailable, + final GLRendererQuirks rendererQuirksGLn, final int ctpGLn, + final GLRendererQuirks rendererQuirksES1, final int ctpES1, + final GLRendererQuirks rendererQuirksES3ES2, final int ctpES3ES2) { this.device = dev; - // this.contextES1 = ctxES1; - this.wasES1ContextCreated = wasContextES1Created; - this.hasPBufferES1= hasPBufferES1; + this.isAvailable = isAvailable; + + this.rendererQuirksGLn = rendererQuirksGLn; + this.ctpGLn = ctpGLn; + this.rendererQuirksES1 = rendererQuirksES1; this.ctpES1 = ctpES1; - // this.contextES2 = ctxES2; - // this.contextES3 = ctxES3; - this.wasES2ContextCreated = wasContextES2Created; - this.wasES3ContextCreated = wasContextES3Created; - this.hasPBufferES3ES2= hasPBufferES3ES2; this.rendererQuirksES3ES2 = rendererQuirksES3ES2; this.ctpES3ES2 = ctpES3ES2; } + @Override - public final boolean isValid() { - return wasES1ContextCreated || wasES2ContextCreated || wasES3ContextCreated; + public final boolean isAvailable() { + return isAvailable; } @Override public final EGLGraphicsDevice getDevice() { return device; } - // final EGLContext getContextES1() { return contextES1; } - // final EGLContext getContextES2() { return contextES2; } - // final EGLContext getContextES3() { return contextES3; } @Override public AbstractGraphicsScreen getScreen() { @@ -331,368 +464,416 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return null; } @Override - public GLRendererQuirks getRendererQuirks() { - return null != rendererQuirksES3ES2 ? rendererQuirksES3ES2 : rendererQuirksES1 ; + public GLRendererQuirks getRendererQuirks(final GLProfile glp) { + if( null == glp ) { + if( null != rendererQuirksES3ES2 ) { + return rendererQuirksES3ES2; + } else if( null != rendererQuirksES1 ) { + return rendererQuirksES1; + } else { + return rendererQuirksGLn; + } + } else if( !glp.isGLES() ) { + return rendererQuirksGLn; + } else if( glp.isGLES1() ) { + return rendererQuirksES1; + } else { + return rendererQuirksES3ES2; + } } - } - - @Override - public final AbstractGraphicsDevice getDefaultDevice() { - return defaultDevice; - } + } - @Override - public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { - // via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types. - return null != sharedMap ; // null!=eglES2DynamicLookupHelper || null!=eglES1DynamicLookupHelper; - } + class SharedResourceImplementation implements SharedResourceRunner.Implementation { + @Override + public void clear() { + sharedMap.clear(); + } + @Override + public SharedResourceRunner.Resource mapPut(final AbstractGraphicsDevice device, final SharedResourceRunner.Resource resource) { + return sharedMap.put(device.getConnection(), resource); + } + @Override + public SharedResourceRunner.Resource mapGet(final AbstractGraphicsDevice device) { + return sharedMap.get(device.getConnection()); + } + @Override + public Collection<SharedResourceRunner.Resource> mapValues() { + return sharedMap.values(); + } - private static List<GLCapabilitiesImmutable> getAvailableEGLConfigs(final EGLGraphicsDevice eglDisplay, final GLCapabilitiesImmutable caps) { - final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); - if(!EGL.eglGetConfigs(eglDisplay.getHandle(), null, 0, numConfigs)) { - throw new GLException("EGLDrawableFactory.getAvailableEGLConfigs: Get maxConfigs (eglGetConfigs) call failed, error "+EGLContext.toHexString(EGL.eglGetError())); + @Override + public boolean isDeviceSupported(final AbstractGraphicsDevice device) { + return null != sharedMap; // null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper } - if(0 < numConfigs.get(0)) { - final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); - final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(caps); - final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(caps); - if( EGL.eglChooseConfig(eglDisplay.getHandle(), attrs, configs, configs.capacity(), numConfigs) && numConfigs.get(0) > 0) { - return EGLGraphicsConfigurationFactory.eglConfigs2GLCaps(eglDisplay, caps.getGLProfile(), configs, numConfigs.get(0), winattrmask, false /* forceTransparentFlag */, false /* onlyFirstValid */); + + @Override + public SharedResourceRunner.Resource createSharedResource(final AbstractGraphicsDevice adevice) { + adevice.lock(); + try { + return createEGLSharedResourceImpl(adevice); + } catch (final Throwable t) { + throw new GLException("EGLGLXDrawableFactory - Could not initialize shared resources for "+adevice, t); + } finally { + adevice.unlock(); } } - return new ArrayList<GLCapabilitiesImmutable>(0); - } - private static void dumpEGLInfo(final String prefix, final long eglDisplay) { - final String eglVendor = EGL.eglQueryString(eglDisplay, EGL.EGL_VENDOR); - final String eglClientAPIs = EGL.eglQueryString(eglDisplay, EGL.EGL_CLIENT_APIS); - final String eglVersion = EGL.eglQueryString(eglDisplay, EGL.EGL_VERSION); - System.err.println(prefix+"EGL vendor "+eglVendor+", version "+eglVersion+", clientAPIs "+eglClientAPIs); - } - - private boolean mapAvailableEGLESConfig(final AbstractGraphicsDevice adevice, final int[] esProfile, - final boolean[] hasPBuffer, final GLRendererQuirks[] rendererQuirks, final int[] ctp) { - final String profileString; - switch( esProfile[0] ) { - case 3: - profileString = GLProfile.GLES3; break; - case 2: - profileString = GLProfile.GLES2; break; - case 1: - profileString = GLProfile.GLES1; break; - default: - throw new GLException("Invalid ES profile number "+esProfile[0]); - } - if ( !GLProfile.isAvailable(adevice, profileString) ) { - if( DEBUG ) { - System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" n/a on "+adevice); + private SharedResource createEGLSharedResourceImpl(final AbstractGraphicsDevice adevice) { + final GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null }; + final GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; + final GLRendererQuirks[] rendererQuirksGLn = new GLRendererQuirks[] { null }; + final int[] ctpES1 = new int[] { EGLContext.CTX_PROFILE_ES }; + final int[] ctpES3ES2 = new int[] { EGLContext.CTX_PROFILE_ES }; + final int[] ctpGLn = new int[] { EGLContext.CTX_PROFILE_CORE }; + + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.createShared(): device "+adevice); } - return false; - } - final GLProfile glp = GLProfile.get(adevice, profileString) ; - final GLDrawableFactoryImpl desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getDesktopFactory(); - final boolean initDefaultDevice = 0 == defaultDevice.getHandle(); // Note: GLProfile always triggers EGL device initialization first! - final boolean mapsADeviceToDefaultDevice = !QUERY_EGL_ES_NATIVE_TK || initDefaultDevice || - null == desktopFactory || adevice instanceof EGLGraphicsDevice ; - if( DEBUG ) { - System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" ( "+esProfile[0]+" ), "+ - "defaultSharedResourceSet "+(null!=defaultSharedResource)+", mapsADeviceToDefaultDevice "+mapsADeviceToDefaultDevice+ - " (QUERY_EGL_ES_NATIVE_TK "+QUERY_EGL_ES_NATIVE_TK+", hasDesktopFactory "+(null != desktopFactory)+ - ", isEGLGraphicsDevice "+(adevice instanceof EGLGraphicsDevice)+")"); - } - - EGLGraphicsDevice eglDevice = null; - NativeSurface surface = null; - ProxySurface upstreamSurface = null; // X11, GLX, .. - ProxySurface downstreamSurface = null; // EGL - boolean success = false; - try { - final GLCapabilities reqCapsAny = new GLCapabilities(glp); - reqCapsAny.setRedBits(5); reqCapsAny.setGreenBits(5); reqCapsAny.setBlueBits(5); reqCapsAny.setAlphaBits(0); - reqCapsAny.setDoubleBuffered(false); - - if( mapsADeviceToDefaultDevice ) { - // In this branch, any non EGL device is mapped to EGL default shared resources (default behavior). - // Only one default shared resource instance is ever be created. - if( initDefaultDevice ) { - defaultDevice.open(); - - // Probe for GLRendererQuirks.SingletonEGLDisplayOnly - final long secondEGLDisplay = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY); - if ( EGL.EGL_NO_DISPLAY == secondEGLDisplay ) { - final int[] quirks = { GLRendererQuirks.SingletonEGLDisplayOnly }; - GLRendererQuirks.addStickyDeviceQuirks(adevice, quirks, 0, 1); - EGLDisplayUtil.setSingletonEGLDisplayOnly(true); - if(DEBUG) { - System.err.println("Quirk: "+GLRendererQuirks.toString(quirks[0])+": cause: Second eglGetDisplay(EGL_DEFAULT_DISPLAY) failed"); + + boolean madeCurrentES1 = false; + boolean madeCurrentES2 = false; + boolean madeCurrentES3 = false; + boolean madeCurrentGLn = false; + + if( null != eglGLnDynamicLookupHelper ) { + // OpenGL 3.1 core -> GL3, will utilize normal desktop profile mapping + final int[] major = { 3 }; + final int[] minor = { 1 }; // FIXME: No minor version probing for ES currently! + madeCurrentGLn = mapAvailableEGLESConfig(adevice, major, minor, + ctpGLn, rendererQuirksGLn) && 0 != major[0]; + } else { + madeCurrentGLn = false; + } + EGLContext.setAvailableGLVersionsSet(adevice, true); + + if( null != eglES1DynamicLookupHelper ) { + final int[] major = { 1 }; + final int[] minor = { 0 }; + madeCurrentES1 = mapAvailableEGLESConfig(adevice, major, minor, + ctpES1, rendererQuirksES1) && 1 == major[0]; + } else { + madeCurrentES1 = false; + } + if( null != eglES2DynamicLookupHelper ) { + // ES3 Query + final int[] major = { 3 }; + final int[] minor = { 0 }; + madeCurrentES3 = mapAvailableEGLESConfig(adevice, major, minor, + ctpES3ES2, rendererQuirksES3ES2) && 3 == major[0]; + if( !madeCurrentES3 ) { + // ES2 Query, may result in ES3 + major[0] = 2; + if( mapAvailableEGLESConfig(adevice, major, minor, + ctpES3ES2, rendererQuirksES3ES2) ) + { + switch( major[0] ) { + case 2: madeCurrentES2 = true; break; + case 3: madeCurrentES3 = true; break; + default: throw new InternalError("XXXX Got "+major[0]); } } } - if( DEBUG ) { - dumpEGLInfo("EGLDrawableFactory.mapAvailableEGLESConfig: ", defaultDevice.getHandle()); - } + } + + if( hasX11 ) { + handleDontCloseX11DisplayQuirk(rendererQuirksES1[0]); + handleDontCloseX11DisplayQuirk(rendererQuirksES3ES2[0]); + } + final SharedResource sr = new SharedResource(defaultDevice, + madeCurrentGLn || madeCurrentES1 || madeCurrentES2 || madeCurrentES3, + rendererQuirksGLn[0], ctpGLn[0], + rendererQuirksES1[0], ctpES1[0], + rendererQuirksES3ES2[0], ctpES3ES2[0]); + + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.createShared: devices: queried nativeTK "+QUERY_EGL_ES_NATIVE_TK+", adevice " + adevice + ", defaultDevice " + defaultDevice); + System.err.println("EGLDrawableFactory.createShared: context GLn: " + madeCurrentGLn + ", quirks "+rendererQuirksGLn[0]); + System.err.println("EGLDrawableFactory.createShared: context ES1: " + madeCurrentES1 + ", quirks "+rendererQuirksES1[0]); + System.err.println("EGLDrawableFactory.createShared: context ES2: " + madeCurrentES2 + ", quirks "+rendererQuirksES3ES2[0]); + System.err.println("EGLDrawableFactory.createShared: context ES3: " + madeCurrentES3 + ", quirks "+rendererQuirksES3ES2[0]); + dumpMap(); + } + return sr; + } + + private void handleDontCloseX11DisplayQuirk(final GLRendererQuirks quirks) { + if( null != quirks && quirks.exist( GLRendererQuirks.DontCloseX11Display ) ) { + jogamp.nativewindow.x11.X11Util.markAllDisplaysUnclosable(); + } + } - final GLCapabilitiesImmutable reqCapsPBuffer = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(reqCapsAny); - final List<GLCapabilitiesImmutable> availablePBufferCapsL = getAvailableEGLConfigs(defaultDevice, reqCapsPBuffer); - hasPBuffer[0] = availablePBufferCapsL.size() > 0; + private boolean mapAvailableEGLESConfig(final AbstractGraphicsDevice adevice, + final int[] majorVersion, final int[] minorVersion, + final int[] ctxProfile, final GLRendererQuirks[] rendererQuirks) { + final String profileString = EGLContext.getGLProfile(majorVersion[0], minorVersion[0], ctxProfile[0]); - // 1st case: adevice is not the EGL default device, map default shared resources - if( adevice != defaultDevice ) { - if(null == defaultSharedResource) { - return false; - } - switch(esProfile[0]) { - case 3: - if( !defaultSharedResource.wasES3ContextCreated ) { - return false; - } - rendererQuirks[0] = defaultSharedResource.rendererQuirksES3ES2; - ctp[0] = defaultSharedResource.ctpES3ES2; - break; - case 2: - if( !defaultSharedResource.wasES2ContextCreated ) { - return false; - } - rendererQuirks[0] = defaultSharedResource.rendererQuirksES3ES2; - ctp[0] = defaultSharedResource.ctpES3ES2; - break; - case 1: - if( !defaultSharedResource.wasES1ContextCreated ) { - return false; + if ( !GLProfile.isAvailable(adevice, profileString) ) { + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" n/a on "+adevice); + } + return false; + } + final GLProfile glp = GLProfile.get(adevice, profileString) ; + final GLDrawableFactoryImpl desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getDesktopFactory(); + final boolean initDefaultDevice = 0 == defaultDevice.getHandle(); // Note: GLProfile always triggers EGL device initialization first! + final boolean mapsADeviceToDefaultDevice = !QUERY_EGL_ES_NATIVE_TK || initDefaultDevice || + null == desktopFactory; + // FIXME || adevice instanceof EGLGraphicsDevice ; + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" ( "+majorVersion[0]+" ), "+ + "mapsADeviceToDefaultDevice "+mapsADeviceToDefaultDevice+ + " (QUERY_EGL_ES_NATIVE_TK "+QUERY_EGL_ES_NATIVE_TK+", initDefaultDevice "+initDefaultDevice+", hasDesktopFactory "+(null != desktopFactory)+ + ", isEGLGraphicsDevice "+(adevice instanceof EGLGraphicsDevice)+")"); + } + + boolean hasPBuffer; + EGLGraphicsDevice eglDevice = null; + EGLFeatures eglFeatures = null; + NativeSurface surface = null; + ProxySurface upstreamSurface = null; // X11, GLX, .. + ProxySurface downstreamSurface = null; // EGL + boolean success = false; + try { + final GLCapabilities reqCapsAny = new GLCapabilities(glp); + reqCapsAny.setRedBits(5); reqCapsAny.setGreenBits(5); reqCapsAny.setBlueBits(5); reqCapsAny.setAlphaBits(0); + reqCapsAny.setDoubleBuffered(false); + + if( mapsADeviceToDefaultDevice ) { + // In this branch, any non EGL device is mapped to EGL default shared resources (default behavior). + // Only one default shared resource instance is ever be created. + if( initDefaultDevice ) { + defaultDevice.open(); + defaultDeviceEGLFeatures = new EGLFeatures(defaultDevice); + + // Probe for GLRendererQuirks.SingletonEGLDisplayOnly + final long secondEGLDisplay = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY); + if ( EGL.EGL_NO_DISPLAY == secondEGLDisplay ) { + final int quirk = GLRendererQuirks.SingletonEGLDisplayOnly; + GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk); + EGLDisplayUtil.setSingletonEGLDisplayOnly(true); + if ( DEBUG_SHAREDCTX ) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Second eglGetDisplay(EGL_DEFAULT_DISPLAY) failed"); } - rendererQuirks[0] = defaultSharedResource.rendererQuirksES1; - ctp[0] = defaultSharedResource.ctpES1; - break; + } } - if( null != rendererQuirks[0] ) { - GLRendererQuirks.addStickyDeviceQuirks(adevice, rendererQuirks[0]); + eglDevice = defaultDevice; // reuse + eglFeatures = defaultDeviceEGLFeatures; + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig.0: "+eglFeatures); } - EGLContext.mapStaticGLVersion(adevice, esProfile[0], 0, ctp[0]); - return true; - } - // attempt to created the default shared resources .. - - if( hasPBuffer[0] ) { - // 2nd case create defaultDevice shared resource using pbuffer surface - downstreamSurface = createDummySurfaceImpl(defaultDevice, false, reqCapsPBuffer, reqCapsPBuffer, null, 64, 64); // egl pbuffer offscreen - if( null != downstreamSurface ) { - downstreamSurface.createNotify(); - surface = downstreamSurface; + if( !glp.isGLES() && !eglFeatures.hasGLAPI ) { + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() OpenGL API not supported (1)"); + } + } else { + final GLCapabilitiesImmutable reqCapsPBuffer = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(reqCapsAny); + final List<GLCapabilitiesImmutable> availablePBufferCapsL = getAvailableEGLConfigs(eglDevice, reqCapsPBuffer); + hasPBuffer = availablePBufferCapsL.size() > 0; + + // attempt to created the default shared resources .. + if( hasPBuffer ) { + // 2nd case create defaultDevice shared resource using pbuffer surface + downstreamSurface = createDummySurfaceImpl(eglDevice, false, reqCapsPBuffer, reqCapsPBuffer, null, 64, 64); // egl pbuffer offscreen + if( null != downstreamSurface ) { + downstreamSurface.createNotify(); + surface = downstreamSurface; + } + } else { + // 3rd case fake creation of defaultDevice shared resource, no pbuffer available + final List<GLCapabilitiesImmutable> capsAnyL = getAvailableEGLConfigs(eglDevice, reqCapsAny); + if(capsAnyL.size() > 0) { + final GLCapabilitiesImmutable chosenCaps = capsAnyL.get(0); + EGLContext.mapStaticGLESVersion(eglDevice, chosenCaps); + success = true; + } + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() no pbuffer config available, detected !pbuffer config: "+success); + EGLGraphicsConfigurationFactory.printCaps("!PBufferCaps", capsAnyL, System.err); + } + } } } else { - // 3rd case fake creation of defaultDevice shared resource, no pbuffer available - final List<GLCapabilitiesImmutable> capsAnyL = getAvailableEGLConfigs(defaultDevice, reqCapsAny); - if(capsAnyL.size() > 0) { - final GLCapabilitiesImmutable chosenCaps = capsAnyL.get(0); - EGLContext.mapStaticGLESVersion(defaultDevice, chosenCaps); - success = true; - } - if(DEBUG) { - System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() no pbuffer config available, detected !pbuffer config: "+success); - EGLGraphicsConfigurationFactory.printCaps("!PBufferCaps", capsAnyL, System.err); - } - } - eglDevice = defaultDevice; // reuse - } else { - // 4th case always creates a true mapping of given device to EGL - upstreamSurface = desktopFactory.createDummySurface(adevice, reqCapsAny, null, 64, 64); // X11, WGL, .. dummy window - if(null != upstreamSurface) { - upstreamSurface.createNotify(); - eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(upstreamSurface); - eglDevice.open(); - if( DEBUG ) { - dumpEGLInfo("EGLDrawableFactory.mapAvailableEGLESConfig: ", eglDevice.getHandle()); + // 4th case always creates a true mapping of given device to EGL + upstreamSurface = desktopFactory.createDummySurface(adevice, reqCapsAny, null, 64, 64); // X11, WGL, .. dummy window + if(null != upstreamSurface) { + upstreamSurface.createNotify(); + eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(upstreamSurface); + eglDevice.open(); + eglFeatures = new EGLFeatures(eglDevice); + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig.1: "+eglFeatures); + } + if( !glp.isGLES() && !eglFeatures.hasGLAPI ) { + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() OpenGL API not supported (2)"); + } + // disposed at finalized: eglDevice, upstreamSurface + } else { + hasPBuffer = true; + surface = upstreamSurface; + } } - hasPBuffer[0] = true; - surface = upstreamSurface; } - } - if(null != surface) { - final EGLDrawable drawable = (EGLDrawable) createOnscreenDrawableImpl ( surface ); // works w/ implicit pbuffer surface via proxy-hook - drawable.setRealized(true); - final EGLContext context = (EGLContext) drawable.createContext(null); - if (null != context) { + if(null != surface) { + EGLDrawable drawable = null; + GLDrawable zeroDrawable = null; + EGLContext context = null; try { - context.makeCurrent(); // could cause exception - if(context.isCurrent()) { - final String glVersion = context.getGL().glGetString(GL.GL_VERSION); - if(null != glVersion) { - context.mapCurrentAvailableGLVersion(eglDevice); + drawable = (EGLDrawable) createOnscreenDrawableImpl ( surface ); + drawable.setRealized(true); + + context = (EGLContext) drawable.createContext(null); + if (null == context) { + throw new GLException("Couldn't create shared context for drawable: "+drawable); + } + + if( GLContext.CONTEXT_NOT_CURRENT != context.makeCurrent() ) { // could cause exception + // context.isCurrent() ! + final String glVersionString = context.getGL().glGetString(GL.GL_VERSION); + if(null != glVersionString) { + context.mapCurrentAvailableGLESVersion(eglDevice); if(eglDevice != adevice) { - context.mapCurrentAvailableGLVersion(adevice); + context.mapCurrentAvailableGLESVersion(adevice); + } + + if( eglFeatures.hasKHRSurfaceless && + ( context.isGLES() || context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 ) + ) + { + if( probeSurfacelessCtx(context, false /* restoreDrawable */) ) { + zeroDrawable = context.getGLDrawable(); + } + } else { + setNoSurfacelessCtxQuirk(context); } rendererQuirks[0] = context.getRendererQuirks(); - ctp[0] = context.getContextOptions(); - esProfile[0] = context.getGLVersionNumber().getMajor(); + ctxProfile[0] = context.getContextOptions(); + majorVersion[0] = context.getGLVersionNumber().getMajor(); + minorVersion[0] = context.getGLVersionNumber().getMinor(); success = true; } else { // Oops .. something is wrong - if(DEBUG) { + if ( DEBUG_SHAREDCTX ) { System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+eglDevice+", "+context.getGLVersion()+" - VERSION is null, dropping availability!"); } } } } catch (final Throwable t) { - if (DEBUG) { + if ( DEBUG_SHAREDCTX ) { System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: INFO: context create/makeCurrent failed"); t.printStackTrace(); } } finally { - context.destroy(); + if( null != context ) { + try { + context.destroy(); + } catch (final GLException gle) { + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: INFO: destroy caught exception:"); + gle.printStackTrace(); + } + } + } + if( null != zeroDrawable ) { + zeroDrawable.setRealized(false); + } + if( null != drawable ) { + drawable.setRealized(false); + } } } - drawable.setRealized(false); - } - } catch (final Throwable t) { - if(DEBUG) { - System.err.println("Caught exception on thread "+getThreadName()); - t.printStackTrace(); - } - success = false; - } finally { - if(null != downstreamSurface) { - downstreamSurface.destroyNotify(); - } - if( defaultDevice != eglDevice ) { // don't close default device - if(null != eglDevice) { - eglDevice.close(); + } catch (final Throwable t) { + if ( DEBUG_SHAREDCTX ) { + System.err.println("Caught exception on thread "+getThreadName()); + t.printStackTrace(); + } + success = false; + } finally { + if(null != downstreamSurface) { + downstreamSurface.destroyNotify(); + } + if( defaultDevice != eglDevice ) { // don't close default device + if(null != eglDevice) { + eglDevice.close(); + } } if(null != upstreamSurface) { upstreamSurface.destroyNotify(); } } + return success; } - return success; - } - private final boolean needsToCreateSharedResource(final String key, final SharedResource[] existing) { - synchronized(sharedMap) { - final SharedResource sr = sharedMap.get(key); - if( null == sr ) { - final boolean createAttempted = sharedMapCreateAttempt.contains(key); - if(!createAttempted) { - sharedMapCreateAttempt.add(key); - } - return !createAttempted; - } else { - if(null != existing) { - existing[0] = sr; - } - return false; + @Override + public void releaseSharedResource(final SharedResourceRunner.Resource shared) { + final SharedResource sr = (SharedResource) shared; + if ( DEBUG_SHAREDCTX ) { + System.err.println("Shutdown Shared:"); + System.err.println("Device : " + sr.device); + ExceptionUtils.dumpStack(System.err); } - } - } - - @Override - protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice adevice) { - if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper - return null; - } - if( needsToCreateSharedResource(defaultDevice.getUniqueID(), null) ) { - if (DEBUG) { - System.err.println("EGLDrawableFactory.createShared: (defaultDevice): req. device: "+adevice+", defaultDevice "+defaultDevice); - Thread.dumpStack(); - } - if(null != defaultSharedResource) { - dumpMap(); - throw new InternalError("defaultSharedResource already exist: "+defaultSharedResource); + if (null != sr.device) { + // Issues eglTerminate(), which may cause SIGSEGV w/ NVIDIA 343.36 w/ TestGLProfile01NEWT + // May cause JVM SIGSEGV: + sr.device.close(); + sr.device = null; } - defaultSharedResource = createEGLSharedResourceImpl(defaultDevice); } + } - final String key = adevice.getUniqueID(); - if( defaultDevice.getUniqueID().equals(key) ) { - return defaultSharedResource; - } else { - if( null == defaultSharedResource) { // defaultDevice must be initialized before host-device - dumpMap(); - throw new InternalError("defaultSharedResource does not exist"); - } - final SharedResource[] existing = new SharedResource[] { null }; - if ( !needsToCreateSharedResource(key, existing) ) { - return existing[0]; - } - return createEGLSharedResourceImpl(adevice); - } + public final boolean hasDefaultDeviceKHRCreateContext() { + return defaultDeviceEGLFeatures.hasKHRCreateContext; + } + public final boolean hasOpenGLAPISupport() { + return defaultDeviceEGLFeatures.hasGLAPI; } - private SharedResource createEGLSharedResourceImpl(final AbstractGraphicsDevice adevice) { - final boolean madeCurrentES1; - final boolean[] hasPBufferES1 = new boolean[] { false }; - final boolean[] hasPBufferES3ES2 = new boolean[] { false }; - // EGLContext[] eglCtxES1 = new EGLContext[] { null }; - // EGLContext[] eglCtxES2 = new EGLContext[] { null }; - final GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null }; - final GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; - final int[] ctpES1 = new int[] { -1 }; - final int[] ctpES3ES2 = new int[] { -1 }; + @Override + public final AbstractGraphicsDevice getDefaultDevice() { + return defaultDevice; + } + @Override + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { + // via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types. + return null != sharedMap ; // null!=eglES2DynamicLookupHelper || null!=eglES1DynamicLookupHelper; + } - if (DEBUG) { - System.err.println("EGLDrawableFactory.createShared(): device "+adevice); + private static List<GLCapabilitiesImmutable> getAvailableEGLConfigs(final EGLGraphicsDevice eglDisplay, final GLCapabilitiesImmutable caps) { + final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); + if(!EGL.eglGetConfigs(eglDisplay.getHandle(), null, 0, numConfigs)) { + throw new GLException("EGLDrawableFactory.getAvailableEGLConfigs: Get maxConfigs (eglGetConfigs) call failed, error "+EGLContext.toHexString(EGL.eglGetError())); } - - if( null != eglES1DynamicLookupHelper ) { - final int[] esProfile = { 1 }; - madeCurrentES1 = mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES1, rendererQuirksES1, ctpES1) && 1 == esProfile[0]; - } else { - madeCurrentES1 = false; - } - boolean madeCurrentES2 = false; - boolean madeCurrentES3 = false; - if( null != eglES2DynamicLookupHelper ) { - // ES3 Query - final int[] esProfile = { 3 }; - madeCurrentES3 = mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2) && 3 == esProfile[0]; - if( !madeCurrentES3 ) { - // ES2 Query, may result in ES3 - esProfile[0] = 2; - if( mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2) ) { - switch( esProfile[0] ) { - case 2: madeCurrentES2 = true; break; - case 3: madeCurrentES3 = true; break; - default: throw new InternalError("XXXX Got "+esProfile[0]); - } - } + if(0 < numConfigs.get(0)) { + final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); + final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(caps); + final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(caps); + if( EGL.eglChooseConfig(eglDisplay.getHandle(), attrs, configs, configs.capacity(), numConfigs) && numConfigs.get(0) > 0) { + return EGLGraphicsConfigurationFactory.eglConfigs2GLCaps(eglDisplay, caps.getGLProfile(), configs, numConfigs.get(0), winattrmask, false /* forceTransparentFlag */, false /* onlyFirstValid */); } } - if( !EGLContext.getAvailableGLVersionsSet(adevice) ) { - // Even though we override the non EGL native mapping intentionally, - // avoid exception due to double 'set' - carefull exception of the rule. - EGLContext.setAvailableGLVersionsSet(adevice); - } - if( hasX11 ) { - handleDontCloseX11DisplayQuirk(rendererQuirksES1[0]); - handleDontCloseX11DisplayQuirk(rendererQuirksES3ES2[0]); - } - final SharedResource sr = new SharedResource(defaultDevice, madeCurrentES1, hasPBufferES1[0], rendererQuirksES1[0], ctpES1[0], - madeCurrentES2, madeCurrentES3, hasPBufferES3ES2[0], rendererQuirksES3ES2[0], ctpES3ES2[0]); + return new ArrayList<GLCapabilitiesImmutable>(0); + } - synchronized(sharedMap) { - sharedMap.put(adevice.getUniqueID(), sr); - } - if (DEBUG) { - System.err.println("EGLDrawableFactory.createShared: devices: queried nativeTK "+QUERY_EGL_ES_NATIVE_TK+", adevice " + adevice + ", defaultDevice " + defaultDevice); - System.err.println("EGLDrawableFactory.createShared: context ES1: " + madeCurrentES1 + ", hasPBuffer "+hasPBufferES1[0]+", quirks "+rendererQuirksES1[0]); - System.err.println("EGLDrawableFactory.createShared: context ES2: " + madeCurrentES2 + ", hasPBuffer "+hasPBufferES3ES2[0]+", quirks "+rendererQuirksES3ES2[0]); - System.err.println("EGLDrawableFactory.createShared: context ES3: " + madeCurrentES3 + ", hasPBuffer "+hasPBufferES3ES2[0]+", quirks "+rendererQuirksES3ES2[0]); - dumpMap(); - } - return sr; + static void dumpEGLInfo(final String prefix, final long eglDisplay) { + final String eglVendor = EGL.eglQueryString(eglDisplay, EGL.EGL_VENDOR); + final String eglClientAPIs = EGL.eglQueryString(eglDisplay, EGL.EGL_CLIENT_APIS); + final String eglClientVersion = EGL.eglQueryString(EGL.EGL_NO_DISPLAY, EGL.EGL_VERSION); + final String eglServerVersion = EGL.eglQueryString(eglDisplay, EGL.EGL_VERSION); + System.err.println(prefix+"EGL vendor "+eglVendor+", version [client "+eglClientVersion+", server "+eglServerVersion+"], clientAPIs "+eglClientAPIs); } - private void handleDontCloseX11DisplayQuirk(final GLRendererQuirks quirks) { - if( null != quirks && quirks.exist( GLRendererQuirks.DontCloseX11Display ) ) { - jogamp.nativewindow.x11.X11Util.markAllDisplaysUnclosable(); - } + @Override + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice adevice) { + return (SharedResource) sharedResourceRunner.getOrCreateShared(adevice); } @Override protected final Thread getSharedResourceThread() { - return null; + return sharedResourceRunner.start(); } public final boolean isANGLE() { @@ -700,14 +881,19 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(final int esProfile) { - if ( 2==esProfile || 3==esProfile ) { - return eglES2DynamicLookupHelper; - } else if (1==esProfile) { - return eglES1DynamicLookupHelper; + public GLDynamicLookupHelper getGLDynamicLookupHelper(final String esProfile) { + final GLDynamicLookupHelper res; + if ( GLProfile.GLES2 == esProfile || GLProfile.GLES3 == esProfile ) { + res = eglES2DynamicLookupHelper; + } else if ( GLProfile.GLES1 == esProfile ) { + res = eglES1DynamicLookupHelper; } else { - throw new GLException("Unsupported: ES"+esProfile); + res = eglGLnDynamicLookupHelper; + } + if( null == res ) { + throw new GLException("No lookup for esProfile "+esProfile); } + return res; } @Override @@ -723,7 +909,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if (target == null) { throw new IllegalArgumentException("Null target"); } - return new EGLOnscreenDrawable(this, EGLWrappedSurface.get(target)); + return new EGLDrawable(this, EGLSurface.get(target)); } @Override @@ -737,7 +923,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { throw new GLException("Non pbuffer not yet implemented"); } // PBuffer GLDrawable Creation - return new EGLPbufferDrawable(this, EGLWrappedSurface.get(target)); + return new EGLDrawable(this, EGLSurface.get(target)); } @Override @@ -747,28 +933,35 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return true; } - @Override - protected ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, - final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, - final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { - final boolean ownDevice; + private final EGLGraphicsConfiguration evalConfig(final boolean[] ownDevice, final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser) { final EGLGraphicsDevice device; if( createNewDevice || ! (deviceReq instanceof EGLGraphicsDevice) ) { final long nativeDisplayID = ( deviceReq instanceof EGLGraphicsDevice) ? ( (EGLGraphicsDevice) deviceReq ).getNativeDisplayID() : deviceReq.getHandle() ; device = EGLDisplayUtil.eglCreateEGLGraphicsDevice(nativeDisplayID, deviceReq.getConnection(), deviceReq.getUnitID()); device.open(); - ownDevice = true; + ownDevice[0] = true; } else { device = (EGLGraphicsDevice) deviceReq; - ownDevice = false; + ownDevice[0] = false; } final DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, 0); final EGLGraphicsConfiguration config = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED, false); if(null == config) { throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); } - return new WrappedSurface(config, 0, upstreamHook, ownDevice); + return config; + } + + @Override + protected final ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { + final boolean[] ownDevice = { false }; + final EGLGraphicsConfiguration config = evalConfig(ownDevice, deviceReq, createNewDevice, capsChosen, capsRequested, chooser); + return EGLSurface.createWrapped(config, 0, upstreamHook, ownDevice[0]); } @Override @@ -778,6 +971,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new EGLDummyUpstreamSurfaceHook(width, height)); } + @Override + public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { + chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); + final boolean[] ownDevice = { false }; + final EGLGraphicsConfiguration config = evalConfig(ownDevice, deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser); + return EGLSurface.createSurfaceless(config, new GenericUpstreamSurfacelessHook(width, height), ownDevice[0]); + } + /** * @param ms {@link MutableSurface} which dimensions and config are being used to create the pbuffer surface. * It will also hold the resulting pbuffer surface handle. @@ -813,13 +1015,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { + protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, + final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, + final UpstreamSurfaceHook upstream) { final EGLGraphicsDevice eglDeviceReq = (EGLGraphicsDevice) deviceReq; final EGLGraphicsDevice device = EGLDisplayUtil.eglCreateEGLGraphicsDevice(eglDeviceReq.getNativeDisplayID(), deviceReq.getConnection(), deviceReq.getUnitID()); device.open(); final DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx); final EGLGraphicsConfiguration cfg = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED, false); - return new WrappedSurface(cfg, windowHandle, upstream, true); + return EGLSurface.createWrapped(cfg, windowHandle, upstream, true); } @Override diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java index f00d7059d..6c11b3bdc 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java @@ -1,11 +1,12 @@ package jogamp.opengl.egl; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; /** Uses a PBuffer offscreen surface */ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java index 05dae0b9d..1b433cc30 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java @@ -28,13 +28,15 @@ package jogamp.opengl.egl; -import com.jogamp.common.os.AndroidVersion; -import com.jogamp.common.os.Platform; - -import java.util.*; +import java.util.ArrayList; +import java.util.List; import jogamp.common.os.PlatformPropsImpl; -import jogamp.opengl.*; +import jogamp.opengl.GLDynamicLibraryBundleInfo; + +import com.jogamp.common.os.AndroidVersion; +import com.jogamp.common.os.Platform; +import com.jogamp.opengl.egl.EGL; /** * Abstract implementation of the DynamicLookupHelper for EGL, @@ -43,7 +45,7 @@ import jogamp.opengl.*; * Currently two implementations exist, one for ES1 and one for ES3 and ES2. */ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundleInfo { - static final List<String> glueLibNames; + private static final List<String> glueLibNames; static { glueLibNames = new ArrayList<String>(); glueLibNames.add("jogl_mobile"); @@ -79,7 +81,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle @Override public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { - return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName); + return EGLContext.eglGetProcAddress(toolGetProcAddressHandle, funcName); } @Override diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java index 361ec26ff..3c7ee410a 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java @@ -28,7 +28,8 @@ package jogamp.opengl.egl; -import java.util.*; +import java.util.ArrayList; +import java.util.List; public final class EGLES1DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo { protected EGLES1DynamicLibraryBundleInfo() { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java index 74738463f..d37efc455 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java @@ -28,7 +28,8 @@ package jogamp.opengl.egl; -import java.util.*; +import java.util.ArrayList; +import java.util.List; /** * <p> diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java index babea4240..14a5aac33 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java @@ -35,11 +35,11 @@ package jogamp.opengl.egl; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import jogamp.opengl.*; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; public class EGLExternalContext extends EGLContext { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java index a8dd7d5c8..546d8e69a 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java @@ -28,12 +28,14 @@ package jogamp.opengl.egl; -import javax.media.nativewindow.NativeWindowException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; +import com.jogamp.opengl.egl.EGLExt; public class EGLGLCapabilities extends GLCapabilities { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLnDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLnDynamicLibraryBundleInfo.java new file mode 100644 index 000000000..6a3a20100 --- /dev/null +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLnDynamicLibraryBundleInfo.java @@ -0,0 +1,83 @@ +/** + * Copyright 2014 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package jogamp.opengl.egl; + +import java.util.ArrayList; +import java.util.List; + +import com.jogamp.common.os.Platform; + +/** + * <p> + * Covering Desktop GL + * </p> + */ +public final class EGLGLnDynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo { + private static final List<String> glueLibNames; + static { + glueLibNames = new ArrayList<String>(); + glueLibNames.add("jogl_desktop"); + } + + protected EGLGLnDynamicLibraryBundleInfo() { + super(); + } + + @Override + public final List<List<String>> getToolLibNames() { + final List<List<String>> libsList = new ArrayList<List<String>>(); + { + final List<String> libsGL = new ArrayList<String>(); + + final Platform.OSType osType = Platform.getOSType(); + if( Platform.OSType.MACOS == osType ) { + libsGL.add("/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"); + libsGL.add("GL"); + } else if( Platform.OSType.WINDOWS == Platform.getOSType() ) { + libsGL.add("OpenGL32"); + } else { + // this is the default lib name, according to the spec + libsGL.add("libGL.so.1"); + + // try this one as well, if spec fails + libsGL.add("libGL.so"); + + // last but not least .. the generic one + libsGL.add("GL"); + } + + libsList.add(libsGL); + } + libsList.add(getEGLLibNamesList()); + + return libsList; + } + +} + diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java index 1d90e63af..7e54152bf 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java @@ -38,17 +38,17 @@ package jogamp.opengl.egl; import java.nio.IntBuffer; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.opengl.DefaultGLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.GLGraphicsConfigurationUtil; @@ -57,6 +57,8 @@ import com.jogamp.common.nio.PointerBuffer; import com.jogamp.nativewindow.MutableGraphicsConfiguration; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; +import com.jogamp.opengl.egl.EGL; +import com.jogamp.opengl.egl.EGLExt; public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java index d4e5e7d62..d10263f22 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java @@ -33,36 +33,37 @@ package jogamp.opengl.egl; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.VisualIDHolder.VIDType; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLDrawableFactory; +import java.io.PrintStream; +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; -import com.jogamp.common.nio.Buffers; -import com.jogamp.common.nio.PointerBuffer; -import com.jogamp.nativewindow.egl.EGLGraphicsDevice; -import com.jogamp.opengl.GLRendererQuirks; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.VisualIDHolder.VIDType; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.GLGraphicsConfigurationFactory; import jogamp.opengl.GLGraphicsConfigurationUtil; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.io.PrintStream; -import java.nio.IntBuffer; +import com.jogamp.common.nio.Buffers; +import com.jogamp.common.nio.PointerBuffer; +import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.GLRendererQuirks; +import com.jogamp.opengl.egl.EGL; /** Subclass of GraphicsConfigurationFactory used when non-AWT tookits @@ -89,7 +90,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact fallbackGraphicsConfigurationFactory = GraphicsConfigurationFactory.getFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class); } } /* else if(NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false)) { - nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, eglFactory); + nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.windows.WindowsGraphicsDevice.class, eglFactory); } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { } */ @@ -102,7 +103,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(NativeWindowFactory.TYPE_X11 == nwType) { GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, GLCapabilitiesImmutable.class, nativeGraphicsConfigurationFactory); } /* else if(NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false)) { - GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, nativeGraphicsConfigurationFactory); + GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.windows.WindowsGraphicsDevice.class, nativeGraphicsConfigurationFactory); } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { } */ nativeGraphicsConfigurationFactory = null; diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java deleted file mode 100644 index 4c018fe25..000000000 --- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * Copyright (c) 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.egl; - -import javax.media.opengl.*; -import javax.media.nativewindow.*; - -public class EGLOnscreenDrawable extends EGLDrawable { - protected EGLOnscreenDrawable(final EGLDrawableFactory factory, final NativeSurface component) throws GLException { - super(factory, component); - } - - @Override - public GLContext createContext(final GLContext shareWith) { - return new EGLContext(this, shareWith); - } - - @Override - protected long createSurface(final EGLGraphicsConfiguration config, final int width, final int height, final long nativeSurfaceHandle) { - return EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(), config.getNativeConfig(), nativeSurfaceHandle, null); - } -} - diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java deleted file mode 100644 index 8842edbc0..000000000 --- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * Copyright (c) 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.egl; - -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLContext; - -public class EGLPbufferDrawable extends EGLDrawable { - protected static final boolean useTexture = false; // No yet .. - - protected EGLPbufferDrawable(final EGLDrawableFactory factory, final NativeSurface target) { - super(factory, target); - } - - @Override - protected long createSurface(final EGLGraphicsConfiguration config, final int width, final int height, final long nativeSurfaceHandle) { - return EGLDrawableFactory.createPBufferSurfaceImpl(config, width, height, false); - } - - @Override - public GLContext createContext(final GLContext shareWith) { - return new EGLContext(this, shareWith); - } -} - diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java new file mode 100644 index 000000000..e4e692fb2 --- /dev/null +++ b/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java @@ -0,0 +1,165 @@ +/** + * Copyright 2014 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package jogamp.opengl.egl; + +import java.nio.IntBuffer; + +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLException; + +import com.jogamp.common.nio.Buffers; +import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; +import com.jogamp.opengl.egl.EGL; + +import jogamp.nativewindow.ProxySurfaceImpl; +import jogamp.nativewindow.WrappedSurface; +import jogamp.opengl.GLDrawableImpl; + +/** + * <pre> + * EGLSurface [ is_a -> WrappedSurface -> ProxySurfaceImpl -> ProxySurface -> MutableSurface -> NativeSurface] has_a + * EGLUpstreamSurfaceHook [ is_a -> UpstreamSurfaceHook.MutableSize -> UpstreamSurfaceHook ] has_a + * NativeSurface (e.g. native [X11, WGL, ..] surface, or WrappedSurface, ..) + * </pre> + */ +public class EGLSurface extends WrappedSurface { + static boolean DEBUG = EGLDrawable.DEBUG || ProxySurface.DEBUG; + + public static EGLSurface get(final NativeSurface surface) { + if(surface instanceof EGLSurface) { + return (EGLSurface)surface; + } + return new EGLSurface(surface); + } + private EGLSurface(final NativeSurface surface) { + super(surface.getGraphicsConfiguration(), EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(surface), false /* tbd in UpstreamSurfaceHook */); + if(EGLDrawableFactory.DEBUG) { + System.err.println("EGLSurface.ctor().1: "+this); + ProxySurfaceImpl.dumpHierarchy(System.err, this); + } + } + + public static EGLSurface createWrapped(final EGLGraphicsConfiguration cfg, final long handle, + final UpstreamSurfaceHook upstream, final boolean ownsDevice) { + return new EGLSurface(cfg, handle, upstream, ownsDevice); + } + private EGLSurface(final EGLGraphicsConfiguration cfg, final long handle, + final UpstreamSurfaceHook upstream, final boolean ownsDevice) { + super(cfg, EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(cfg, handle, upstream, ownsDevice), false /* tbd in UpstreamSurfaceHook */); + if(EGLDrawableFactory.DEBUG) { + System.err.println("EGLSurface.ctor().2: "+this); + ProxySurfaceImpl.dumpHierarchy(System.err, this); + } + } + + public static EGLSurface createSurfaceless(final EGLGraphicsConfiguration cfg, final GenericUpstreamSurfacelessHook upstream, final boolean ownsDevice) { + return new EGLSurface(cfg, upstream, ownsDevice); + } + private EGLSurface(final EGLGraphicsConfiguration cfg, final GenericUpstreamSurfacelessHook upstream, final boolean ownsDevice) { + super(cfg, EGL.EGL_NO_SURFACE, upstream, ownsDevice); + if(EGLDrawableFactory.DEBUG) { + System.err.println("EGLSurface.ctor().3: "+this); + ProxySurfaceImpl.dumpHierarchy(System.err, this); + } + } + + public void setEGLSurfaceHandle() throws GLException { + setSurfaceHandle( createEGLSurfaceHandle() ); + } + private long createEGLSurfaceHandle() throws GLException { + final EGLGraphicsConfiguration config = (EGLGraphicsConfiguration) getGraphicsConfiguration(); + final NativeSurface nativeSurface = getUpstreamSurface(); + final boolean isPBuffer = ((GLCapabilitiesImmutable) config.getChosenCapabilities()).isPBuffer(); + + long eglSurface = createEGLSurfaceHandle(isPBuffer, true /* useSurfaceHandle */, config, nativeSurface); + if ( EGL.EGL_NO_SURFACE == eglSurface ) { + final int eglError0 = EGL.eglGetError(); + if( EGL.EGL_BAD_NATIVE_WINDOW == eglError0 && !isPBuffer ) { + // Try window handle if available and differs (Windows HDC / HWND). + // ANGLE impl. required HWND on Windows. + if( hasUniqueNativeWindowHandle(nativeSurface) ) { + if(DEBUG) { + System.err.println(getThreadName() + ": Info: Creation of window surface w/ surface handle failed: "+config+", error "+GLDrawableImpl.toHexString(eglError0)+", retry w/ windowHandle"); + } + eglSurface = createEGLSurfaceHandle(isPBuffer, false /* useSurfaceHandle */, config, nativeSurface); + if (EGL.EGL_NO_SURFACE == eglSurface) { + throw new GLException("Creation of window surface w/ window handle failed: "+config+", "+this+", error "+GLDrawableImpl.toHexString(EGL.eglGetError())); + } + } else { + throw new GLException("Creation of window surface w/ surface handle failed (2): "+config+", "+this+", error "+GLDrawableImpl.toHexString(eglError0)); + } + } else { + throw new GLException("Creation of window surface w/ surface handle failed (1): "+config+", "+this+", error "+GLDrawableImpl.toHexString(eglError0)); + } + } + if(DEBUG) { + System.err.println(getThreadName() + ": createEGLSurface handle "+GLDrawableImpl.toHexString(eglSurface)); + } + return eglSurface; + } + private long createEGLSurfaceHandle(final boolean isPBuffer, final boolean useSurfaceHandle, + final EGLGraphicsConfiguration config, final NativeSurface nativeSurface) { + if( isPBuffer ) { + return EGLDrawableFactory.createPBufferSurfaceImpl(config, getSurfaceWidth(), getSurfaceHeight(), false); + } else { + if( useSurfaceHandle ) { + return EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(), + config.getNativeConfig(), + nativeSurface.getSurfaceHandle(), null); + } else { + return EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(), + config.getNativeConfig(), + ((NativeWindow)nativeSurface).getWindowHandle(), null); + } + } + } + private static boolean hasUniqueNativeWindowHandle(final NativeSurface nativeSurface) { + return nativeSurface instanceof NativeWindow && + ((NativeWindow)nativeSurface).getWindowHandle() != nativeSurface.getSurfaceHandle(); + } + static String getThreadName() { return Thread.currentThread().getName(); } + + public static boolean isValidEGLSurfaceHandle(final long eglDisplayHandle, final long eglSurfaceHandle) { + if( 0 == eglSurfaceHandle ) { + return false; + } + final IntBuffer val = Buffers.newDirectIntBuffer(1); + final boolean eglSurfaceValid = EGL.eglQuerySurface(eglDisplayHandle, eglSurfaceHandle, EGL.EGL_CONFIG_ID, val); + if( !eglSurfaceValid ) { + final int eglErr = EGL.eglGetError(); + if(DEBUG) { + System.err.println(getThreadName() + ": EGLSurface.isValidEGLSurfaceHandle eglQuerySuface failed: error "+GLDrawableImpl.toHexString(eglErr)+", "+GLDrawableImpl.toHexString(eglSurfaceHandle)); + } + } + return eglSurfaceValid; + } +} diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java index cc15f0cd6..05a6fc153 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java @@ -1,27 +1,57 @@ +/** + * Copyright 2014 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ package jogamp.opengl.egl; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; -import javax.media.nativewindow.VisualIDHolder.VIDType; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.VisualIDHolder.VIDType; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLException; + +import jogamp.nativewindow.WrappedSurface; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; /** * <pre> - * EGLWrappedSurface [ is_a -> WrappedSurface -> ProxySurfaceImpl -> ProxySurface -> MutableSurface -> NativeSurface] has_a + * EGLSurface [ is_a -> WrappedSurface -> ProxySurfaceImpl -> ProxySurface -> MutableSurface -> NativeSurface] has_a * EGLUpstreamSurfaceHook [ is_a -> UpstreamSurfaceHook.MutableSize -> UpstreamSurfaceHook ] has_a - * NativeSurface (e.g. native X11 surface) + * NativeSurface (e.g. native [X11, WGL, ..] surface, or WrappedSurface, ..) * </pre> */ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { - protected static final boolean DEBUG = EGLDrawableFactory.DEBUG; + private static final boolean DEBUG = EGLDrawableFactory.DEBUG; private final NativeSurface upstreamSurface; private final UpstreamSurfaceHook.MutableSize upstreamSurfaceHookMutableSize; @@ -40,6 +70,11 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } } + public EGLUpstreamSurfaceHook(final EGLGraphicsConfiguration cfg, final long handle, + final UpstreamSurfaceHook upstream, final boolean ownsDevice) { + this( new WrappedSurface(cfg, handle, upstream, ownsDevice) ); + } + static String getThreadName() { return Thread.currentThread().getName(); } /** @@ -176,10 +211,10 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } surface.setGraphicsConfiguration(eglConfig); - if(isEGLSurfaceValid) { - isEGLSurfaceValid = EGLDrawable.isValidEGLSurface(eglDevice.getHandle(), upstreamSurface.getSurfaceHandle()); + if( isEGLSurfaceValid ) { + isEGLSurfaceValid = EGLSurface.isValidEGLSurfaceHandle(eglDevice.getHandle(), upstreamSurface.getSurfaceHandle()); } - if(isEGLSurfaceValid) { + if( isEGLSurfaceValid ) { surface.setSurfaceHandle(upstreamSurface.getSurfaceHandle()); surface.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); if(DEBUG) { @@ -196,8 +231,8 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { @Override public final void destroy(final ProxySurface surface) { - if(EGLDrawableFactory.DEBUG) { - System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this); + if(DEBUG) { + System.err.println(getThreadName() + ": EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this); } surface.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); if(upstreamSurface instanceof ProxySurface) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java deleted file mode 100644 index 89024eed3..000000000 --- a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java +++ /dev/null @@ -1,30 +0,0 @@ -package jogamp.opengl.egl; - -import javax.media.nativewindow.NativeSurface; - -import jogamp.nativewindow.WrappedSurface; - -/** - * <pre> - * EGLWrappedSurface [ is_a -> WrappedSurface -> ProxySurfaceImpl -> ProxySurface -> MutableSurface -> NativeSurface] has_a - * EGLUpstreamSurfaceHook [ is_a -> UpstreamSurfaceHook.MutableSize -> UpstreamSurfaceHook ] has_a - * NativeSurface (i.e. native X11 surface) - * </pre> - */ -public class EGLWrappedSurface extends WrappedSurface { - - public static EGLWrappedSurface get(final NativeSurface surface) { - if(surface instanceof EGLWrappedSurface) { - return (EGLWrappedSurface)surface; - } - return new EGLWrappedSurface(surface); - } - - public EGLWrappedSurface(final NativeSurface surface) { - super(surface.getGraphicsConfiguration(), EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(surface), false /* tbd in UpstreamSurfaceHook */); - if(EGLDrawableFactory.DEBUG) { - System.err.println("EGLWrappedSurface.ctor(): "+this); - } - } - -} diff --git a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java index f0922644b..3b4f15b52 100644 --- a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java +++ b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java @@ -117,7 +117,7 @@ package jogamp.opengl.gl2; import java.nio.DoubleBuffer; import java.nio.IntBuffer; -import javax.media.opengl.GL2; +import com.jogamp.opengl.GL2; import com.jogamp.common.nio.Buffers; diff --git a/src/jogl/classes/jogamp/opengl/gl2/fixme/GLObjectTracker.java b/src/jogl/classes/jogamp/opengl/gl2/fixme/GLObjectTracker.java index 903a82fac..a60ed0157 100644 --- a/src/jogl/classes/jogamp/opengl/gl2/fixme/GLObjectTracker.java +++ b/src/jogl/classes/jogamp/opengl/gl2/fixme/GLObjectTracker.java @@ -42,7 +42,7 @@ package jogamp.opengl.gl2; import jogamp.opengl.*; import java.nio.*; -import javax.media.opengl.*; +import com.jogamp.opengl.*; /** * Tracks the creation of server-side OpenGL objects which can be diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java index c91a045ae..afd6ba204 100644 --- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java @@ -115,9 +115,9 @@ package jogamp.opengl.glu; -import javax.media.opengl.GL; -import javax.media.opengl.glu.GLU; -import javax.media.opengl.glu.GLUquadric; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.glu.GLU; +import com.jogamp.opengl.glu.GLUquadric; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.util.ImmModeSink; diff --git a/src/jogl/classes/jogamp/opengl/glu/error/Error.java b/src/jogl/classes/jogamp/opengl/glu/error/Error.java index 235c59717..564ba3376 100644 --- a/src/jogl/classes/jogamp/opengl/glu/error/Error.java +++ b/src/jogl/classes/jogamp/opengl/glu/error/Error.java @@ -44,8 +44,8 @@ package jogamp.opengl.glu.error; -import javax.media.opengl.GL; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.glu.GLU; import jogamp.opengl.glu.Glue; /** diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java index 96da49a80..554da5e91 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java @@ -1,11 +1,11 @@ package jogamp.opengl.glu.gl2.nurbs; import jogamp.opengl.glu.nurbs.*; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.glu.GLU; -import javax.media.opengl.glu.gl2.GLUgl2; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.glu.GLU; +import com.jogamp.opengl.glu.gl2.GLUgl2; /** * Class rendering curves with OpenGL diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java index e5cb715ab..e4f5e4c39 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java @@ -1,11 +1,11 @@ package jogamp.opengl.glu.gl2.nurbs; import jogamp.opengl.glu.nurbs.*; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.glu.GLU; -import javax.media.opengl.glu.gl2.GLUgl2; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.glu.GLU; +import com.jogamp.opengl.glu.gl2.GLUgl2; /** * Class rendering surfaces with OpenGL diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java index a4507b767..d546066d4 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java @@ -37,8 +37,8 @@ import jogamp.opengl.glu.nurbs.*; import java.lang.reflect.Method; -import javax.media.opengl.GL2; -import javax.media.opengl.glu.GLUnurbs; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.glu.GLUnurbs; /** * Base object for working with NURBS curves and surfaces diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java index 337d93b80..3127879dc 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java @@ -44,12 +44,12 @@ package jogamp.opengl.glu.mipmap; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.glu.GLU; import jogamp.opengl.Debug; diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java index 95ce86a5b..1b58ef5d2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java @@ -44,7 +44,7 @@ package jogamp.opengl.glu.mipmap; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; import java.nio.*; /** diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java index ef77f3555..f09a6fdf3 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java @@ -44,10 +44,10 @@ package jogamp.opengl.glu.mipmap; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; import java.nio.*; diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java index 51d8ca6fe..adf6c7da4 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java @@ -44,14 +44,14 @@ package jogamp.opengl.glu.mipmap; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; -import javax.media.opengl.glu.GLU; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.glu.GLU; +import com.jogamp.opengl.GLException; import java.nio.*; @@ -257,7 +257,7 @@ public class Mipmap { public static void closestFit( final GL gl, final int target, final int width, final int height, final int internalFormat, final int format, final int type, final int[] newWidth, final int[] newHeight ) { // Use proxy textures if OpenGL GL2/GL3 version >= 1.1 - if( gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version110) >= 0 ) { + if( gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version1_1) >= 0 ) { int widthPowerOf2 = nearestPower( width ); int heightPowerOf2 = nearestPower( height ); final int[] proxyWidth = new int[1]; diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java index ccb75091c..1d62884d0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java @@ -44,9 +44,9 @@ package jogamp.opengl.glu.mipmap; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.glu.GLU; import java.nio.*; import com.jogamp.common.nio.Buffers; diff --git a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java index 5cae679a2..1988d8ee9 100644 --- a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java +++ b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java @@ -44,7 +44,7 @@ package jogamp.opengl.glu.registry; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.glu.GLU; /** * diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java index f2a9c78fa..9686b0d04 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java @@ -53,8 +53,8 @@ package jogamp.opengl.glu.tessellator; import jogamp.opengl.glu.tessellator.*; -import javax.media.opengl.*; -import javax.media.opengl.glu.*; +import com.jogamp.opengl.*; +import com.jogamp.opengl.glu.*; public class GLUtessellatorImpl implements GLUtessellator { public static final int TESS_MAX_CACHE = 100; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java index 44668a943..e61f9dee1 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java @@ -52,8 +52,8 @@ */ package jogamp.opengl.glu.tessellator; -import javax.media.opengl.*; -import javax.media.opengl.glu.*; +import com.jogamp.opengl.*; +import com.jogamp.opengl.glu.*; class Normal { private Normal() { diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java index 6325de8d2..a250a85ae 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java @@ -52,8 +52,8 @@ */ package jogamp.opengl.glu.tessellator; -import javax.media.opengl.*; -import javax.media.opengl.glu.*; +import com.jogamp.opengl.*; +import com.jogamp.opengl.glu.*; class Render { private static final boolean USE_OPTIMIZED_CODE_PATH = false; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java index b6c60058f..e0e183bc1 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java @@ -52,8 +52,8 @@ */ package jogamp.opengl.glu.tessellator; -import javax.media.opengl.*; -import javax.media.opengl.glu.*; +import com.jogamp.opengl.*; +import com.jogamp.opengl.glu.*; class Sweep { private Sweep() { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index cb691a7ab..51b243f37 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -44,22 +44,22 @@ import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Map; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.OffscreenLayerSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL3ES3; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.OffscreenLayerSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL3ES3; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import jogamp.nativewindow.macosx.OSXUtil; import jogamp.opengl.GLContextImpl; @@ -310,7 +310,7 @@ public class MacOSXCGLContext extends GLContextImpl if (getOpenGLMode() != ((MacOSXCGLDrawable)drawable).getOpenGLMode()) { setOpenGLMode(((MacOSXCGLDrawable)drawable).getOpenGLMode()); } */ - if (!impl.makeCurrent(contextHandle)) { + if ( !impl.makeCurrent(contextHandle) ) { throw new GLException("Error making Context current: "+this); } drawableUpdatedNotify(); @@ -402,7 +402,7 @@ public class MacOSXCGLContext extends GLContextImpl @Override protected void copyImpl(final GLContext source, final int mask) throws GLException { if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) { - throw new GLException("Source/Destination OpenGL Context tyoe mismatch: source "+source+", dest: "+this); + throw new GLException("Source/Destination OpenGL Context type mismatch: source "+source+", dest: "+this); } if(!impl.copyImpl(source.getHandle(), mask)) { throw new GLException("Error copying OpenGL Context: source "+source+", dest: "+this); @@ -528,15 +528,16 @@ public class MacOSXCGLContext extends GLContextImpl public boolean isNSContext() { return true; } - /** Only returns a valid NSView. If !NSView, return null and mark either pbuffer and FBO. */ - private long getNSViewHandle(final boolean[] isPBuffer, final boolean[] isFBO) { + /** Only returns a valid NSView. If !NSView, return null and mark either isPBuffer, isFBO or isSurfaceless. */ + private long getNSViewHandle(final boolean[] isPBuffer, final boolean[] isFBO, final boolean[] isSurfaceless) { final long nsViewHandle; if(drawable instanceof GLFBODrawableImpl) { nsViewHandle = 0; isPBuffer[0] = false; isFBO[0] = true; + isSurfaceless[0] = false; if(DEBUG) { - System.err.println("NS viewHandle.1: GLFBODrawableImpl drawable: isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", "+drawable.getClass().getName()+",\n\t"+drawable); + System.err.println("NS viewHandle.1: GLFBODrawableImpl drawable: isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", isSurfaceless "+isSurfaceless[0]+", "+drawable.getClass().getName()+",\n\t"+drawable); } } else { final long drawableHandle = drawable.getHandle(); @@ -544,6 +545,7 @@ public class MacOSXCGLContext extends GLContextImpl final boolean isNSWindow = OSXUtil.isNSWindow(drawableHandle); isPBuffer[0] = CGL.isNSOpenGLPixelBuffer(drawableHandle); isFBO[0] = false; + isSurfaceless[0] = false; if( isNSView ) { nsViewHandle = drawableHandle; @@ -551,11 +553,14 @@ public class MacOSXCGLContext extends GLContextImpl nsViewHandle = OSXUtil.GetNSView(drawableHandle); } else if( isPBuffer[0] ) { nsViewHandle = 0; + } else if( isSurfacelessOK() ) { + isSurfaceless[0] = true; + nsViewHandle = 0; } else { - throw new RuntimeException("Drawable's handle neither NSView, NSWindow nor PBuffer: drawableHandle "+toHexString(drawableHandle)+", isNSView "+isNSView+", isNSWindow "+isNSWindow+", isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", "+drawable.getClass().getName()+",\n\t"+drawable); + throw new GLException("Drawable's handle neither NSView, NSWindow nor PBuffer: drawableHandle "+toHexString(drawableHandle)+", isNSView "+isNSView+", isNSWindow "+isNSWindow+", isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", "+drawable.getClass().getName()+",\n\t"+drawable); } if(DEBUG) { - System.err.println("NS viewHandle.2: drawableHandle "+toHexString(drawableHandle)+" -> nsViewHandle "+toHexString(nsViewHandle)+": isNSView "+isNSView+", isNSWindow "+isNSWindow+", isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", "+drawable.getClass().getName()+",\n\t"+drawable); + System.err.println("NS viewHandle.2: drawableHandle "+toHexString(drawableHandle)+" -> nsViewHandle "+toHexString(nsViewHandle)+": isNSView "+isNSView+", isNSWindow "+isNSWindow+", isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", isSurfaceless "+isSurfaceless[0]+", "+drawable.getClass().getName()+",\n\t"+drawable); } } needsSetContextPBuffer = isPBuffer[0]; @@ -571,12 +576,15 @@ public class MacOSXCGLContext extends GLContextImpl final long nsViewHandle; final boolean isPBuffer; final boolean isFBO; + final boolean isSurfaceless; { final boolean[] _isPBuffer = { false }; final boolean[] _isFBO = { false }; - nsViewHandle = getNSViewHandle(_isPBuffer, _isFBO); + final boolean[] _isSurfaceless = { false }; + nsViewHandle = getNSViewHandle(_isPBuffer, _isFBO, _isSurfaceless); isPBuffer = _isPBuffer[0]; isFBO = _isFBO[0]; + isSurfaceless = _isSurfaceless[0]; } final OffscreenLayerSurface backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(surface, true); @@ -612,7 +620,7 @@ public class MacOSXCGLContext extends GLContextImpl // determine on-/offscreen caps, since pformat is ambiguous _fixedCaps.setPBuffer( isPBuffer ); // exclusive _fixedCaps.setBitmap( false ); // n/a in our OSX impl. - _fixedCaps.setOnscreen( !isFBO && !isPBuffer ); + _fixedCaps.setOnscreen( !isFBO && !isPBuffer && !isSurfaceless ); fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(_fixedCaps, chosenCaps.isBackgroundOpaque()); } final int sRefreshRate = OSXUtil.GetScreenRefreshRate(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getIndex()); @@ -625,7 +633,7 @@ public class MacOSXCGLContext extends GLContextImpl System.err.println("NS create backingLayerHost: "+backingLayerHost); System.err.println("NS create share: "+share); System.err.println("NS create drawable type: "+drawable.getClass().getName()); - System.err.println("NS create drawable handle: isPBuffer "+isPBuffer+", isFBO "+isFBO); + System.err.println("NS create drawable handle: isPBuffer "+isPBuffer+", isFBO "+isFBO+", isSurfaceless "+isSurfaceless); System.err.println("NS create pixelFormat: "+toHexString(pixelFormat)); System.err.println("NS create chosenCaps: "+chosenCaps); System.err.println("NS create fixedCaps: "+fixedCaps); @@ -873,7 +881,8 @@ public class MacOSXCGLContext extends GLContextImpl lastHeight = drawable.getSurfaceHeight(); final boolean[] isPBuffer = { false }; final boolean[] isFBO = { false }; - CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO)); + final boolean[] isSurfaceless = { false }; + CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO, isSurfaceless)); } } else { // -> !bound if( null != backingLayerHost ) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java index 8ea84a32d..ab643c095 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java @@ -44,13 +44,12 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; import jogamp.opengl.GLDrawableImpl; -import jogamp.opengl.GLDynamicLookupHelper; public abstract class MacOSXCGLDrawable extends GLDrawableImpl { // The Java2D/OpenGL pipeline on OS X uses low-level CGLContextObjs @@ -148,11 +147,6 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } } - @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper() { - return getFactoryImpl().getGLDynamicLookupHelper(0); - } - // Support for "mode switching" as described in MacOSXCGLDrawable public void setOpenGLMode(final GLBackendType mode) { if (mode == openGLMode) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index 045abca4c..ab1d56e29 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -47,20 +47,20 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.WrappedSurface; import jogamp.nativewindow.macosx.OSXDummyUpstreamSurfaceHook; @@ -74,12 +74,15 @@ import jogamp.opengl.SharedResourceRunner; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.ReflectionUtil; +import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; import com.jogamp.nativewindow.MutableGraphicsConfiguration; import com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice; import com.jogamp.opengl.GLExtensions; import com.jogamp.opengl.GLRendererQuirks; public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { + private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG; + private static DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper = null; public MacOSXCGLDrawableFactory() { @@ -145,7 +148,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) { return macOSXCGLDynamicLookupHelper; } @@ -175,7 +178,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { this.hasAppleFloatPixels = hasAppletFloatPixels; } @Override - public final boolean isValid() { + public final boolean isAvailable() { return valid; } @Override @@ -197,7 +200,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { return null; } @Override - public GLRendererQuirks getRendererQuirks() { + public GLRendererQuirks getRendererQuirks(final GLProfile glp) { return glRendererQuirks; } } @@ -242,62 +245,86 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } if(null==sr && !getDeviceTried(connection)) { addDeviceTried(connection); - final MacOSXGraphicsDevice sharedDevice = new MacOSXGraphicsDevice(adevice.getUnitID()); - GLRendererQuirks glRendererQuirks = null; - boolean isValid = false; - boolean hasNPOTTextures = false; - boolean hasRECTTextures = false; - boolean hasAppleFloatPixels = false; - { - final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); + final MacOSXGraphicsDevice device = new MacOSXGraphicsDevice(adevice.getUnitID()); + GLDrawable drawable = null; + GLDrawable zeroDrawable = null; + GLContextImpl context = null; + boolean contextIsCurrent = false; + device.lock(); + try { + final GLProfile glp = GLProfile.get(device, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); if (null == glp) { - throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice); + throw new GLException("Couldn't get default GLProfile for device: "+device); } final GLCapabilitiesImmutable caps = new GLCapabilities(glp); - final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64)); - sharedDrawable.setRealized(true); + drawable = createOnscreenDrawableImpl(createDummySurfaceImpl(device, false, caps, caps, null, 64, 64)); + drawable.setRealized(true); - final MacOSXCGLContext sharedContext = (MacOSXCGLContext) sharedDrawable.createContext(null); - if (null == sharedContext) { - throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable); + context = (MacOSXCGLContext) drawable.createContext(null); + if (null == context) { + throw new GLException("Couldn't create shared context for drawable: "+drawable); } - - try { - sharedContext.makeCurrent(); // could cause exception - isValid = sharedContext.isCurrent(); - if(isValid) { - final GL gl = sharedContext.getGL(); - hasNPOTTextures = gl.isNPOTTextureAvailable(); - hasRECTTextures = gl.isExtensionAvailable(GLExtensions.EXT_texture_rectangle); - hasAppleFloatPixels = gl.isExtensionAvailable(GLExtensions.APPLE_float_pixels); - glRendererQuirks = sharedContext.getRendererQuirks(); + contextIsCurrent = GLContext.CONTEXT_NOT_CURRENT != context.makeCurrent(); + + final boolean allowsSurfacelessCtx; + final boolean hasNPOTTextures; + final boolean hasRECTTextures; + final boolean hasAppleFloatPixels; + final GLRendererQuirks glRendererQuirks; + if( contextIsCurrent ) { + // We allow probing surfaceless for even the compatible 2.1 context, + // which we probably have right here - since OSX may support this. + // Otherwise, we cannot map the quirk to the device. + if( probeSurfacelessCtx(context, false /* restoreDrawable */) ) { + allowsSurfacelessCtx = true; + zeroDrawable = context.getGLDrawable(); + } else { + allowsSurfacelessCtx = false; } - } catch (final GLException gle) { - if (DEBUG) { - System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: makeCurrent caught exception:"); - gle.printStackTrace(); - } - } finally { + final GL gl = context.getGL(); + hasNPOTTextures = gl.isNPOTTextureAvailable(); + hasRECTTextures = gl.isExtensionAvailable(GLExtensions.EXT_texture_rectangle); + hasAppleFloatPixels = gl.isExtensionAvailable(GLExtensions.APPLE_float_pixels); + glRendererQuirks = context.getRendererQuirks(); + } else { + allowsSurfacelessCtx = false; + hasNPOTTextures = false; + hasRECTTextures = false; + hasAppleFloatPixels = false; + glRendererQuirks = null; + } + sr = new SharedResource(device, contextIsCurrent, hasNPOTTextures, hasRECTTextures, hasAppleFloatPixels, glRendererQuirks); + if ( DEBUG_SHAREDCTX ) { + System.err.println("SharedDevice: " + device); + System.err.println("SharedContext: " + context + ", madeCurrent " + contextIsCurrent); + System.err.println(" NPOT "+hasNPOTTextures+", RECT "+hasRECTTextures+", FloatPixels "+hasAppleFloatPixels); + System.err.println(" allowsSurfacelessCtx "+allowsSurfacelessCtx); + System.err.println(" glRendererQuirks "+glRendererQuirks); + } + synchronized(sharedMap) { + sharedMap.put(connection, sr); + } + } catch (final Throwable t) { + throw new GLException("MacOSXCGLDrawableFactory - Could not initialize shared resources for "+adevice, t); + } finally { + if( null != context ) { try { - sharedContext.destroy(); + context.destroy(); } catch (final GLException gle) { - if (DEBUG) { + if ( DEBUG_SHAREDCTX ) { System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: destroy caught exception:"); gle.printStackTrace(); } } } - sharedDrawable.setRealized(false); - } - sr = new SharedResource(sharedDevice, isValid, hasNPOTTextures, hasRECTTextures, hasAppleFloatPixels, glRendererQuirks); - synchronized(sharedMap) { - sharedMap.put(connection, sr); - } - removeDeviceTried(connection); - if (DEBUG) { - System.err.println("MacOSXCGLDrawableFactory.createShared: device: " + sharedDevice); - System.err.println("MacOSXCGLDrawableFactory.createShared: context: madeCurrent " + isValid + ", NPOT "+hasNPOTTextures+ - ", RECT "+hasRECTTextures+", FloatPixels "+hasAppleFloatPixels+", "+glRendererQuirks); + if( null != zeroDrawable ) { + zeroDrawable.setRealized(false); + } + if( null != drawable ) { + drawable.setRealized(false); + } + device.unlock(); + removeDeviceTried(connection); } } return sr; @@ -373,6 +400,13 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override + public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { + chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); + return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new GenericUpstreamSurfacelessHook(width, height)); + } + + @Override protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final MacOSXGraphicsDevice device = new MacOSXGraphicsDevice(deviceReq.getUnitID()); final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java index 3ec40ffce..5cf4f36a1 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java @@ -28,8 +28,10 @@ package jogamp.opengl.macosx.cgl; -import jogamp.opengl.*; -import java.util.*; +import java.util.ArrayList; +import java.util.List; + +import jogamp.opengl.DesktopGLDynamicLibraryBundleInfo; public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryBundleInfo { protected MacOSXCGLDynamicLibraryBundleInfo() { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java index cd89ad526..efb9bd5ad 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java @@ -40,12 +40,12 @@ import java.nio.IntBuffer; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java index 50de70227..7e5f8b2b3 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java @@ -36,15 +36,15 @@ package jogamp.opengl.macosx.cgl; import jogamp.opengl.GLGraphicsConfigurationFactory; import jogamp.opengl.GLGraphicsConfigurationUtil; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; /** Subclass of GraphicsConfigurationFactory used when non-AWT tookits diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java index c17ed7d59..db15fb95b 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java @@ -40,14 +40,14 @@ package jogamp.opengl.macosx.cgl; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; import jogamp.nativewindow.WrappedSurface; import jogamp.opengl.GLContextShareSet; diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java index c613efa63..b0701403c 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java @@ -40,9 +40,9 @@ package jogamp.opengl.macosx.cgl; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java index e9ea2ff61..d283ae2cb 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java @@ -40,9 +40,9 @@ package jogamp.opengl.macosx.cgl; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java index bc88d9ca9..56d1a94cf 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -42,13 +42,13 @@ package jogamp.opengl.macosx.cgl; import java.lang.ref.WeakReference; -import javax.media.nativewindow.DefaultGraphicsConfiguration; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.MutableSurface; -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.DefaultGraphicsConfiguration; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.MutableSurface; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opengl.util.GLBuffers; diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java index 01300b005..180860f2a 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java @@ -37,17 +37,17 @@ import jogamp.opengl.GLGraphicsConfigurationFactory; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.GraphicsConfigurationFactory; - -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; + +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLException; import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; import com.jogamp.nativewindow.awt.AWTGraphicsDevice; diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java index 003b9148e..562d4883d 100644 --- a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java @@ -33,6 +33,7 @@ import java.util.Arrays; import jogamp.opengl.Debug; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.LFRingbuffer; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.Ringbuffer; @@ -262,7 +263,7 @@ public class ALAudioSink implements AudioSink { if( ALCConstants.ALC_NO_ERROR != alcErr ) { final String err = getThreadName()+": ALCError "+toHexString(alcErr)+" while makeCurrent. "+this; System.err.println(err); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); lock.unlock(); throw new RuntimeException(err); } @@ -270,7 +271,7 @@ public class ALAudioSink implements AudioSink { if( ALCConstants.ALC_NO_ERROR != alErr ) { if( DEBUG ) { System.err.println(getThreadName()+": Prev - ALError "+toHexString(alErr)+" @ makeCurrent. "+this); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } @@ -290,8 +291,7 @@ public class ALAudioSink implements AudioSink { alc.alcDestroyContext(context); } catch (final Throwable t) { if( DEBUG ) { - System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); - t.printStackTrace(); + ExceptionUtils.dumpThrowable("", t); } } context = null; @@ -652,7 +652,7 @@ public class ALAudioSink implements AudioSink { alBufferBytesQueued = 0; if(DEBUG_TRACE) { System.err.println("<< _FLUSH_ [al "+val[0]+", err "+toHexString(alErr)+"] <- "+shortString()+" @ "+getThreadName()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java index 810a9286b..a2bb498b3 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java @@ -28,7 +28,7 @@ package jogamp.opengl.util; -import javax.media.opengl.*; +import com.jogamp.opengl.*; /** * Handles consistency of buffer data and array state.<br/> diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java index 179142fee..3af1501c4 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java +++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java @@ -28,7 +28,7 @@ package jogamp.opengl.util; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.GLArrayDataWrapper; diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java index 3119b96ca..24105fdd2 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java +++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java @@ -31,7 +31,7 @@ package jogamp.opengl.util; import java.util.ArrayList; import java.util.List; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; import com.jogamp.opengl.util.GLArrayDataEditable; diff --git a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java index 66be98215..b617ad5b0 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java @@ -28,8 +28,8 @@ package jogamp.opengl.util; -import javax.media.opengl.GL; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLException; import com.jogamp.opengl.util.GLArrayDataEditable; diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java index f5869c6ba..d1abbf5b4 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java @@ -28,9 +28,9 @@ package jogamp.opengl.util; -import javax.media.opengl.GL; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; import com.jogamp.opengl.util.GLArrayDataEditable; diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java index b5fa2f0e5..bbd8fcd12 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java +++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java @@ -28,9 +28,9 @@ package jogamp.opengl.util; -import javax.media.opengl.GL; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; import com.jogamp.opengl.util.GLArrayDataWrapper; diff --git a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java index 7bc1ef1ef..a9424282e 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java @@ -30,7 +30,7 @@ package jogamp.opengl.util; import java.nio.Buffer; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; import com.jogamp.opengl.util.GLArrayDataEditable; diff --git a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java index f9df9153f..0e3317c5e 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java @@ -30,16 +30,16 @@ package jogamp.opengl.util.av; import java.nio.Buffer; import java.nio.IntBuffer; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; import com.jogamp.common.nio.Buffers; +import com.jogamp.opengl.egl.EGL; +import com.jogamp.opengl.egl.EGLExt; import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureSequence; -import jogamp.opengl.egl.EGL; import jogamp.opengl.egl.EGLContext; import jogamp.opengl.egl.EGLDrawable; -import jogamp.opengl.egl.EGLExt; public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { final protected TextureType texType; diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index 0969199c6..cfecbfd8d 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -33,15 +33,15 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.opengl.GL; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLES2; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLES2; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.Debug; diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java index 4a15c7422..92ed2d749 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java @@ -31,9 +31,9 @@ import java.io.IOException; import java.net.URLConnection; import java.nio.ByteBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.util.av.GLMediaPlayerImpl; diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java index 42a908f93..f294d5bc0 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java @@ -36,7 +36,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLProfile; import com.jogamp.common.os.DynamicLibraryBundle; import com.jogamp.common.os.DynamicLibraryBundleInfo; @@ -115,7 +115,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { /* 54 */ "avformat_find_stream_info", // 53.3.0 (opt) // libavdevice -/* 55 */ "avdevice_register_all", // ??? +/* 55 */ "avdevice_register_all", // supported in all version <= 56 // libavresample "avresample_alloc_context", // 1.0.1 @@ -154,7 +154,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "avresample_free", "avresample_convert", - // libavresample + // libswresample "av_opt_set_sample_fmt", // actually lavu .. but exist only w/ swresample! "swresample_version", // 0 "swr_alloc", @@ -163,12 +163,11 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "swr_convert", }; + /** util, format, codec, device, avresample, swresample */ + private static final boolean[] libLoaded = new boolean[6]; private static final long[] symbolAddr = new long[symbolCount]; private static final boolean ready; private static final boolean libsUFCLoaded; - private static final boolean avresampleLoaded; // optional - private static final boolean swresampleLoaded; // optional - private static final boolean avdeviceLoaded; // optional static final VersionNumber avCodecVersion; static final VersionNumber avFormatVersion; static final VersionNumber avUtilVersion; @@ -183,23 +182,81 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { private static final int LIB_IDX_AVR = 4; private static final int LIB_IDX_SWR = 5; + private static final PrivilegedAction<DynamicLibraryBundle> privInitSymbolsAction = new PrivilegedAction<DynamicLibraryBundle>() { + @Override + public DynamicLibraryBundle run() { + final DynamicLibraryBundle dl = new DynamicLibraryBundle(new FFMPEGDynamicLibraryBundleInfo()); + for(int i=0; i<6; i++) { + libLoaded[i] = dl.isToolLibLoaded(i); + } + if( !libLoaded[LIB_IDX_UTI] || !libLoaded[LIB_IDX_FMT] || !libLoaded[LIB_IDX_COD] ) { + throw new RuntimeException("FFMPEG Tool library incomplete: [ avutil "+libLoaded[LIB_IDX_UTI]+", avformat "+libLoaded[LIB_IDX_FMT]+", avcodec "+libLoaded[LIB_IDX_COD]+"]"); + } + dl.claimAllLinkPermission(); + try { + for(int i = 0; i<symbolCount; i++) { + symbolAddr[i] = dl.dynamicLookupFunction(symbolNames[i]); + } + } finally { + dl.releaseAllLinkPermission(); + } + return dl; + } }; + + /** + * @param loaded 6: util, format, codec, device, avresample, swresample + * @param versions 5: util, format, codec, avresample, swresample + * @return + */ + private static final boolean initSymbols(final VersionNumber[] versions) { + for(int i=0; i<6; i++) { + libLoaded[i] = false; + } + if(symbolNames.length != symbolCount) { + throw new InternalError("XXX0 "+symbolNames.length+" != "+symbolCount); + } + + AccessController.doPrivileged(privInitSymbolsAction); + + // optional symbol name set + final Set<String> optionalSymbolNameSet = new HashSet<String>(); + optionalSymbolNameSet.addAll(Arrays.asList(optionalSymbolNames)); + + // validate results + boolean res = true; + for(int i = 0; i<symbolCount; i++) { + if( 0 == symbolAddr[i] ) { + // no symbol, check optional and alternative symbols + final String symbol = symbolNames[i]; + if ( !optionalSymbolNameSet.contains(symbol) ) { + System.err.println("Fail: Could not resolve symbol <"+symbolNames[i]+">: not optional, no alternatives."); + res = false; + } else if(DEBUG) { + System.err.println("OK: Unresolved optional symbol <"+symbolNames[i]+">"); + } + } + } + versions[0] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[0])); + versions[1] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[1])); + versions[2] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[2])); + versions[3] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[3])); + versions[4] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[4])); + + return res; + } + static { // native ffmpeg media player implementation is included in jogl_desktop and jogl_mobile GLProfile.initSingleton(); boolean _ready = false; - /** util, format, codec, device, avresample, swresample */ - final boolean[] _loaded= new boolean[6]; /** util, format, codec, avresample, swresample */ final VersionNumber[] _versions = new VersionNumber[5]; try { - _ready = initSymbols(_loaded, _versions); + _ready = initSymbols(_versions); } catch (final Throwable t) { t.printStackTrace(); } - libsUFCLoaded = _loaded[LIB_IDX_UTI] && _loaded[LIB_IDX_FMT] && _loaded[LIB_IDX_COD]; - avdeviceLoaded = _loaded[LIB_IDX_DEV]; - avresampleLoaded = _loaded[LIB_IDX_AVR]; - swresampleLoaded = _loaded[LIB_IDX_SWR]; + libsUFCLoaded = libLoaded[LIB_IDX_UTI] && libLoaded[LIB_IDX_FMT] && libLoaded[LIB_IDX_COD]; avUtilVersion = _versions[0]; avFormatVersion = _versions[1]; avCodecVersion = _versions[2]; @@ -226,6 +283,9 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { } else if( avCodecMajor == 55 && avFormatMajor == 55 && ( avUtilMajor == 52 || avUtilMajor == 53 ) ) { // lavc55.lavf55.lavu52.lavr01 (ffmpeg) or lavc55.lavf55.lavu53.lavr01 (libav) natives = new FFMPEGv10Natives(); + } else if( avCodecMajor == 56 && avFormatMajor == 56 && avUtilMajor == 54 ) { + // lavc56.lavf56.lavu54.lavr02 + natives = new FFMPEGv11Natives(); } else { System.err.println("LIB_AV No Version/Native-Impl Match"); natives = null; @@ -239,74 +299,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { } static boolean libsLoaded() { return libsUFCLoaded; } - static boolean avDeviceLoaded() { return avdeviceLoaded; } - static boolean avResampleLoaded() { return avresampleLoaded; } - static boolean swResampleLoaded() { return swresampleLoaded; } + static boolean avDeviceLoaded() { return libLoaded[LIB_IDX_DEV]; } + static boolean avResampleLoaded() { return libLoaded[LIB_IDX_AVR]; } + static boolean swResampleLoaded() { return libLoaded[LIB_IDX_SWR]; } static FFMPEGNatives getNatives() { return natives; } static boolean initSingleton() { return ready; } - /** - * @param loaded 6: util, format, codec, device, avresample, swresample - * @param versions 5: util, format, codec, avresample, swresample - * @return - */ - private static final boolean initSymbols(final boolean[] loaded, final VersionNumber[] versions) { - for(int i=0; i<6; i++) { - loaded[i] = false; - } - final DynamicLibraryBundle dl = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() { - @Override - public DynamicLibraryBundle run() { - return new DynamicLibraryBundle(new FFMPEGDynamicLibraryBundleInfo()); - } } ); - dl.toString(); - for(int i=0; i<6; i++) { - loaded[i] = dl.isToolLibLoaded(i); - } - if( !loaded[LIB_IDX_UTI] || !loaded[LIB_IDX_FMT] || !loaded[LIB_IDX_COD] ) { - throw new RuntimeException("FFMPEG Tool library incomplete: [ avutil "+loaded[LIB_IDX_UTI]+", avformat "+loaded[LIB_IDX_FMT]+", avcodec "+loaded[LIB_IDX_COD]+"]"); - } - if(symbolNames.length != symbolCount) { - throw new InternalError("XXX0 "+symbolNames.length+" != "+symbolCount); - } - - // optional symbol name set - final Set<String> optionalSymbolNameSet = new HashSet<String>(); - optionalSymbolNameSet.addAll(Arrays.asList(optionalSymbolNames)); - - // lookup - AccessController.doPrivileged(new PrivilegedAction<Object>() { - @Override - public Object run() { - for(int i = 0; i<symbolCount; i++) { - symbolAddr[i] = dl.dynamicLookupFunction(symbolNames[i]); - } - return null; - } } ); - - // validate results - boolean res = true; - for(int i = 0; i<symbolCount; i++) { - if( 0 == symbolAddr[i] ) { - // no symbol, check optional and alternative symbols - final String symbol = symbolNames[i]; - if ( !optionalSymbolNameSet.contains(symbol) ) { - System.err.println("Fail: Could not resolve symbol <"+symbolNames[i]+">: not optional, no alternatives."); - res = false; - } else if(DEBUG) { - System.err.println("OK: Unresolved optional symbol <"+symbolNames[i]+">"); - } - } - } - versions[0] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[0])); - versions[1] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[1])); - versions[2] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[2])); - versions[3] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[3])); - versions[4] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[4])); - - return res; - } - protected FFMPEGDynamicLibraryBundleInfo() { } @@ -338,13 +336,17 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { final List<String> avutil = new ArrayList<String>(); avutil.add("avutil"); // default - avutil.add("libavutil.so.53"); // dummy future proof - avutil.add("libavutil.so.52"); // ffmpeg 1.2 + 2 / libav 9 + 10 + avutil.add("libavutil.so.55"); // dummy future proof + avutil.add("libavutil.so.54"); // ffmpeg 2.[4-x] / libav 11 + avutil.add("libavutil.so.53"); // ffmpeg 2.[0-3] / libav 10 + avutil.add("libavutil.so.52"); // ffmpeg 1.2 + 2.[0-3] / libav 9 avutil.add("libavutil.so.51"); // 0.8 avutil.add("libavutil.so.50"); // 0.7 - avutil.add("avutil-53"); // dummy future proof - avutil.add("avutil-52"); // ffmpeg 1.2 + 2 / libav 9 + 10 + avutil.add("avutil-55"); // dummy future proof + avutil.add("avutil-54"); // ffmpeg 2.[4-x] / libav 11 + avutil.add("avutil-53"); // ffmpeg 2.[0-3] / libav 10 + avutil.add("avutil-52"); // ffmpeg 1.2 + 2.[0-3] / libav 9 avutil.add("avutil-51"); // 0.8 avutil.add("avutil-50"); // 0.7 libsList.add(avutil); @@ -352,14 +354,16 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { final List<String> avformat = new ArrayList<String>(); avformat.add("avformat"); // default - avformat.add("libavformat.so.56"); // dummy future proof - avformat.add("libavformat.so.55"); // ffmpeg 2 / libav 10 + avformat.add("libavformat.so.57"); // dummy future proof + avformat.add("libavformat.so.56"); // ffmpeg 2.[4-x] / libav 11 + avformat.add("libavformat.so.55"); // ffmpeg 2.[0-3] / libav 10 avformat.add("libavformat.so.54"); // ffmpeg 1.2 / libav 9 avformat.add("libavformat.so.53"); // 0.8 avformat.add("libavformat.so.52"); // 0.7 - avformat.add("avformat-56"); // dummy future proof - avformat.add("avformat-55"); // ffmpeg 2 / libav 10 + avformat.add("avformat-57"); // dummy future proof + avformat.add("avformat-56"); // ffmpeg 2.[4-x] / libav 11 + avformat.add("avformat-55"); // ffmpeg 2.[0-3] / libav 10 avformat.add("avformat-54"); // ffmpeg 1.2 / libav 9 avformat.add("avformat-53"); // 0.8 avformat.add("avformat-52"); // 0.7 @@ -368,14 +372,16 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { final List<String> avcodec = new ArrayList<String>(); avcodec.add("avcodec"); // default - avcodec.add("libavcodec.so.56"); // dummy future proof - avcodec.add("libavcodec.so.55"); // ffmpeg 2/ libav 10 + avcodec.add("libavcodec.so.57"); // dummy future proof + avcodec.add("libavcodec.so.56"); // ffmpeg 2.[4-x] / libav 11 + avcodec.add("libavcodec.so.55"); // ffmpeg 2.[0-3] / libav 10 avcodec.add("libavcodec.so.54"); // ffmpeg 1.2 / libav 9 avcodec.add("libavcodec.so.53"); // 0.8 avcodec.add("libavcodec.so.52"); // 0.7 - avcodec.add("avcodec-56"); // dummy future proof - avcodec.add("avcodec-55"); // ffmpeg 2/ libav 10 + avcodec.add("avcodec-57"); // dummy future proof + avcodec.add("avcodec-56"); // ffmpeg 2.[4-x] / libav 11 + avcodec.add("avcodec-55"); // ffmpeg 2.[0-3] / libav 10 avcodec.add("avcodec-54"); // ffmpeg 1.2 / libav 9 avcodec.add("avcodec-53"); // 0.8 avcodec.add("avcodec-52"); // 0.7 @@ -384,13 +390,15 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { final List<String> avdevice = new ArrayList<String>(); avdevice.add("avdevice"); // default - avdevice.add("libavdevice.so.56"); // dummy future proof - avdevice.add("libavdevice.so.55"); // ffmpeg 2 + avdevice.add("libavdevice.so.57"); // dummy future proof + avdevice.add("libavdevice.so.56"); // ffmpeg 2.[4-x] + avdevice.add("libavdevice.so.55"); // ffmpeg 2.[0-3] / libav 11 avdevice.add("libavdevice.so.54"); // ffmpeg 1.2 / libav 10 avdevice.add("libavdevice.so.53"); // 0.8 && libav 9 - avdevice.add("avdevice-56"); // dummy future proof - avdevice.add("avdevice-55"); // ffmpeg 2 + avdevice.add("avdevice-57"); // dummy future proof + avdevice.add("avdevice-56"); // ffmpeg 2.[4-x] + avdevice.add("avdevice-55"); // ffmpeg 2.[0-3] / libav 11 avdevice.add("avdevice-54"); // ffmpeg 1.2 / libav 10 avdevice.add("avdevice-53"); // 0.8 && libav 9 libsList.add(avdevice); @@ -398,21 +406,25 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { final List<String> avresample = new ArrayList<String>(); avresample.add("avresample"); // default - avresample.add("libavresample.so.2"); // dummy future proof + avresample.add("libavresample.so.3"); // dummy future proof + avresample.add("libavresample.so.2"); // libav 11 avresample.add("libavresample.so.1"); // libav 9 + 10 - avresample.add("avresample-2"); // dummy future proof + avresample.add("avresample-3"); // dummy future proof + avresample.add("avresample-2"); // libav 11 avresample.add("avresample-1"); // libav 9 + 10 libsList.add(avresample); final List<String> swresample = new ArrayList<String>(); swresample.add("swresample"); // default - swresample.add("libswresample.so.1"); // dummy future proof - swresample.add("libswresample.so.0"); // ffmpeg 1.2 + 2.x + swresample.add("libswresample.so.2"); // dummy future proof + swresample.add("libswresample.so.1"); // ffmpeg 2.[4-x] + swresample.add("libswresample.so.0"); // ffmpeg 1.2 + 2.[0-3] - swresample.add("swresample-1"); // dummy future proof - swresample.add("swresample-0"); // ffmpeg 1.2 + 2.x + swresample.add("swresample-2"); // dummy future proof + swresample.add("swresample-1"); // ffmpeg 2.[4-x] + swresample.add("swresample-0"); // ffmpeg 1.2 + 2.[0-3] libsList.add(swresample); return libsList; diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java index 4601df67d..7df5d6a9e 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -33,9 +33,9 @@ import java.nio.ByteBuffer; import java.security.AccessController; import java.security.PrivilegedAction; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLException; import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.VersionNumber; @@ -106,14 +106,24 @@ import jogamp.opengl.util.av.VideoPixelFormat; * <p> * Currently we are binary compatible w/: * <table border="1"> - * <tr><th>libav / ffmpeg</th><th>lavc</th><th>lavf</th><th>lavu</th><th>lavr</th> <th>FFMPEG* class</th></tr> + * <tr><th>libav / ffmpeg</th><th>lavc</th><th>lavf</th><th>lavu</th><th>lavr/lswr</th> <th>FFMPEG* class</th></tr> * <tr><td>0.8</td> <td>53</td> <td>53</td> <td>51</td> <td></td> <td>FFMPEGv08</td></tr> * <tr><td>9.0 / 1.2</td> <td>54</td> <td>54</td> <td>52</td> <td>01/00</td> <td>FFMPEGv09</td></tr> - * <tr><td>10 / 2</td> <td>55</td> <td>55</td> <td>53/52</td> <td>01/00</td> <td>FFMPEGv10</td></tr> + * <tr><td>10 / 2.[0-3]</td> <td>55</td> <td>55</td> <td>53/52</td> <td>01/00</td> <td>FFMPEGv10</td></tr> + * <tr><td>11 / 2.[4-x]</td> <td>56</td> <td>56</td> <td>54</td> <td>02/01</td> <td>FFMPEGv11</td></tr> * </table> * </p> * <p> - * See http://upstream-tracker.org/versions/libav.html + * See FFmpeg: + * <ul> + * <li>http://ffmpeg.org/documentation.html</li> + * <li>http://git.videolan.org/?p=ffmpeg.git;a=blob;f=doc/APIchanges;hb=HEAD</li> + * </ul> + * See libav: + * <ul> + * <li>https://libav.org/documentation.html</li> + * <li>http://upstream-tracker.org/versions/libav.html</li> + * </ul> * </p> * <p> * Check tag 'FIXME: Add more planar formats !' @@ -163,6 +173,8 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { private static final int avResampleMajorVersionCC; private static final int swResampleMajorVersionCC; private static final boolean available; + private static final boolean enableAvResample; + private static final boolean enableSwResample; static { final boolean libAVGood = FFMPEGDynamicLibraryBundleInfo.initSingleton(); @@ -205,9 +217,13 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { avFormatMajorVersionCC == avFormatMajor && ( avUtilMajorVersionCC == avUtilMajor || 55 == avCodecMajorVersionCC && 53 == avUtilMajorVersionCC && 52 == avUtilMajor /* ffmpeg 2.x */ - ) && - ( !avResampleLoaded || avResampleMajorVersionCC < 0 || avResampleMajorVersionCC == avResampleVersion.getMajor() ) && - ( !swResampleLoaded || swResampleMajorVersionCC < 0 || swResampleMajorVersionCC == swResampleVersion.getMajor() ) ; + ); + enableAvResample = avResampleLoaded && avResampleMajorVersionCC == avResampleVersion.getMajor(); + enableSwResample = swResampleLoaded && swResampleMajorVersionCC == swResampleVersion.getMajor(); + if( DEBUG ) { + System.err.println("LIB_AV Resample: enabled "+enableAvResample); + System.err.println("LIB_SW Resample: enabled "+enableSwResample); + } if( !libAVVersionGood ) { System.err.println("LIB_AV Not Matching Compile-Time / Runtime Major-Version"); } @@ -219,6 +235,8 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { avResampleMajorVersionCC = 0; swResampleMajorVersionCC = 0; libAVVersionGood = false; + enableAvResample = false; + enableSwResample = false; } available = libAVGood && libAVVersionGood && null != natives; } @@ -256,7 +274,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { if(!available) { throw new RuntimeException("FFMPEGMediaPlayer not available"); } - moviePtr = natives.createInstance0(this, DEBUG_NATIVE); + moviePtr = natives.createInstance0(this, enableAvResample, enableSwResample, DEBUG_NATIVE); if(0==moviePtr) { throw new GLException("Couldn't create FFMPEGInstance"); } diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java index 8fd439082..3b8fc83d9 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java @@ -43,7 +43,7 @@ import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; abstract int getAvResampleMajorVersionCC0(); abstract int getSwResampleMajorVersionCC0(); - abstract long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); + abstract long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose); abstract void destroyInstance0(long moviePtr); /** diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java index 6bab23f25..eff9ee5f5 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java @@ -47,7 +47,7 @@ class FFMPEGv08Natives extends FFMPEGNatives { native int getSwResampleMajorVersionCC0(); @Override - native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); + native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose); @Override native void destroyInstance0(long moviePtr); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java index a48b5f21f..d61b39c77 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java @@ -47,7 +47,7 @@ class FFMPEGv09Natives extends FFMPEGNatives { native int getSwResampleMajorVersionCC0(); @Override - native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); + native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose); @Override native void destroyInstance0(long moviePtr); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java index f35fb29dc..109fd8953 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java @@ -47,7 +47,7 @@ class FFMPEGv10Natives extends FFMPEGNatives { native int getSwResampleMajorVersionCC0(); @Override - native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); + native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose); @Override native void destroyInstance0(long moviePtr); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java new file mode 100644 index 000000000..9654eca82 --- /dev/null +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java @@ -0,0 +1,78 @@ +/** + * Copyright 2015 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package jogamp.opengl.util.av.impl; + +class FFMPEGv11Natives extends FFMPEGNatives { + @Override + native boolean initSymbols0(Object mutex_avcodec_openclose, long[] symbols, int count); + + @Override + native int getAvUtilMajorVersionCC0(); + + @Override + native int getAvFormatMajorVersionCC0(); + + @Override + native int getAvCodecMajorVersionCC0(); + + @Override + native int getAvResampleMajorVersionCC0(); + + @Override + native int getSwResampleMajorVersionCC0(); + + @Override + native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose); + + @Override + native void destroyInstance0(long moviePtr); + + @Override + native void setStream0(long moviePtr, String url, boolean isCameraInput, int vid, String sizes, int vWidth, int vHeight, int vRate, int aid, int aMaxChannelCount, int aPrefSampleRate); + + @Override + native void setGLFuncs0(long moviePtr, long procAddrGLTexSubImage2D, long procAddrGLGetError, long procAddrGLFlush, long procAddrGLFinish); + + @Override + native int getVideoPTS0(long moviePtr); + + @Override + native int getAudioPTS0(long moviePtr); + + @Override + native int readNextPacket0(long moviePtr, int texTarget, int texFmt, int texType); + + @Override + native int play0(long moviePtr); + + @Override + native int pause0(long moviePtr); + + @Override + native int seek0(long moviePtr, int position); +} diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java index 5baf9e543..c69108b04 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java @@ -30,12 +30,12 @@ package jogamp.opengl.util.av.impl; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.egl.EGL; import com.jogamp.opengl.util.texture.TextureSequence; -import jogamp.opengl.egl.EGL; import jogamp.opengl.util.av.EGLMediaPlayerImpl; /** diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java index 5a78f514d..6c497c9e3 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java @@ -30,8 +30,8 @@ package jogamp.opengl.util.glsl; import java.nio.Buffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; import jogamp.opengl.util.GLArrayHandlerFlat; import jogamp.opengl.util.GLVBOArrayHandler; diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java index 85fcabdd9..c78ddf4e8 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java @@ -28,8 +28,8 @@ package jogamp.opengl.util.glsl; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; import jogamp.opengl.util.GLArrayHandlerFlat; diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java index 0169b0747..016c25e42 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java @@ -31,7 +31,7 @@ package jogamp.opengl.util.glsl; import java.util.ArrayList; import java.util.List; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; import jogamp.opengl.util.GLArrayHandlerFlat; import jogamp.opengl.util.GLVBOArrayHandler; diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java index d5d0020c5..66c5c855b 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java @@ -35,12 +35,12 @@ import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLArrayData; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLArrayData; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; public class GLSLTextureRaster { private final boolean textureVertFlipped; diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java index 2dde27b1d..0b8a15557 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java @@ -32,14 +32,14 @@ package jogamp.opengl.util.glsl.fixedfunc; import java.nio.Buffer; import java.nio.IntBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLArrayData; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLArrayData; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.ValueConv; diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java index 7371b0f3b..5ac1dc7bf 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java @@ -34,19 +34,19 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLArrayData; -import javax.media.opengl.GLES2; -import javax.media.opengl.GLException; -import javax.media.opengl.GLRunnable2; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.fixedfunc.GLPointerFunc; -import javax.media.opengl.fixedfunc.GLPointerFuncUtil; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLArrayData; +import com.jogamp.opengl.GLES2; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLRunnable2; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFuncUtil; import jogamp.opengl.Debug; diff --git a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java index e3e43b30c..8254f164c 100644 --- a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java +++ b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java @@ -470,11 +470,11 @@ public class JPEGDecoder { } private final int readUInt8() throws IOException { - return bstream.readUInt8(true /* msbFirst */); + return bstream.readUInt8(); } private final int readUInt16() throws IOException { - return bstream.readUInt16(true /* msbFirst */, true /* bigEndian */); + return bstream.readUInt16(true /* bigEndian */); } private final int readNumber() throws IOException { diff --git a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java index 36e8bc5a5..69a3f2eda 100644 --- a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java +++ b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java @@ -29,12 +29,12 @@ package jogamp.opengl.util.stereo; import java.util.Arrays; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.opengl.math.FloatUtil; diff --git a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java index d957bd4e7..3b9fb9c26 100644 --- a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java +++ b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java @@ -30,14 +30,14 @@ package jogamp.opengl.util.stereo; import java.nio.FloatBuffer; import java.nio.ShortBuffer; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLArrayData; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLArrayData; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; import jogamp.common.os.PlatformPropsImpl; diff --git a/src/jogl/classes/jogamp/opengl/util/stereo/ScaleAndOffset2D.java b/src/jogl/classes/jogamp/opengl/util/stereo/ScaleAndOffset2D.java index ce154e03e..1fed69363 100644 --- a/src/jogl/classes/jogamp/opengl/util/stereo/ScaleAndOffset2D.java +++ b/src/jogl/classes/jogamp/opengl/util/stereo/ScaleAndOffset2D.java @@ -27,8 +27,8 @@ */ package jogamp.opengl.util.stereo; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.RectangleImmutable; import com.jogamp.opengl.math.FovHVHalves; import com.jogamp.opengl.math.VectorUtil; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java index 25b73a2a6..f00d38baa 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java @@ -33,11 +33,11 @@ import java.nio.IntBuffer; import jogamp.nativewindow.windows.GDI; import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR; -import javax.media.nativewindow.NativeWindowException; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; public class WGLGLCapabilities extends GLCapabilities { final private PIXELFORMATDESCRIPTOR pfd; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java index 0878f186c..c1ab8d076 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java @@ -40,14 +40,14 @@ package jogamp.opengl.windows.wgl; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.MutableSurface; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.MutableSurface; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.windows.BITMAPINFO; import jogamp.nativewindow.windows.BITMAPINFOHEADER; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java index 4cebc6357..79628321d 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java @@ -40,15 +40,15 @@ package jogamp.opengl.windows.wgl; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.WrappedSurface; import jogamp.nativewindow.windows.GDI; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java index 1378bcf3e..4cebb7e2d 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java @@ -40,14 +40,14 @@ package jogamp.opengl.windows.wgl; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.WrappedSurface; import jogamp.nativewindow.windows.GDI; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java index 0d0681df9..46f682575 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java @@ -40,9 +40,9 @@ package jogamp.opengl.windows.wgl; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable { protected WindowsOnscreenWGLDrawable(final GLDrawableFactory factory, final NativeSurface component) { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index 775e2936c..b9a02ddf8 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -43,15 +43,15 @@ package jogamp.opengl.windows.wgl; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.MutableSurface; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.MutableSurface; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import com.jogamp.common.nio.Buffers; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index ebd107c47..ec4575a9c 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -45,13 +45,12 @@ import java.nio.IntBuffer; import java.util.HashMap; import java.util.Map; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLCapabilitiesImmutable; import com.jogamp.common.nio.Buffers; import com.jogamp.gluegen.runtime.ProcAddressTable; @@ -152,17 +151,33 @@ public class WindowsWGLContext extends GLContextImpl { // should not happen due to 'isGLReadDrawableAvailable()' query in GLContextImpl throw new InternalError("Given readDrawable but no driver support"); } - final int werr = ( !ok ) ? GDI.GetLastError() : GDI.ERROR_SUCCESS; if(DEBUG && !ok) { - final Throwable t = new Throwable ("Info: wglMakeContextCurrent draw "+ + final Throwable t = new Throwable ("Info: wglMakeContextCurrent NOK: draw "+ GLContext.toHexString(hDrawDC) + ", read " + GLContext.toHexString(hReadDC) + - ", ctx " + GLContext.toHexString(ctx) + ", werr " + werr); + ", ctx " + GLContext.toHexString(ctx) + ", werr " + GDI.GetLastError()); t.printStackTrace(); } - if(!ok && 0==hDrawDC && 0==hReadDC) { + return ok; + } + + private final boolean wglReleaseContext() { + boolean ok = false; + if(wglGLReadDrawableAvailable) { + // needs initilized WGL ProcAddress table + ok = getWGLExt().wglMakeContextCurrent(0, 0, 0); + } else { + ok = WGL.wglMakeCurrent(0, 0); + } + if( !ok ) { + final int werr = GDI.GetLastError(); + final boolean ok2 = werr == GDI.ERROR_SUCCESS; + if(DEBUG) { + final Throwable t = new Throwable ("Info: wglReleaseContext NOK: werr " + werr + " -> ok "+ok2); + t.printStackTrace(); + } // Some GPU's falsely fails with a zero error code (success), // in case this is a release context request we tolerate this - return werr == GDI.ERROR_SUCCESS ; + return ok2 ; } return ok; } @@ -316,6 +331,8 @@ public class WindowsWGLContext extends GLContextImpl { throw new GLException("Error making temp context current: 0x" + toHexString(temp_ctx) + ", werr: "+GDI.GetLastError()); } if( !setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */) ) { // use GL_VERSION + WGL.wglMakeCurrent(0, 0); // release temp context + WGL.wglDeleteContext(temp_ctx); throw new InternalError("setGLFunctionAvailability !strictMatch failed"); } WGL.wglMakeCurrent(0, 0); // release temp context @@ -331,7 +348,7 @@ public class WindowsWGLContext extends GLContextImpl { isProcCreateContextAttribsARBAvailable = false; isExtARBCreateContextAvailable = false; } - if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable && !GLProfile.disableOpenGLARBContext && !getRendererQuirks().exist( GLRendererQuirks.NoARBCreateContext ) ) { + if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) { // initial ARB context creation contextHandle = createContextARB(shareWithHandle, true); createContextARBTried=true; @@ -345,8 +362,7 @@ public class WindowsWGLContext extends GLContextImpl { } else if (DEBUG) { System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+ ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+ - ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable+ - ", disableOpenGLARBContext "+GLProfile.disableOpenGLARBContext); + ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable); } } } else { @@ -368,7 +384,7 @@ public class WindowsWGLContext extends GLContextImpl { // otherwise context of similar profile but different creation method may not be share-able. WGL.wglMakeCurrent(0, 0); WGL.wglDeleteContext(temp_ctx); - throw new GLException(getThreadName()+": WindowsWGLContex.createContextImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.0.1). Requested: "+glCaps.getGLProfile()+", current: "+getGLVersion()); + throw new GLException(getThreadName()+": WindowsWGLContex.createContextImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.1). Requested: "+glCaps.getGLProfile()+", current: "+getGLVersion()); } if(DEBUG) { System.err.println("WindowsWGLContext.createContext ARB not used, fall back to !ARB context "+getGLVersion()); @@ -400,20 +416,18 @@ public class WindowsWGLContext extends GLContextImpl { @Override protected void makeCurrentImpl() throws GLException { - if (WGL.wglGetCurrentContext() != contextHandle) { - if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { + if ( !wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) { throw new GLException("Error making context " + toHexString(contextHandle) + " current on Thread " + getThreadName() + ", drawableWrite " + toHexString(drawable.getHandle()) + ", drawableRead "+ toHexString(drawableRead.getHandle()) + ", werr: " + GDI.GetLastError() + ", " + this); } - } } @Override protected void releaseImpl() throws GLException { - if (!wglMakeContextCurrent(0, 0, 0)) { + if ( !wglReleaseContext() ) { throw new GLException("Error freeing OpenGL context, werr: " + GDI.GetLastError()); } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java index 00b048e38..81f14dfab 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java @@ -40,16 +40,15 @@ package jogamp.opengl.windows.wgl; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; import com.jogamp.common.util.PropertyAccess; import jogamp.nativewindow.windows.GDI; import jogamp.opengl.Debug; import jogamp.opengl.GLDrawableImpl; -import jogamp.opengl.GLDynamicLookupHelper; public abstract class WindowsWGLDrawable extends GLDrawableImpl { @@ -105,9 +104,4 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } } } - - @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper() { - return getFactoryImpl().getGLDynamicLookupHelper(0); - } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index fa052d784..932c81f5d 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -48,20 +48,20 @@ import java.util.Collection; import java.util.HashMap; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.WrappedSurface; import jogamp.nativewindow.windows.GDI; @@ -80,11 +80,14 @@ import jogamp.opengl.SharedResourceRunner; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; +import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; import com.jogamp.nativewindow.windows.WindowsGraphicsDevice; import com.jogamp.opengl.GLExtensions; import com.jogamp.opengl.GLRendererQuirks; public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { + private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG; + /** * Bug 1036: NVidia Windows Driver 'Threaded optimization' workaround. * <p> @@ -228,7 +231,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) { return windowsWGLDynamicLookupHelper; } @@ -275,7 +278,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean isValid() { + public final boolean isAvailable() { return null != context; } @Override @@ -287,7 +290,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { @Override final public GLContextImpl getContext() { return context; } @Override - public GLRendererQuirks getRendererQuirks() { + public GLRendererQuirks getRendererQuirks(final GLProfile glp) { return null != context ? context.getRendererQuirks() : null; } @@ -303,12 +306,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { sharedMap.clear(); } @Override - public SharedResourceRunner.Resource mapPut(final String connection, final SharedResourceRunner.Resource resource) { - return sharedMap.put(connection, resource); + public SharedResourceRunner.Resource mapPut(final AbstractGraphicsDevice device, final SharedResourceRunner.Resource resource) { + return sharedMap.put(device.getConnection(), resource); } @Override - public SharedResourceRunner.Resource mapGet(final String connection) { - return sharedMap.get(connection); + public SharedResourceRunner.Resource mapGet(final AbstractGraphicsDevice device) { + return sharedMap.get(device.getConnection()); } @Override public Collection<SharedResourceRunner.Resource> mapValues() { @@ -318,65 +321,83 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean isDeviceSupported(final String connection) { + public boolean isDeviceSupported(final AbstractGraphicsDevice device) { return true; } @Override - public SharedResourceRunner.Resource createSharedResource(final String connection) { - final WindowsGraphicsDevice sharedDevice = new WindowsGraphicsDevice(connection, AbstractGraphicsDevice.DEFAULT_UNIT); - sharedDevice.lock(); + public SharedResourceRunner.Resource createSharedResource(final AbstractGraphicsDevice adevice) { + final WindowsGraphicsDevice device = new WindowsGraphicsDevice(adevice.getConnection(), adevice.getUnitID()); + GLContextImpl context = null; + boolean contextIsCurrent = false; + device.lock(); try { - final AbstractGraphicsScreen absScreen = new DefaultGraphicsScreen(sharedDevice, 0); - final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); + final AbstractGraphicsScreen absScreen = new DefaultGraphicsScreen(device, 0); + final GLProfile glp = GLProfile.get(device, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); if (null == glp) { - throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice); + throw new GLException("Couldn't get default GLProfile for device: "+device); } final GLCapabilitiesImmutable caps = new GLCapabilities(glp); - final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64)); - sharedDrawable.setRealized(true); + final GLDrawableImpl drawable = createOnscreenDrawableImpl(createDummySurfaceImpl(device, false, caps, caps, null, 64, 64)); + drawable.setRealized(true); - final GLContextImpl sharedContext = (GLContextImpl) sharedDrawable.createContext(null); - if (null == sharedContext) { - throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable); + context = (GLContextImpl) drawable.createContext(null); + if (null == context) { + throw new GLException("Couldn't create shared context for drawable: "+drawable); } - boolean hasARBPixelFormat; - boolean hasARBMultisample; - boolean hasARBPBuffer; - boolean hasARBReadDrawableAvailable; - sharedContext.makeCurrent(); - try { - hasARBPixelFormat = sharedContext.isExtensionAvailable(WGL_ARB_pixel_format); - hasARBMultisample = sharedContext.isExtensionAvailable(WGL_ARB_multisample); - hasARBPBuffer = sharedContext.isExtensionAvailable(GLExtensions.ARB_pbuffer); - hasARBReadDrawableAvailable = sharedContext.isExtensionAvailable(WGL_ARB_make_current_read) && - sharedContext.isFunctionAvailable(wglMakeContextCurrent); - } finally { - sharedContext.release(); + contextIsCurrent = GLContext.CONTEXT_NOT_CURRENT != context.makeCurrent(); + + final boolean allowsSurfacelessCtx; + final boolean hasARBPixelFormat; + final boolean hasARBMultisample; + final boolean hasARBPBuffer; + final boolean hasARBReadDrawableAvailable; + if( contextIsCurrent ) { + if( context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 ) { + allowsSurfacelessCtx = probeSurfacelessCtx(context, true /* restoreDrawable */); + } else { + setNoSurfacelessCtxQuirk(context); + allowsSurfacelessCtx = false; + } + hasARBPixelFormat = context.isExtensionAvailable(WGL_ARB_pixel_format); + hasARBMultisample = context.isExtensionAvailable(WGL_ARB_multisample); + hasARBPBuffer = context.isExtensionAvailable(GLExtensions.ARB_pbuffer); + hasARBReadDrawableAvailable = context.isExtensionAvailable(WGL_ARB_make_current_read) && + context.isFunctionAvailable(wglMakeContextCurrent); + } else { + allowsSurfacelessCtx = false; + hasARBPixelFormat = false; + hasARBMultisample = false; + hasARBPBuffer = false; + hasARBReadDrawableAvailable = false; } - if (DEBUG) { - System.err.println("SharedDevice: " + sharedDevice); + if ( DEBUG_SHAREDCTX ) { + System.err.println("SharedDevice: " + device); System.err.println("SharedScreen: " + absScreen); - System.err.println("SharedContext: " + sharedContext); + System.err.println("SharedContext: " + context + ", madeCurrent " + contextIsCurrent); + System.err.println(" allowsSurfacelessCtx "+allowsSurfacelessCtx); System.err.println("pixelformat: " + hasARBPixelFormat); System.err.println("multisample: " + hasARBMultisample); System.err.println("pbuffer: " + hasARBPBuffer); System.err.println("readDrawable: " + hasARBReadDrawableAvailable); } - return new SharedResource(sharedDevice, absScreen, sharedDrawable, sharedContext, + return new SharedResource(device, absScreen, drawable, context, hasARBPixelFormat, hasARBMultisample, hasARBPBuffer, hasARBReadDrawableAvailable); } catch (final Throwable t) { - throw new GLException("WindowsWGLDrawableFactory - Could not initialize shared resources for "+connection, t); + throw new GLException("WindowsWGLDrawableFactory - Could not initialize shared resources for "+adevice, t); } finally { - sharedDevice.unlock(); + if ( contextIsCurrent ) { + context.release(); + } + device.unlock(); } } @Override public void releaseSharedResource(final SharedResourceRunner.Resource shared) { final SharedResource sr = (SharedResource) shared; - if (DEBUG) { + if ( DEBUG_SHAREDCTX ) { System.err.println("Shutdown Shared:"); System.err.println("Device : " + sr.device); System.err.println("Screen : " + sr.screen); @@ -555,6 +576,13 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override + public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { + chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); + return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new GenericUpstreamSurfacelessHook(width, height)); + } + + @Override protected final ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final WindowsGraphicsDevice device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID()); final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java index 2285ae996..d13e4ddad 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java @@ -28,8 +28,10 @@ package jogamp.opengl.windows.wgl; -import jogamp.opengl.*; -import java.util.*; +import java.util.ArrayList; +import java.util.List; + +import jogamp.opengl.DesktopGLDynamicLibraryBundleInfo; public final class WindowsWGLDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryBundleInfo { protected WindowsWGLDynamicLibraryBundleInfo() { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 5785f8041..f88718d1b 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -38,16 +38,17 @@ import java.nio.IntBuffer; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; - +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; + +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.MutableGraphicsConfiguration; import com.jogamp.opengl.GLRendererQuirks; @@ -226,6 +227,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio public final boolean isDetermined() { return isDetermined; } public final PIXELFORMATDESCRIPTOR getPixelFormat() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).getPFD() : null; } + /** FIXME: NPE ..*/ public final int getPixelFormatID() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).getPFDID() : 0; } public final boolean isChoosenByARB() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).isSetByARB() : false; } @@ -281,7 +283,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio System.err.println("GetPixelFormatAttribivARB: Failed - HDC 0x" + Long.toHexString(hdc) + ", value "+iresults.get(0)+ ", LastError: " + GDI.GetLastError()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return 0; } @@ -290,7 +292,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio if(DEBUG) { System.err.println("GetPixelFormatAttribivARB: No formats - HDC 0x" + Long.toHexString(hdc) + ", LastError: " + GDI.GetLastError()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return pfdIDCount; @@ -351,7 +353,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio iattributes, accelerationMode, null) ) { if (DEBUG) { System.err.println("wglChoosePixelFormatARB: GLCapabilities2AttribList failed: " + GDI.GetLastError()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return null; } @@ -365,7 +367,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio pformatsTmp, numFormatsTmp) ) { if (DEBUG) { System.err.println("wglChoosePixelFormatARB: wglChoosePixelFormatARB failed: " + GDI.GetLastError()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return null; } @@ -508,7 +510,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio caps.getAccumGreenBits() > 0 || caps.getAccumBlueBits() > 0 || caps.getAccumAlphaBits() > 0 ) { - final GLRendererQuirks sharedQuirks = sharedResource.getRendererQuirks(); + final GLRendererQuirks sharedQuirks = sharedResource.getRendererQuirks(null); if ( !usePBuffer || null==sharedQuirks || !sharedQuirks.exist(GLRendererQuirks.NoPBufferWithAccum) ) { iattributes.put(niattribs++, WGLExt.WGL_ACCUM_BITS_ARB); iattributes.put(niattribs++, ( caps.getAccumRedBits() + diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index ea9b86712..21eb6b8f3 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -33,23 +33,25 @@ package jogamp.opengl.windows.wgl; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; - +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; + +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.GLRendererQuirks; @@ -131,7 +133,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat List<GLCapabilitiesImmutable> availableCaps = null; final GLContext sharedContext; - if ( factory.hasRendererQuirk(device, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) { + if ( factory.hasRendererQuirk(device, null, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) { sharedContext = sharedResource.getContext(); if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) { throw new GLException("Could not make Shared Context current: "+device); @@ -221,7 +223,11 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat try { final long hdc = ns.getSurfaceHandle(); if (0 == hdc) { - throw new GLException("Error: HDC is null"); + if( !(ns instanceof ProxySurface) || + !((ProxySurface)ns).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS ) ) { + throw new GLException(String.format("non-surfaceless drawable has zero-handle (HDC): %s", ns.toString())); + } + return; // NOP .. will reach ns.unlockSurface() } final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) ns.getGraphicsConfiguration(); @@ -299,7 +305,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat final AbstractGraphicsDevice device = config.getScreen().getDevice(); final WindowsWGLDrawableFactory.SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResourceImpl(device); final GLContext sharedContext; - if ( factory.hasRendererQuirk(device, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) { + if ( factory.hasRendererQuirk(device, null, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) { sharedContext = sharedResource.getContext(); if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) { throw new GLException("Could not make Shared Context current: "+device); @@ -417,7 +423,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat if (null == pformats) { if (DEBUG) { System.err.println("updateGraphicsConfigurationARB: failed, return false"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } @@ -431,7 +437,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat if( null == availableCaps || 0 == availableCaps.size() ) { if (DEBUG) { System.err.println("updateGraphicsConfigurationARB: wglARBPFIDs2GLCapabilities failed with " + pformats.length + " pfd ids"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } @@ -453,7 +459,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } if ( 0 > chosenIndex ) { if (DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } @@ -603,7 +609,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat if ( 0 > chosenIndex ) { if (DEBUG) { System.err.println("updateGraphicsConfigurationGDI: failed, return false"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java index 9e784ad73..83e4ae472 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java @@ -45,21 +45,21 @@ import jogamp.opengl.GLGraphicsConfigurationFactory; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.GraphicsConfigurationFactory; - -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; + +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLException; import jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory; import jogamp.opengl.windows.wgl.WindowsWGLGraphicsConfiguration; -import javax.media.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLDrawableFactory; public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFactory { public static void registerFactory() { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java index 195096110..b8d803338 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java @@ -35,7 +35,7 @@ package jogamp.opengl.x11.glx; import java.nio.IntBuffer; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GLException; import jogamp.opengl.Debug; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index 7040621be..fab5895e8 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -42,13 +42,13 @@ package jogamp.opengl.x11.glx; import java.nio.IntBuffer; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.WrappedSurface; import jogamp.opengl.GLContextShareSet; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java index d2f967a5c..bce5b6294 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java @@ -41,11 +41,11 @@ package jogamp.opengl.x11.glx; import java.nio.IntBuffer; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.WrappedSurface; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java index 36e791641..740289fa6 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java @@ -30,11 +30,11 @@ package jogamp.opengl.x11.glx; import jogamp.nativewindow.x11.XVisualInfo; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; public class X11GLCapabilities extends GLCapabilities { final private XVisualInfo xVisualInfo; // maybe null if !onscreen diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 9631dbb5b..19056a73b 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -45,13 +45,13 @@ import java.nio.IntBuffer; import java.util.HashMap; import java.util.Map; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.x11.X11Lib; import jogamp.nativewindow.x11.X11Util; @@ -59,6 +59,7 @@ import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableImpl; import jogamp.opengl.GLXExtensions; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.VersionNumber; import com.jogamp.gluegen.runtime.ProcAddressTable; @@ -186,11 +187,32 @@ public class X11GLXContext extends GLContextImpl { return res; } + private final boolean glXReleaseContext(final long dpy) { + boolean res = false; + + try { + if ( isGLXVersionGreaterEqualOneThree() ) { + // System.err.println(getThreadName() +": X11GLXContext.releaseCurrent: obj " + toHexString(hashCode()) + " / ctx "+toHexString(contextHandle)+": ctx "+toHexString(ctx)+" - switch"); + res = GLX.glXMakeContextCurrent(dpy, 0, 0, 0); + } else { + // System.err.println(getThreadName() +": X11GLXContext.releaseCurrent: obj " + toHexString(hashCode()) + " / ctx "+toHexString(contextHandle)+": ctx "+toHexString(ctx)+" - switch"); + res = GLX.glXMakeCurrent(dpy, 0, 0); + } + } catch (final RuntimeException re) { + if( DEBUG_TRACE_SWITCH ) { + System.err.println(getThreadName()+": Warning: X11GLXContext.glXReleaseContext failed: "+re+", with "+ + "dpy "+toHexString(dpy)); + re.printStackTrace(); + } + } + return res; + } + @Override protected void destroyContextARBImpl(final long ctx) { final long display = drawable.getNativeSurface().getDisplayHandle(); - glXMakeContextCurrent(display, 0, 0, 0); + glXReleaseContext(display); GLX.glXDestroyContext(display, ctx); } private static final int ctx_arb_attribs_idx_major = 0; @@ -220,8 +242,6 @@ public class X11GLXContext extends GLContextImpl { final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; - long ctx=0; - final IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom); attribs.put(ctx_arb_attribs_idx_major + 1, major); attribs.put(ctx_arb_attribs_idx_minor + 1, minor); @@ -249,6 +269,7 @@ public class X11GLXContext extends GLContextImpl { final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice device = config.getScreen().getDevice(); final long display = device.getHandle(); + long ctx=0; try { // critical path, a remote display might not support this command, @@ -258,8 +279,8 @@ public class X11GLXContext extends GLContextImpl { ctx = _glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs); } catch (final RuntimeException re) { if(DEBUG) { - final Throwable t = new Throwable(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); - t.printStackTrace(); + System.err.println(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation")); + ExceptionUtils.dumpThrowable("", re); } } @@ -269,7 +290,7 @@ public class X11GLXContext extends GLContextImpl { System.err.println(getThreadName()+": X11GLXContext.createContextARBImpl couldn't make current "+getGLVersion(major, minor, ctp, "@creation")); } // release & destroy - glXMakeContextCurrent(display, 0, 0, 0); + glXReleaseContext(display); GLX.glXDestroyContext(display, ctx); ctx = 0; } else if (DEBUG) { @@ -314,7 +335,10 @@ public class X11GLXContext extends GLContextImpl { throw new GLException(getThreadName()+": Error making temp context(0) current: display "+toHexString(display)+", context "+toHexString(contextHandle)+", drawable "+drawable); } if( !setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */) ) { // use GL_VERSION - throw new InternalError("setGLFunctionAvailability !strictMatch failed"); + glXReleaseContext(display); // release temp context + GLX.glXDestroyContext(display, contextHandle); + contextHandle = 0; + throw new InternalError("setGLFunctionAvailability !strictMatch failed.1"); } isDirect = GLX.glXIsDirect(display, contextHandle); if (DEBUG) { @@ -345,13 +369,17 @@ public class X11GLXContext extends GLContextImpl { if ( !glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), temp_ctx) ) { throw new GLException(getThreadName()+": Error making temp context(1) current: display "+toHexString(display)+", context "+toHexString(temp_ctx)+", drawable "+drawable); } - setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */); // use GL_VERSION - glXMakeContextCurrent(display, 0, 0, 0); // release temp context + if( !setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */) ) { // use GL_VERSION + glXReleaseContext(display); // release temp context + GLX.glXDestroyContext(display, temp_ctx); + throw new InternalError("setGLFunctionAvailability !strictMatch failed.2"); + } + glXReleaseContext(display); // release temp context if( !createContextARBTried ) { // is*Available calls are valid since setGLFunctionAvailability(..) was called final boolean isProcCreateContextAttribsARBAvailable = isFunctionAvailable("glXCreateContextAttribsARB"); final boolean isExtARBCreateContextAvailable = isExtensionAvailable("GLX_ARB_create_context"); - if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable && !GLProfile.disableOpenGLARBContext ) { + if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) { // initial ARB context creation contextHandle = createContextARB(shareWithHandle, direct); createContextARBTried=true; @@ -365,8 +393,7 @@ public class X11GLXContext extends GLContextImpl { } else if( DEBUG ) { System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+ ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+ - ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable+ - ", disableOpenGLARBContext "+GLProfile.disableOpenGLARBContext); + ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable); } } } else { @@ -375,7 +402,7 @@ public class X11GLXContext extends GLContextImpl { if( 0 != contextHandle ) { if( 0 != temp_ctx ) { - glXMakeContextCurrent(display, 0, 0, 0); + glXReleaseContext(display); GLX.glXDestroyContext(display, temp_ctx); if ( !glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) { throw new GLException(getThreadName()+": Cannot make previous verified context current"); @@ -385,9 +412,9 @@ public class X11GLXContext extends GLContextImpl { if( glp.isGL3() && createContextARBTried ) { // We shall not allow context creation >= GL3 w/ non ARB methods if ARB is used, // otherwise context of similar profile but different creation method may not be share-able. - glXMakeContextCurrent(display, 0, 0, 0); + glXReleaseContext(display); GLX.glXDestroyContext(display, temp_ctx); - throw new GLException(getThreadName()+": X11GLXContext.createContextImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.0.1). Requested: "+glp+", current: "+getGLVersion()); + throw new GLException(getThreadName()+": X11GLXContext.createContextImpl ARB n/a but required, profile > GL2 requested (OpenGL >= 3.1). Requested: "+glp+", current: "+getGLVersion()); } if(DEBUG) { @@ -397,7 +424,7 @@ public class X11GLXContext extends GLContextImpl { // continue with temp context contextHandle = temp_ctx; if ( !glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) { - glXMakeContextCurrent(display, 0, 0, 0); + glXReleaseContext(display); GLX.glXDestroyContext(display, temp_ctx); throw new GLException(getThreadName()+": Error making context(1) current: display "+toHexString(display)+", context "+toHexString(contextHandle)+", drawable "+drawable); } @@ -416,23 +443,20 @@ public class X11GLXContext extends GLContextImpl { @Override protected void makeCurrentImpl() throws GLException { final long dpy = drawable.getNativeSurface().getDisplayHandle(); - - if (GLX.glXGetCurrentContext() != contextHandle) { - if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { - throw new GLException("Error making context " + toHexString(contextHandle) + - " current on Thread " + getThreadName() + - " with display " + toHexString(dpy) + - ", drawableWrite " + toHexString(drawable.getHandle()) + - ", drawableRead "+ toHexString(drawableRead.getHandle()) + - " - " + this); - } + if ( !glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) { + throw new GLException("Error making context " + toHexString(contextHandle) + + " current on Thread " + getThreadName() + + " with display " + toHexString(dpy) + + ", drawableWrite " + toHexString(drawable.getHandle()) + + ", drawableRead "+ toHexString(drawableRead.getHandle()) + + " - " + this); } } @Override protected void releaseImpl() throws GLException { final long display = drawable.getNativeSurface().getDisplayHandle(); - if (!glXMakeContextCurrent(display, 0, 0, 0)) { + if ( !glXReleaseContext(display) ) { throw new GLException(getThreadName()+": Error freeing OpenGL context"); } } @@ -491,7 +515,7 @@ public class X11GLXContext extends GLContextImpl { x11Device.lock(); try{ if (DEBUG) { - System.err.println("GLX Version client version "+ GLXUtil.getClientVersionNumber()+ + System.err.println("GLX Version client "+ GLXUtil.getClientVersionNumber()+ ", server: "+ GLXUtil.getGLXServerVersionNumber(x11Device)); } if(((X11GLXDrawableFactory)drawable.getFactoryImpl()).isGLXVersionGreaterEqualOneOne(x11Device)) { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java index c29bc3bc3..86ce0d427 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java @@ -40,11 +40,10 @@ package jogamp.opengl.x11.glx; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLDrawableFactory; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLDrawableFactory; import jogamp.opengl.GLDrawableImpl; -import jogamp.opengl.GLDynamicLookupHelper; public abstract class X11GLXDrawable extends GLDrawableImpl { protected X11GLXDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { @@ -52,11 +51,6 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper() { - return getFactoryImpl().getGLDynamicLookupHelper(0); - } - - @Override protected void setRealizedImpl() { if(realized) { final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 60e4438d0..ecaf20d86 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -45,20 +45,20 @@ import java.util.Collection; import java.util.HashMap; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.WrappedSurface; import jogamp.nativewindow.x11.X11DummyUpstreamSurfaceHook; @@ -72,13 +72,16 @@ import jogamp.opengl.GLDynamicLookupHelper; import jogamp.opengl.GLGraphicsConfigurationUtil; import jogamp.opengl.SharedResourceRunner; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.VersionNumber; +import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; import com.jogamp.nativewindow.x11.X11GraphicsDevice; import com.jogamp.nativewindow.x11.X11GraphicsScreen; import com.jogamp.opengl.GLRendererQuirks; public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { + private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG; public static final VersionNumber versionOneZero = new VersionNumber(1, 0, 0); public static final VersionNumber versionOneOne = new VersionNumber(1, 1, 0); @@ -160,7 +163,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { + public final GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) { return x11GLXDynamicLookupHelper; } @@ -183,7 +186,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { SharedResource(final X11GraphicsDevice dev, final X11GraphicsScreen scrn, final GLDrawableImpl draw, final GLContextImpl ctx, - final VersionNumber glXServerVer, final String glXServerVendor, final boolean glXServerMultisampleAvail) { + final VersionNumber glXServerVer, final String glXServerVendor, + final boolean glXServerMultisampleAvail) { device = dev; screen = scrn; drawable = draw; @@ -197,7 +201,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { glXMultisampleAvailable = glXServerMultisampleAvail; } @Override - public final boolean isValid() { + public final boolean isAvailable() { return null != context; } @Override @@ -209,7 +213,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { @Override final public GLContextImpl getContext() { return context; } @Override - public GLRendererQuirks getRendererQuirks() { + public GLRendererQuirks getRendererQuirks(final GLProfile glp) { return null != context ? context.getRendererQuirks() : null; } @@ -228,12 +232,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { sharedMap.clear(); } @Override - public SharedResourceRunner.Resource mapPut(final String connection, final SharedResourceRunner.Resource resource) { - return sharedMap.put(connection, resource); + public SharedResourceRunner.Resource mapPut(final AbstractGraphicsDevice device, final SharedResourceRunner.Resource resource) { + return sharedMap.put(device.getConnection(), resource); } @Override - public SharedResourceRunner.Resource mapGet(final String connection) { - return sharedMap.get(connection); + public SharedResourceRunner.Resource mapGet(final AbstractGraphicsDevice device) { + return sharedMap.get(device.getConnection()); } @Override public Collection<SharedResourceRunner.Resource> mapValues() { @@ -241,9 +245,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean isDeviceSupported(final String connection) { + public boolean isDeviceSupported(final AbstractGraphicsDevice device) { final boolean res; - final X11GraphicsDevice x11Device = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); + final X11GraphicsDevice x11Device = new X11GraphicsDevice(X11Util.openDisplay(device.getConnection()), device.getUnitID(), true /* owner */); x11Device.lock(); try { res = GLXUtil.isGLXAvailableOnServer(x11Device); @@ -258,51 +262,56 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public SharedResourceRunner.Resource createSharedResource(final String connection) { - final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); - sharedDevice.lock(); + public SharedResourceRunner.Resource createSharedResource(final AbstractGraphicsDevice adevice) { + final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(adevice.getConnection()), adevice.getUnitID(), true /* owner */); + GLContextImpl context = null; + boolean contextIsCurrent = false; + device.lock(); try { - final X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, sharedDevice.getDefaultScreen()); + final X11GraphicsScreen screen = new X11GraphicsScreen(device, device.getDefaultScreen()); - GLXUtil.initGLXClientDataSingleton(sharedDevice); - final String glXServerVendorName = GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_VENDOR); - final boolean glXServerMultisampleAvailable = GLXUtil.isMultisampleAvailable(GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_EXTENSIONS)); + GLXUtil.initGLXClientDataSingleton(device); + final String glXServerVendorName = GLX.glXQueryServerString(device.getHandle(), 0, GLX.GLX_VENDOR); + final boolean glXServerMultisampleAvailable = GLXUtil.isMultisampleAvailable(GLX.glXQueryServerString(device.getHandle(), 0, GLX.GLX_EXTENSIONS)); - final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); + final GLProfile glp = GLProfile.get(device, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); if (null == glp) { - throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice); + throw new GLException("Couldn't get default GLProfile for device: "+device); } final GLCapabilitiesImmutable caps = new GLCapabilities(glp); - final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64)); - sharedDrawable.setRealized(true); - final X11GLCapabilities chosenCaps = (X11GLCapabilities) sharedDrawable.getChosenGLCapabilities(); + final GLDrawableImpl drawable = createOnscreenDrawableImpl(createDummySurfaceImpl(device, false, caps, caps, null, 64, 64)); + drawable.setRealized(true); + final X11GLCapabilities chosenCaps = (X11GLCapabilities) drawable.getChosenGLCapabilities(); final boolean glxForcedOneOne = !chosenCaps.hasFBConfig(); final VersionNumber glXServerVersion; if( glxForcedOneOne ) { glXServerVersion = versionOneOne; } else { - glXServerVersion = GLXUtil.getGLXServerVersionNumber(sharedDevice); + glXServerVersion = GLXUtil.getGLXServerVersionNumber(device); } - final GLContextImpl sharedContext = (GLContextImpl) sharedDrawable.createContext(null); - if (null == sharedContext) { - throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable); + context = (GLContextImpl) drawable.createContext(null); + if (null == context) { + throw new GLException("Couldn't create shared context for drawable: "+drawable); } + contextIsCurrent = GLContext.CONTEXT_NOT_CURRENT != context.makeCurrent(); - boolean madeCurrent = false; - sharedContext.makeCurrent(); - try { - madeCurrent = sharedContext.isCurrent(); - } finally { - sharedContext.release(); + final boolean allowsSurfacelessCtx; + if( contextIsCurrent && context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 ) { + allowsSurfacelessCtx = probeSurfacelessCtx(context, true /* restoreDrawable */); + } else { + setNoSurfacelessCtxQuirk(context); + allowsSurfacelessCtx = false; } - if( sharedContext.hasRendererQuirk( GLRendererQuirks.DontCloseX11Display ) ) { + + if( context.hasRendererQuirk( GLRendererQuirks.DontCloseX11Display ) ) { X11Util.markAllDisplaysUnclosable(); } - if (DEBUG) { - System.err.println("SharedDevice: " + sharedDevice); - System.err.println("SharedScreen: " + sharedScreen); - System.err.println("SharedContext: " + sharedContext + ", madeCurrent " + madeCurrent); + if ( DEBUG_SHAREDCTX ) { + System.err.println("SharedDevice: " + device); + System.err.println("SharedScreen: " + screen); + System.err.println("SharedContext: " + context + ", madeCurrent " + contextIsCurrent); + System.err.println(" allowsSurfacelessCtx "+allowsSurfacelessCtx); System.err.println("GLX Server Vendor: " + glXServerVendorName); System.err.println("GLX Server Version: " + glXServerVersion + ", forced "+glxForcedOneOne); System.err.println("GLX Server Multisample: " + glXServerMultisampleAvailable); @@ -310,26 +319,29 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { System.err.println("GLX Client Version: " + GLXUtil.getClientVersionNumber()); System.err.println("GLX Client Multisample: " + GLXUtil.isClientMultisampleAvailable()); } - return new SharedResource(sharedDevice, sharedScreen, sharedDrawable, sharedContext, + return new SharedResource(device, screen, drawable, context, glXServerVersion, glXServerVendorName, glXServerMultisampleAvailable && GLXUtil.isClientMultisampleAvailable()); } catch (final Throwable t) { - throw new GLException("X11GLXDrawableFactory - Could not initialize shared resources for "+connection, t); + throw new GLException("X11GLXDrawableFactory - Could not initialize shared resources for "+adevice, t); } finally { - sharedDevice.unlock(); + if ( contextIsCurrent ) { + context.release(); + } + device.unlock(); } } @Override public void releaseSharedResource(final SharedResourceRunner.Resource shared) { final SharedResource sr = (SharedResource) shared; - if (DEBUG) { + if ( DEBUG_SHAREDCTX ) { System.err.println("Shutdown Shared:"); System.err.println("Device : " + sr.device); System.err.println("Screen : " + sr.screen); System.err.println("Drawable: " + sr.drawable); System.err.println("CTX : " + sr.context); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if (null != sr.context) { @@ -524,6 +536,13 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override + public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { + chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); + return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new GenericUpstreamSurfacelessHook(width, height)); + } + + @Override protected final ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); final X11GraphicsScreen screen = new X11GraphicsScreen(device, screenIdx); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java index 0e91a6a65..bfe36dbc8 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java @@ -28,8 +28,10 @@ package jogamp.opengl.x11.glx; -import jogamp.opengl.*; -import java.util.*; +import java.util.ArrayList; +import java.util.List; + +import jogamp.opengl.DesktopGLDynamicLibraryBundleInfo; public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryBundleInfo { protected X11GLXDynamicLibraryBundleInfo() { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java index 5f6a6b344..86349b645 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java @@ -37,17 +37,17 @@ import java.nio.IntBuffer; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.opengl.DefaultGLCapabilitiesChooser; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.x11.X11Lib; import jogamp.nativewindow.x11.XRenderDirectFormat; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java index 44479acc0..4dc2d7e0b 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -33,22 +33,23 @@ package jogamp.opengl.x11.glx; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.VisualIDHolder.VIDType; -import javax.media.opengl.DefaultGLCapabilitiesChooser; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; - +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.VisualIDHolder.VIDType; +import com.jogamp.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; + +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.nativewindow.x11.X11GraphicsDevice; @@ -375,7 +376,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF if ( 0 > chosenIndex ) { if (DEBUG) { System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: failed, return null"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return null; } @@ -472,7 +473,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF if ( 0 > chosenIndex ) { if (DEBUG) { System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: failed, return null"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return null; } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java index 866662950..670f6c246 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java @@ -40,10 +40,10 @@ package jogamp.opengl.x11.glx; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; public class X11OnscreenGLXDrawable extends X11GLXDrawable { /** GLXWindow can't be made current on AWT with NVidia driver, hence disabled for now */ diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java index 21ad06020..b961c97a2 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java @@ -42,13 +42,13 @@ package jogamp.opengl.x11.glx; import java.nio.IntBuffer; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.MutableSurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.MutableSurface; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; import com.jogamp.common.nio.Buffers; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java index e217e1c2a..17e2cb219 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java @@ -40,13 +40,13 @@ package jogamp.opengl.x11.glx; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.MutableSurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.MutableSurface; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; import jogamp.nativewindow.x11.X11Lib; import jogamp.nativewindow.x11.XVisualInfo; diff --git a/src/jogl/native/EGLContext.c b/src/jogl/native/EGLContext.c new file mode 100644 index 000000000..7bf60b850 --- /dev/null +++ b/src/jogl/native/EGLContext.c @@ -0,0 +1,39 @@ +#include <jni.h> +#include <stdlib.h> +#include <string.h> + +#include <assert.h> + +#include <stdio.h> /* android */ +#include <gluegen_stdint.h> +#include <gluegen_stddef.h> +#include <EGL/egl.h> + +/* Java->C glue code: + * Java package: jogamp.opengl.egl.EGLContext + * Java method: long dispatch_eglGetProcAddress(java.lang.String procname) + * C function: __EGLFuncPtr eglGetProcAddress(const char * procname) + */ +JNIEXPORT jlong JNICALL +Java_jogamp_opengl_egl_EGLContext_dispatch_1eglGetProcAddress0__Ljava_lang_String_2J(JNIEnv *env, jclass _unused, jstring procname, jlong procAddress) { + typedef __EGLFuncPtr (EGLAPIENTRY*_local_PFNEGLGETPROCADDRESSPROC)(const char * procname); + _local_PFNEGLGETPROCADDRESSPROC ptr_eglGetProcAddress; + const char* _strchars_procname = NULL; + __EGLFuncPtr _res; + if ( NULL != procname ) { + _strchars_procname = (*env)->GetStringUTFChars(env, procname, (jboolean*)NULL); + if ( NULL == _strchars_procname ) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Failed to get UTF-8 chars for argument \"procname\" in native dispatcher for \"dispatch_eglGetProcAddress\""); + return 0; + } + } + ptr_eglGetProcAddress = (_local_PFNEGLGETPROCADDRESSPROC) (intptr_t) procAddress; + assert(ptr_eglGetProcAddress != NULL); + _res = (* ptr_eglGetProcAddress) ((const char *) _strchars_procname); + if ( NULL != procname ) { + (*env)->ReleaseStringUTFChars(env, procname, _strchars_procname); + } + return (jlong) (intptr_t) _res; +} + diff --git a/src/jogl/native/libav/ffmpeg_impl_template.c b/src/jogl/native/libav/ffmpeg_impl_template.c index 3077070db..ca283ef52 100644 --- a/src/jogl/native/libav/ffmpeg_impl_template.c +++ b/src/jogl/native/libav/ffmpeg_impl_template.c @@ -535,7 +535,8 @@ JNIEXPORT jint JNICALL FF_FUNC(getSwResampleMajorVersionCC0) } JNIEXPORT jlong JNICALL FF_FUNC(createInstance0) - (JNIEnv *env, jobject instance, jobject ffmpegMediaPlayer, jboolean verbose) + (JNIEnv *env, jobject instance, jobject ffmpegMediaPlayer, + jboolean enableAvResample, jboolean enableSwResample, jboolean verbose) { FFMPEGToolBasicAV_t * pAV = calloc(1, sizeof(FFMPEGToolBasicAV_t)); if(NULL==pAV) { @@ -545,12 +546,12 @@ JNIEXPORT jlong JNICALL FF_FUNC(createInstance0) pAV->avcodecVersion = sp_avcodec_version(); pAV->avformatVersion = sp_avformat_version(); pAV->avutilVersion = sp_avutil_version(); - if(HAS_FUNC(sp_avresample_version)) { + if(HAS_FUNC(sp_avresample_version) && enableAvResample) { pAV->avresampleVersion = sp_avresample_version(); } else { pAV->avresampleVersion = 0; } - if(HAS_FUNC(sp_swresample_version)) { + if(HAS_FUNC(sp_swresample_version) && enableSwResample) { pAV->swresampleVersion = sp_swresample_version(); } else { pAV->swresampleVersion = 0; diff --git a/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c b/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c new file mode 100644 index 000000000..d1657d0c6 --- /dev/null +++ b/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c @@ -0,0 +1,33 @@ +/** + * Copyright 2013 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +#include "jogamp_opengl_util_av_impl_FFMPEGv11Natives.h" + +#define FF_FUNC(METHOD) Java_jogamp_opengl_util_av_impl_FFMPEGv11Natives_ ## METHOD + +#include "ffmpeg_impl_template.c" diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/AbstractGraphicsConfiguration.java index 48f72e574..684f1f86a 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/AbstractGraphicsConfiguration.java @@ -38,7 +38,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** A marker interface describing a graphics configuration, visual, or pixel format in a toolkit-independent manner. */ diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/AbstractGraphicsDevice.java index 31b64269f..7b630b1ea 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/AbstractGraphicsDevice.java @@ -38,7 +38,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; import jogamp.nativewindow.Debug; @@ -109,13 +109,13 @@ public interface AbstractGraphicsDevice extends Cloneable { public long getHandle(); /** - * Optionally locking the device, utilizing eg {@link javax.media.nativewindow.ToolkitLock#lock()}. + * Optionally locking the device, utilizing eg {@link com.jogamp.nativewindow.ToolkitLock#lock()}. * The lock implementation must be recursive. */ public void lock(); /** - * Optionally unlocking the device, utilizing eg {@link javax.media.nativewindow.ToolkitLock#unlock()}. + * Optionally unlocking the device, utilizing eg {@link com.jogamp.nativewindow.ToolkitLock#unlock()}. * The lock implementation must be recursive. * * @throws RuntimeException in case the lock is not acquired by this thread. diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/AbstractGraphicsScreen.java index da8f12f3e..7767cf9e4 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/AbstractGraphicsScreen.java @@ -37,7 +37,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** A interface describing a graphics screen in a toolkit-independent manner. diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/com/jogamp/nativewindow/Capabilities.java index bf8952565..fa172b201 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/Capabilities.java @@ -38,7 +38,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** Specifies a set of capabilities that a window's rendering context must support, such as color depth per channel. It currently diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java b/src/nativewindow/classes/com/jogamp/nativewindow/CapabilitiesChooser.java index 1f4db7997..c33ff5a3f 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/CapabilitiesChooser.java @@ -37,7 +37,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; import java.util.List; diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java b/src/nativewindow/classes/com/jogamp/nativewindow/CapabilitiesImmutable.java index c496a1535..780d537b8 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/CapabilitiesImmutable.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; import com.jogamp.common.type.WriteCloneable; @@ -34,7 +34,7 @@ import com.jogamp.common.type.WriteCloneable; * Specifies an immutable set of capabilities that a window's rendering context * must support, such as color depth per channel. * - * @see javax.media.nativewindow.Capabilities + * @see com.jogamp.nativewindow.Capabilities */ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, Comparable<CapabilitiesImmutable> { diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultCapabilitiesChooser.java index d0c1a9b85..33c3f8458 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultCapabilitiesChooser.java @@ -38,7 +38,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; import java.util.List; diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsConfiguration.java index cae37c36c..d20a6824d 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsConfiguration.java @@ -30,7 +30,7 @@ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; import jogamp.nativewindow.Debug; @@ -98,7 +98,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics * The use case for setting the Capabilities at a later time is * a change or re-validation of capabilities. * </p> - * @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) + * @see com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) */ protected void setChosenCapabilities(final CapabilitiesImmutable capsChosen) { this.capabilitiesChosen = capsChosen; diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsDevice.java index ab9286b3f..070b6bb28 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsDevice.java @@ -31,7 +31,7 @@ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; import jogamp.nativewindow.NativeWindowFactoryImpl; @@ -119,7 +119,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice * </p> * * @see DefaultGraphicsDevice#DefaultGraphicsDevice(java.lang.String, long) - * @see DefaultGraphicsDevice#DefaultGraphicsDevice(java.lang.String, long, javax.media.nativewindow.ToolkitLock) + * @see DefaultGraphicsDevice#DefaultGraphicsDevice(java.lang.String, long, com.jogamp.nativewindow.ToolkitLock) */ @Override public final void lock() { @@ -138,7 +138,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice * </p> * * @see DefaultGraphicsDevice#DefaultGraphicsDevice(java.lang.String, long) - * @see DefaultGraphicsDevice#DefaultGraphicsDevice(java.lang.String, long, javax.media.nativewindow.ToolkitLock) + * @see DefaultGraphicsDevice#DefaultGraphicsDevice(java.lang.String, long, com.jogamp.nativewindow.ToolkitLock) */ @Override public final void unlock() { @@ -237,7 +237,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice * @return the used ToolkitLock * * @see DefaultGraphicsDevice#DefaultGraphicsDevice(java.lang.String, long) - * @see DefaultGraphicsDevice#DefaultGraphicsDevice(java.lang.String, long, javax.media.nativewindow.ToolkitLock) + * @see DefaultGraphicsDevice#DefaultGraphicsDevice(java.lang.String, long, com.jogamp.nativewindow.ToolkitLock) */ public final ToolkitLock getToolkitLock() { return toolkitLock; diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsScreen.java index 3ee775904..63c79af55 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsScreen.java @@ -30,7 +30,7 @@ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen { private final AbstractGraphicsDevice device; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java index e785af788..da088ab09 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java @@ -1,7 +1,7 @@ package com.jogamp.nativewindow; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; public class DelegatedUpstreamSurfaceHookMutableSize extends UpstreamSurfaceHookMutableSize { final UpstreamSurfaceHook upstream; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java index abcc166cb..22e99deaf 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java @@ -1,8 +1,8 @@ package com.jogamp.nativewindow; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; public class DelegatedUpstreamSurfaceHookWithSurfaceSize implements UpstreamSurfaceHook { final UpstreamSurfaceHook upstream; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/GenericUpstreamSurfacelessHook.java b/src/nativewindow/classes/com/jogamp/nativewindow/GenericUpstreamSurfacelessHook.java new file mode 100644 index 000000000..044aebc21 --- /dev/null +++ b/src/nativewindow/classes/com/jogamp/nativewindow/GenericUpstreamSurfacelessHook.java @@ -0,0 +1,88 @@ +/** + * Copyright 2014 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.nativewindow; + +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; + +import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; + +public class GenericUpstreamSurfacelessHook extends UpstreamSurfaceHookMutableSize { + /** + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getSurfaceWidth(ProxySurface)}, + * not the actual dummy surface width. + * The latter is platform specific and small + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getSurfaceHeight(ProxySurface)}, + * not the actual dummy surface height, + * The latter is platform specific and small + */ + public GenericUpstreamSurfacelessHook(final int width, final int height) { + super(width, height); + } + + @Override + public final void create(final ProxySurface s) { + final AbstractGraphicsDevice device = s.getGraphicsConfiguration().getScreen().getDevice(); + device.lock(); + try { + if(0 == device.getHandle()) { + device.open(); + s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE ); + } + if( 0 != s.getSurfaceHandle() ) { + throw new InternalError("Upstream surface not null: "+s); + } + s.addUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS | + ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE | + ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE ); + } finally { + device.unlock(); + } + } + + @Override + public final void destroy(final ProxySurface s) { + if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { + final AbstractGraphicsDevice device = s.getGraphicsConfiguration().getScreen().getDevice(); + if( !s.containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS ) ) { + throw new InternalError("Owns upstream surface, but not a valid zero surface: "+s); + } + if( 0 != s.getSurfaceHandle() ) { + throw new InternalError("Owns upstream valid zero surface, but non zero surface: "+s); + } + device.lock(); + try { + s.clearUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS | ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); + } finally { + device.unlock(); + } + } + } +} diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/GraphicsConfigurationFactory.java index 3f8113baa..929af054e 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/GraphicsConfigurationFactory.java @@ -31,9 +31,11 @@ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.ReflectionUtil; + import jogamp.nativewindow.Debug; import jogamp.nativewindow.DefaultGraphicsConfigurationFactoryImpl; @@ -226,7 +228,7 @@ public abstract class GraphicsConfigurationFactory { throw new IllegalArgumentException("Given capabilities class must implement CapabilitiesImmutable"); } if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); System.err.println("GraphicsConfigurationFactory.getFactory: "+deviceType.getName()+", "+capabilitiesType.getName()); dumpFactories(); } @@ -396,8 +398,8 @@ public abstract class GraphicsConfigurationFactory { * @throws NativeWindowException if any window system-specific errors caused * the selection of the graphics configuration to fail. * - * @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) - * @see javax.media.nativewindow.DefaultGraphicsConfiguration#setChosenCapabilities(Capabilities caps) + * @see com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) + * @see com.jogamp.nativewindow.DefaultGraphicsConfiguration#setChosenCapabilities(Capabilities caps) */ public final AbstractGraphicsConfiguration chooseGraphicsConfiguration(final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java index a137d46c3..4357233c4 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java @@ -27,9 +27,9 @@ */ package com.jogamp.nativewindow; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.DefaultGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.DefaultGraphicsConfiguration; public class MutableGraphicsConfiguration extends DefaultGraphicsConfiguration { public MutableGraphicsConfiguration(final AbstractGraphicsScreen screen, diff --git a/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java b/src/nativewindow/classes/com/jogamp/nativewindow/MutableSurface.java index a0db11ad9..7686f270b 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/MutableSurface.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** * Provides a {@link NativeSurface} with a mutable <code>surfaceHandle</code> diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeSurface.java index 4d764dc4f..ce0699c56 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeSurface.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** * Provides low-level information required for @@ -198,6 +198,7 @@ public interface NativeSurface extends SurfaceUpdatedListener { * @param pixelUnitsAndResult int[2] storage holding the pixel units for the x- and y-coord to convert * and the resulting values. * @return result int[2] storage pixelUnitsAndResult for chaining holding the converted values + * @see ScalableSurface */ public int[] convertToWindowUnits(final int[] pixelUnitsAndResult); @@ -206,6 +207,7 @@ public interface NativeSurface extends SurfaceUpdatedListener { * @param windowUnitsAndResult int[2] storage holding the window units for the x- and y-coord to convert * and the resulting values. * @return result int[2] storage windowUnitsAndResult for chaining holding the converted values + * @see ScalableSurface */ public int[] convertToPixelUnits(final int[] windowUnitsAndResult); @@ -216,7 +218,7 @@ public interface NativeSurface extends SurfaceUpdatedListener { * this method shall return the native {@link AbstractGraphicsConfiguration} via {@link AbstractGraphicsConfiguration#getNativeGraphicsConfiguration()}. * </p> * @see AbstractGraphicsConfiguration#getNativeGraphicsConfiguration() - * @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) + * @see com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) */ public AbstractGraphicsConfiguration getGraphicsConfiguration(); diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurfaceHolder.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeSurfaceHolder.java index b459ab74a..667f5d8af 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurfaceHolder.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeSurfaceHolder.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** * Accessor interface for implementing classes with ownership of a {@link NativeSurface} diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindow.java index 7f71bc33b..1a2d212da 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindow.java @@ -38,10 +38,10 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.util.Point; /** * Extend the {@link NativeSurface} interface with windowing diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowException.java index 16355032f..8f841e7ea 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowException.java @@ -37,7 +37,7 @@ * and developed by Kenneth Bradley Russell and Christopher John Kline. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** A generic exception for OpenGL errors used throughout the binding as a substitute for {@link RuntimeException}. */ diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java index 58542f07d..cba3a9214 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java @@ -31,7 +31,7 @@ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; import java.io.File; import java.lang.reflect.Method; @@ -43,7 +43,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.media.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.PointImmutable; import jogamp.common.os.PlatformPropsImpl; import jogamp.nativewindow.Debug; @@ -385,7 +385,7 @@ public abstract class NativeWindowFactory { // register our default factory -> NativeWindow final NativeWindowFactory factory = new NativeWindowFactoryImpl(); - nativeWindowClass = javax.media.nativewindow.NativeWindow.class; + nativeWindowClass = com.jogamp.nativewindow.NativeWindow.class; registerFactory(nativeWindowClass, factory); defaultFactory = factory; @@ -560,10 +560,10 @@ public abstract class NativeWindowFactory { /** Converts the given window object and it's {@link AbstractGraphicsConfiguration AbstractGraphicsConfiguration} into a {@link NativeWindow NativeWindow} which can be operated upon by a custom - toolkit, e.g. {@link javax.media.opengl.GLDrawableFactory javax.media.opengl.GLDrawableFactory}.<br> + toolkit, e.g. {@link com.jogamp.opengl.GLDrawableFactory com.jogamp.opengl.GLDrawableFactory}.<br> The object may be a component for a particular window toolkit, such as an AWT Canvas. It may also be a NativeWindow object itself.<br> - You shall utilize {@link javax.media.nativewindow.GraphicsConfigurationFactory GraphicsConfigurationFactory} + You shall utilize {@link com.jogamp.nativewindow.GraphicsConfigurationFactory GraphicsConfigurationFactory} to construct a proper {@link AbstractGraphicsConfiguration AbstractGraphicsConfiguration}.<br> The particular implementation of the NativeWindowFactory is responsible for handling objects from a @@ -574,7 +574,7 @@ public abstract class NativeWindowFactory { could not be handled by any of the registered NativeWindowFactory instances - @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) + @see com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) */ public static NativeWindow getNativeWindow(final Object winObj, final AbstractGraphicsConfiguration config) throws IllegalArgumentException, NativeWindowException { if (winObj == null) { diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java index 7c1a88e6a..6bbb3c15f 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java @@ -46,8 +46,8 @@ public class NativeWindowVersion extends JogampVersion { if(null == jogampCommonVersionInfo) { // volatile: ok synchronized(NativeWindowVersion.class) { if( null == jogampCommonVersionInfo ) { - final String packageName1 = "javax.media.nativewindow"; // atomic packaging - and identity - final String packageName2 = "javax.media.opengl"; // all packaging + final String packageName1 = "com.jogamp.nativewindow"; // atomic packaging - and identity + final String packageName2 = "com.jogamp.opengl"; // all packaging final Manifest mf = VersionUtil.getManifest(NativeWindowVersion.class.getClassLoader(), new String[]{ packageName1, packageName2 } ); jogampCommonVersionInfo = new NativeWindowVersion(packageName1, mf); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java b/src/nativewindow/classes/com/jogamp/nativewindow/OffscreenLayerOption.java index 11496899a..2e9f2c172 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/OffscreenLayerOption.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** * Handling requests for using an {@link OffscreenLayerSurface} diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java b/src/nativewindow/classes/com/jogamp/nativewindow/OffscreenLayerSurface.java index cf8cf89d2..abba2c126 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/OffscreenLayerSurface.java @@ -25,10 +25,10 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; -import javax.media.nativewindow.util.PixelRectangle; -import javax.media.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.PointImmutable; import com.jogamp.common.util.locks.RecursiveLock; diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/com/jogamp/nativewindow/ProxySurface.java index 7a69b9a40..7b36531dc 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/ProxySurface.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; import jogamp.nativewindow.Debug; @@ -65,6 +65,14 @@ public interface ProxySurface extends MutableSurface { */ public static final int OPT_UPSTREAM_WINDOW_INVISIBLE = 1 << 8; + /** + * Implementation specific bitvalue stating the upstream's {@link NativeSurface}'s zero handle is valid. + * @see #addUpstreamOptionBits(int) + * @see #clearUpstreamOptionBits(int) + * @see #getUpstreamOptionBits() + */ + public static final int OPT_UPSTREAM_SURFACELESS = 1 << 9; + /** Allow redefining the AbstractGraphicsConfiguration */ public void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg); diff --git a/src/nativewindow/classes/javax/media/nativewindow/ScalableSurface.java b/src/nativewindow/classes/com/jogamp/nativewindow/ScalableSurface.java index ffd5c224c..eea9e4bed 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/ScalableSurface.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/ScalableSurface.java @@ -26,20 +26,21 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** * Adding mutable surface pixel scale property to implementing class, usually to a {@link NativeSurface} implementation, - * see {@link #setSurfaceScale(int[])}. + * see {@link #setSurfaceScale(float[])}. */ public interface ScalableSurface { /** Setting surface-pixel-scale of {@value}, results in same pixel- and window-units. */ - public static final int IDENTITY_PIXELSCALE = 1; + public static final float IDENTITY_PIXELSCALE = 1f; /** Setting surface-pixel-scale of {@value}, results in maximum platform dependent pixel-scale, i.e. pixel-units >> window-units where available. */ - public static final int AUTOMAX_PIXELSCALE = 0; + public static final float AUTOMAX_PIXELSCALE = 0f; /** - * Request a pixel scale in x- and y-direction for the associated {@link NativeSurface}. + * Request a pixel scale in x- and y-direction for the associated {@link NativeSurface}, + * where {@code size_in_pixel_units = pixel_scale * size_in_window_units}. * <p> * Default pixel scale request for both directions is {@link #AUTOMAX_PIXELSCALE}. * </p> @@ -50,48 +51,57 @@ public interface ScalableSurface { * <p> * The <i>requested</i> pixel scale will be validated against platform limits before native scale-setup, * i.e. clipped to {@link #IDENTITY_PIXELSCALE} if not supported or clipped to the platform maximum. - * It can be queried via {@link #getRequestedSurfaceScale(int[])}. + * It can be queried via {@link #getRequestedSurfaceScale(float[])}. * </p> * <p> * The actual <i>realized</i> pixel scale values of the {@link NativeSurface} - * can be queried via {@link #getCurrentSurfaceScale(int[])} or + * can be queried via {@link #getCurrentSurfaceScale(float[])} or * computed via <code>surface.{@link NativeSurface#convertToPixelUnits(int[]) convertToPixelUnits}(new int[] { 1, 1 })</code> * </p> - * @param pixelScale <i>requested</i> surface pixel scale int[2] values for x- and y-direction. + * @param pixelScale <i>requested</i> surface pixel scale float[2] values for x- and y-direction. + * @return {@code true} if the {@link #getCurrentSurfaceScale(float[]) current pixel scale} has changed, otherwise {@code false}. + * @see #getRequestedSurfaceScale(float[]) */ - public void setSurfaceScale(final int[] pixelScale); + public boolean setSurfaceScale(final float[] pixelScale); /** - * Returns the requested pixel scale of the associated {@link NativeSurface}. + * Returns the {@link #setSurfaceScale(float[]) requested} pixel scale of the associated {@link NativeSurface}. * - * @param result int[2] storage for the result - * @return the passed storage containing the requested pixelScale for chaining + * @param result float[2] storage for the result + * @return the passed storage containing the current pixelScale for chaining + * @see #setSurfaceScale(float[]) */ - int[] getRequestedSurfaceScale(final int[] result); + public float[] getRequestedSurfaceScale(final float[] result); /** * Returns the current pixel scale of the associated {@link NativeSurface}. * - * @param result int[2] storage for the result + * @param result float[2] storage for the result * @return the passed storage containing the current pixelScale for chaining */ - public int[] getCurrentSurfaceScale(final int[] result); + public float[] getCurrentSurfaceScale(final float[] result); + + /** + * Returns the minimum pixel scale of the associated {@link NativeSurface}. + * @param result float[2] storage for the result + * @return the passed storage containing the minimum pixelScale for chaining + */ + public float[] getMinimumSurfaceScale(final float[] result); /** - * Returns the native pixel scale of the associated {@link NativeSurface} - * reflecting it's currently bound <i>monitor surface resolution in pixels</i>. + * Returns the maximum pixel scale of the associated {@link NativeSurface}. * <p> - * The native pixel scale maybe used to determine the proper <i>dpi</i> - * value of this {@link NativeSurface}: + * The maximum pixel scale maybe used to determine the proper <i>dpi</i> + * value of the monitor displaying this {@link NativeSurface}. * <pre> * surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale, * with PpMM == pixel per millimeter * </pre> * </p> * - * @param result int[2] storage for the result - * @return the passed storage containing the native pixelScale for chaining + * @param result float[2] storage for the result + * @return the passed storage containing the maximum pixelScale for chaining */ - public int[] getNativeSurfaceScale(final int[] result); + public float[] getMaximumSurfaceScale(final float[] result); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java b/src/nativewindow/classes/com/jogamp/nativewindow/SurfaceUpdatedListener.java index de65a3031..37e4bd0c9 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/SurfaceUpdatedListener.java @@ -32,10 +32,10 @@ * */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** - * Clients may add their SurfaceUpdateListener implementation to a {@link javax.media.nativewindow.NativeSurface} + * Clients may add their SurfaceUpdateListener implementation to a {@link com.jogamp.nativewindow.NativeSurface} * allowing to get notified after the surface has been updated, eg. after a swap buffer operation. */ public interface SurfaceUpdatedListener { diff --git a/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java b/src/nativewindow/classes/com/jogamp/nativewindow/ToolkitLock.java index 017b996d7..eef11adb7 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/ToolkitLock.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; import jogamp.nativewindow.Debug; diff --git a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHook.java index 572649875..5e9b8d293 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHook.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** * Interface allowing upstream caller to pass lifecycle actions and size info diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java index 45d12be5e..af75e8346 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java @@ -1,8 +1,8 @@ package com.jogamp.nativewindow; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; public class UpstreamSurfaceHookMutableSize implements UpstreamSurfaceHook.MutableSize { int pixWidth, pixHeight; diff --git a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java b/src/nativewindow/classes/com/jogamp/nativewindow/VisualIDHolder.java index e337166d4..69bfe50f8 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/VisualIDHolder.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; import java.util.Comparator; diff --git a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java b/src/nativewindow/classes/com/jogamp/nativewindow/WindowClosingProtocol.java index 8570b78da..f4f8a02e1 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/WindowClosingProtocol.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow; +package com.jogamp.nativewindow; /** * Protocol for handling window closing events. diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java index 3a62825a2..62fd49092 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java @@ -40,13 +40,13 @@ package com.jogamp.nativewindow.awt; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; import java.awt.Component; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.image.ColorModel; -import javax.media.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; import jogamp.nativewindow.Debug; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java index 219f4bb92..54b26ae51 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java @@ -40,10 +40,10 @@ package com.jogamp.nativewindow.awt; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; -import javax.media.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsDevice; /** A wrapper for an AWT GraphicsDevice allowing it to be handled in a toolkit-independent manner. */ diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java index 6fc35f719..742a93dae 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java @@ -42,7 +42,7 @@ package com.jogamp.nativewindow.awt; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java index b0a7fbc76..d386d6a47 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java @@ -37,10 +37,10 @@ import jogamp.nativewindow.awt.AWTMisc; /** * Interface describing print lifecycle to support AWT printing, - * e.g. on AWT {@link javax.media.opengl.GLAutoDrawable GLAutoDrawable}s. + * e.g. on AWT {@link com.jogamp.opengl.GLAutoDrawable GLAutoDrawable}s. * <a name="impl"><h5>Implementations</h5></a> * <p> - * Implementing {@link javax.media.opengl.GLAutoDrawable GLAutoDrawable} classes based on AWT + * Implementing {@link com.jogamp.opengl.GLAutoDrawable GLAutoDrawable} classes based on AWT * supporting {@link Component#print(Graphics)} shall implement this interface. * </p> * <a name="usage"><h5>Usage</h5></a> @@ -88,6 +88,7 @@ public interface AWTPrintLifecycle { * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples * @param tileWidth custom tile width for {@link com.jogamp.opengl.util.TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param tileHeight custom tile height for {@link com.jogamp.opengl.util.TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. + * FIXME: Add border size ! */ void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight); diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java index 496e6e07b..fea23cb59 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java @@ -34,7 +34,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; -import javax.media.nativewindow.WindowClosingProtocol; +import com.jogamp.nativewindow.WindowClosingProtocol; import jogamp.nativewindow.awt.AWTMisc; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java index c7055099f..0f103bfb3 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java @@ -36,6 +36,7 @@ import java.awt.image.DirectColorModel; import java.awt.image.SampleModel; import java.awt.image.SinglePixelPackedSampleModel; import java.awt.image.WritableRaster; +import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Hashtable; @@ -54,9 +55,12 @@ public final class DirectDataBufferInt extends DataBuffer { public static class BufferedImageInt extends BufferedImage { final int customImageType; - public BufferedImageInt (final int customImageType, final ColorModel cm, final WritableRaster raster, final Hashtable<?,?> properties) { + final DirectDataBufferInt dataBuffer; + public BufferedImageInt (final int customImageType, final ColorModel cm, + final DirectDataBufferInt dataBuffer, final WritableRaster raster, final Hashtable<?,?> properties) { super(cm, raster, false /* isRasterPremultiplied */, properties); this.customImageType = customImageType; + this.dataBuffer = dataBuffer; } /** @@ -68,6 +72,11 @@ public final class DirectDataBufferInt extends DataBuffer { return customImageType; } + /** + * Returns the underlying {@link DirectDataBufferInt} associated with this instance via {@link Raster} {@link #getRaster() instance}. + */ + public DirectDataBufferInt getDataBuffer() { return dataBuffer; } + @Override public String toString() { return "BufferedImageInt@"+Integer.toHexString(hashCode()) @@ -163,14 +172,18 @@ public final class DirectDataBufferInt extends DataBuffer { // final WritableRaster raster = new SunWritableRaster(sppsm, dataBuffer, location); final WritableRaster raster = new DirectWritableRaster(sppsm, dataBuffer, location); - return new BufferedImageInt(imageType, colorModel, raster, properties); + return new BufferedImageInt(imageType, colorModel, dataBuffer, raster, properties); } - /** Default data bank. */ - private final IntBuffer data; + /** Default NIO data bank storage, {@link ByteBuffer} representation. */ + private final ByteBuffer dataBytes; + /** Default NIO data bank storage, {@link IntBuffer} representation. */ + private final IntBuffer dataInts; - /** All data banks */ - private final IntBuffer bankdata[]; + /** All NIO data banks, {@link ByteBuffer} representation. */ + private final ByteBuffer bankdataBytes[]; + /** All NIO data banks, {@link IntBuffer} representation. */ + private final IntBuffer bankdataInts[]; /** * Constructs an nio integer-based {@link DataBuffer} with a single bank @@ -180,9 +193,12 @@ public final class DirectDataBufferInt extends DataBuffer { */ public DirectDataBufferInt(final int size) { super(TYPE_INT, size); - data = Buffers.newDirectIntBuffer(size); - bankdata = new IntBuffer[1]; - bankdata[0] = data; + dataBytes = Buffers.newDirectByteBuffer(size * Buffers.SIZEOF_INT); + dataInts = dataBytes.asIntBuffer(); + bankdataBytes = new ByteBuffer[1]; + bankdataInts = new IntBuffer[1]; + bankdataBytes[0] = dataBytes; + bankdataInts[0] = dataInts; } /** @@ -194,11 +210,14 @@ public final class DirectDataBufferInt extends DataBuffer { */ public DirectDataBufferInt(final int size, final int numBanks) { super(TYPE_INT,size,numBanks); - bankdata = new IntBuffer[numBanks]; + bankdataBytes = new ByteBuffer[numBanks]; + bankdataInts = new IntBuffer[numBanks]; for (int i= 0; i < numBanks; i++) { - bankdata[i] = Buffers.newDirectIntBuffer(size); + bankdataBytes[i] = Buffers.newDirectByteBuffer(size * Buffers.SIZEOF_INT); + bankdataInts[i] = bankdataBytes[i].asIntBuffer(); } - data = bankdata[0]; + dataBytes = bankdataBytes[0]; + dataInts = bankdataInts[0]; } /** @@ -210,33 +229,57 @@ public final class DirectDataBufferInt extends DataBuffer { * hold <code>size</code> elements. * </p> * - * @param dataArray The integer array for the {@link DataBuffer}. + * @param dataArray The NIO {@link ByteBuffer} array, holding the integer data for the {@link DataBuffer}. * @param size The size of the {@link DataBuffer} bank. */ - public DirectDataBufferInt(final IntBuffer dataArray, final int size) { + public DirectDataBufferInt(final ByteBuffer dataArray, final int size) { super(TYPE_INT,size); - data = dataArray; - bankdata = new IntBuffer[1]; - bankdata[0] = data; + dataBytes = Buffers.nativeOrder(dataArray); + dataInts = dataBytes.asIntBuffer(); + bankdataBytes = new ByteBuffer[1]; + bankdataInts = new IntBuffer[1]; + bankdataBytes[0] = dataBytes; + bankdataInts[0] = dataInts; } /** - * Returns the default (first) int data array in {@link DataBuffer}. + * Returns the default (first) int data array in {@link DataBuffer} as an {@link IntBuffer} representation. * * @return The first integer data array. + * @see #getDataBytes() */ public IntBuffer getData() { - return data; + return dataInts; + } + /** + * Returns the default (first) int data array in {@link DataBuffer} as a {@link ByteBuffer} representation. + * + * @return The first integer data array. + * @see #getData() + */ + public ByteBuffer getDataBytes() { + return dataBytes; } /** - * Returns the data array for the specified bank. + * Returns the data array for the specified bank as an {@link IntBuffer} representation. * * @param bank The bank whose data array you want to get. * @return The data array for the specified bank. + * @see #getDataBytes(int) */ public IntBuffer getData(final int bank) { - return bankdata[bank]; + return bankdataInts[bank]; + } + /** + * Returns the data array for the specified bank as a {@link ByteBuffer} representation. + * + * @param bank The bank whose data array you want to get. + * @return The data array for the specified bank. + * @see #getData(int) + */ + public ByteBuffer getDataBytes(final int bank) { + return bankdataBytes[bank]; } /** @@ -249,7 +292,7 @@ public final class DirectDataBufferInt extends DataBuffer { */ @Override public int getElem(final int i) { - return data.get(i+offset); + return dataInts.get(i+offset); } /** @@ -263,7 +306,7 @@ public final class DirectDataBufferInt extends DataBuffer { */ @Override public int getElem(final int bank, final int i) { - return bankdata[bank].get(i+offsets[bank]); + return bankdataInts[bank].get(i+offsets[bank]); } /** @@ -277,7 +320,7 @@ public final class DirectDataBufferInt extends DataBuffer { */ @Override public void setElem(final int i, final int val) { - data.put(i+offset, val); + dataInts.put(i+offset, val); } /** @@ -291,7 +334,7 @@ public final class DirectDataBufferInt extends DataBuffer { */ @Override public void setElem(final int bank, final int i, final int val) { - bankdata[bank].put(i+offsets[bank], val); + bankdataInts[bank].put(i+offsets[bank], val); } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 6498ebd1e..f1442abee 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -37,6 +37,7 @@ package com.jogamp.nativewindow.awt; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.os.Platform; import com.jogamp.common.util.awt.AWTEDTExecutor; import com.jogamp.common.util.locks.LockFactory; @@ -46,6 +47,8 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration; import java.awt.Component; import java.awt.Container; import java.awt.Cursor; +import java.awt.EventQueue; +import java.awt.GraphicsConfiguration; import java.awt.Window; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; @@ -53,23 +56,23 @@ import java.awt.event.HierarchyEvent; import java.awt.event.HierarchyListener; import java.applet.Applet; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.OffscreenLayerOption; -import javax.media.nativewindow.OffscreenLayerSurface; -import javax.media.nativewindow.ScalableSurface; -import javax.media.nativewindow.SurfaceUpdatedListener; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.nativewindow.util.PixelRectangle; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.OffscreenLayerOption; +import com.jogamp.nativewindow.OffscreenLayerSurface; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.SurfaceUpdatedListener; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; import jogamp.common.os.PlatformPropsImpl; import jogamp.nativewindow.SurfaceScaleUtils; @@ -102,10 +105,11 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, protected Insets insets; private volatile long offscreenSurfaceLayer; - private final int[] nativePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; - private final int[] hasPixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; - protected final int[] reqPixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; - + private final float[] minPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + private final float[] maxPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + private final float[] hasPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + private final float[] reqPixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + private volatile boolean hasPixelScaleChanged = false; private long drawable_old; /** @@ -268,38 +272,41 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, insets = new Insets(); hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; - nativePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; - nativePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; + minPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; + minPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; + maxPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; + maxPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; + hasPixelScaleChanged = false; } protected abstract void invalidateNative(); - /** - * {@inheritDoc} - * <p> - * Per default impl. only works for not yet {@link #isRealized() realized} instances, - * current exception OSX. - * </p> - */ @Override - public void setSurfaceScale(final int[] pixelScale) { - SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG ? getClass().getSimpleName() : null); + public boolean setSurfaceScale(final float[] pixelScale) { + System.arraycopy(pixelScale, 0, reqPixelScale, 0, 2); + return false; } @Override - public final int[] getRequestedSurfaceScale(final int[] result) { + public final float[] getRequestedSurfaceScale(final float[] result) { System.arraycopy(reqPixelScale, 0, result, 0, 2); return result; } @Override - public final int[] getCurrentSurfaceScale(final int[] result) { + public final float[] getCurrentSurfaceScale(final float[] result) { System.arraycopy(hasPixelScale, 0, result, 0, 2); return result; } @Override - public final int[] getNativeSurfaceScale(final int[] result) { - System.arraycopy(nativePixelScale, 0, result, 0, 2); + public float[] getMinimumSurfaceScale(final float[] result) { + System.arraycopy(minPixelScale, 0, result, 0, 2); + return result; + } + + @Override + public final float[] getMaximumSurfaceScale(final float[] result) { + System.arraycopy(maxPixelScale, 0, result, 0, 2); return result; } @@ -322,31 +329,75 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, insets.set(contInsets.left, contInsets.right, contInsets.top, contInsets.bottom); } } - { - final int ps = JAWTUtil.getPixelScale(config.getAWTGraphicsConfiguration()); - nativePixelScale[0] = ps; - nativePixelScale[1] = ps; - } - return updatePixelScale() || changedBounds; + updatePixelScale(false); + return hasPixelScaleChanged || changedBounds; + } + + /** + * Updates the minimum and maximum pixel-scale values + * and returns {@code true} if they were updated. + * @param clearFlag if {@code true}, the {@code hasPixelScaleChanged} flag will be cleared + * @return {@code true} if values were updated, otherwise {@code false}. + * @see #hasPixelScaleChanged() + */ + public final boolean updatePixelScale(final boolean clearFlag) { + // Using GraphicsConfiguration from component, which may change by moving to diff monitor + if( EventQueue.isDispatchThread() || Thread.holdsLock(component.getTreeLock()) ) { + if( JAWTUtil.getPixelScale(component.getGraphicsConfiguration(), minPixelScale, maxPixelScale) ) { + hasPixelScaleChanged = true; + if( DEBUG ) { + System.err.println("JAWTWindow.updatePixelScale: updated req["+ + reqPixelScale[0]+", "+reqPixelScale[1]+"], min["+ + minPixelScale[0]+", "+minPixelScale[1]+"], max["+ + maxPixelScale[0]+", "+maxPixelScale[1]+"], has["+ + hasPixelScale[0]+", "+hasPixelScale[1]+"]"); + } + } + } + if( clearFlag ) { + final boolean r = hasPixelScaleChanged; + hasPixelScaleChanged = false; + return r; + } else { + return hasPixelScaleChanged; + } + } + + /** + * Returns and clears the {@code hasPixelScaleChanged} flag, as set via {@link #lockSurface()}. + * <p> + * {@code hasPixelScaleChanged} is {@code true}, + * if the {@link #getMinimumSurfaceScale(float[]) minimum} or {@link #getMaximumSurfaceScale(float[]) maximum} + * pixel scale has changed. + * User needs to {@link #setSurfaceScale(float[]) set the current pixel scale} in this case + * using the {@link #getRequestedSurfaceScale(float[]) requested pixel scale} + * to update the surface pixel scale. + * </p> + */ + public final boolean hasPixelScaleChanged() { + final boolean v = hasPixelScaleChanged; + hasPixelScaleChanged = false; + return v; } /** - * Update pixelScale + * set requested pixelScale * @return true if pixelScale has changed, otherwise false */ - protected final boolean updatePixelScale() { - return SurfaceScaleUtils.computePixelScale(hasPixelScale, hasPixelScale, reqPixelScale, nativePixelScale, DEBUG ? getClass().getSimpleName() : null); + protected final boolean setReqPixelScale() { + updatePixelScale(true); + return SurfaceScaleUtils.setNewPixelScale(hasPixelScale, hasPixelScale, reqPixelScale, minPixelScale, maxPixelScale, DEBUG ? getClass().getSimpleName() : null); } /** @return the JAWT_DrawingSurfaceInfo's (JAWT_Rectangle) bounds, updated with lock */ public final RectangleImmutable getBounds() { return bounds; } /** @return the safe pixelScale value for x-direction, i.e. never negative or zero. Updated with lock. */ - protected final int getPixelScaleX() { return hasPixelScale[0]; } + protected final float getPixelScaleX() { return hasPixelScale[0]; } /** @return the safe pixelScale value for y-direction, i.e. never negative or zero. Updated with lock. */ - protected final int getPixelScaleY() { return hasPixelScale[1]; } + protected final float getPixelScaleY() { return hasPixelScale[1]; } @Override public final InsetsImmutable getInsets() { return insets; } @@ -558,7 +609,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, surfaceLock.unlock(); if(DEBUG) { System.err.println("JAWTWindow: Can't lock surface, component peer n/a. Component displayable "+component.isDisplayable()+", "+component); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } else { determineIfApplet(); @@ -670,26 +721,22 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, @Override public final int getSurfaceWidth() { - return getWidth() * getPixelScaleX(); + return SurfaceScaleUtils.scale(getWidth(), getPixelScaleX()); } @Override public final int getSurfaceHeight() { - return getHeight() * getPixelScaleY(); + return SurfaceScaleUtils.scale(getHeight(), getPixelScaleY()); } @Override public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) { - pixelUnitsAndResult[0] /= getPixelScaleX(); - pixelUnitsAndResult[1] /= getPixelScaleY(); - return pixelUnitsAndResult; + return SurfaceScaleUtils.scaleInv(pixelUnitsAndResult, pixelUnitsAndResult, hasPixelScale); } @Override public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) { - windowUnitsAndResult[0] *= getPixelScaleX(); - windowUnitsAndResult[1] *= getPixelScaleY(); - return windowUnitsAndResult; + return SurfaceScaleUtils.scale(windowUnitsAndResult, windowUnitsAndResult, hasPixelScale); } @Override @@ -765,7 +812,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, // avoid deadlock .. if(DEBUG) { System.err.println("Warning: JAWT Lock hold, but not the AWT tree lock: "+this); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if( null == storage ) { storage = new Point(); @@ -788,7 +835,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, if(LOCK_SURFACE_NOT_READY == lockRes) { if(DEBUG) { System.err.println("Warning: JAWT Lock couldn't be acquired: "+this); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return null; } @@ -873,7 +920,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, ", bounds "+bounds+", insets "+insets ); sb.append(", window ["+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+ - "], pixels[s "+getPixelScaleX()+"x"+getPixelScaleY()+" -> "+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"+ + "], pixels[scale "+getPixelScaleX()+", "+getPixelScaleY()+" -> "+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"+ ", visible "+component.isVisible()); sb.append(", lockedExt "+isSurfaceLockedByOtherThread()+ ",\n\tconfig "+config+ diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java index d21994ea5..04d304cd5 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java @@ -32,13 +32,16 @@ package com.jogamp.nativewindow.egl; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; + +import com.jogamp.common.util.VersionNumber; /** Encapsulates a graphics device on EGL platforms. */ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneable { - final long[] nativeDisplayID = new long[1]; - /* final */ EGLDisplayLifecycleCallback eglLifecycleCallback; + private final long[] nativeDisplayID = new long[1]; + private /* final */ EGLDisplayLifecycleCallback eglLifecycleCallback; + private VersionNumber eglVersion = VersionNumber.zeroVersion; /** * Hack to allow inject a EGL termination call. @@ -52,9 +55,11 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * Implementation should issue an <code>EGL.eglGetDisplay(nativeDisplayID)</code> * inclusive <code>EGL.eglInitialize(eglDisplayHandle, ..)</code> call. * @param nativeDisplayID in/out array of size 1, passing the requested nativeVisualID, may return a different revised nativeVisualID handle + * @param major out array for EGL major version + * @param minor out array for EGL minor version * @return the initialized EGL display ID, or <code>0</code> if not successful */ - public long eglGetAndInitDisplay(long[] nativeDisplayID); + public long eglGetAndInitDisplay(final long[] nativeDisplayID, final int[] major, final int[] minor); /** * Implementation should issue an <code>EGL.eglTerminate(eglDisplayHandle)</code> call. @@ -79,6 +84,9 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl this.eglLifecycleCallback = eglLifecycleCallback; } + /** EGL server version as returned by {@code eglInitialize(..)}. Only valid after {@link #open()}. */ + public VersionNumber getEGLVersion() { return eglVersion; } + public long getNativeDisplayID() { return nativeDisplayID[0]; } @Override @@ -98,11 +106,16 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl if(DEBUG) { System.err.println(Thread.currentThread().getName() + " - EGLGraphicsDevice.open(): "+this); } - handle = eglLifecycleCallback.eglGetAndInitDisplay(nativeDisplayID); + final int[] major = { 0 }; + final int[] minor = { 0 }; + handle = eglLifecycleCallback.eglGetAndInitDisplay(nativeDisplayID, major, minor); if(0 == handle) { + eglVersion = VersionNumber.zeroVersion; throw new NativeWindowException("EGLGraphicsDevice.open() failed: "+this); + } else { + eglVersion = new VersionNumber(major[0], minor[0], 0); + return true; } - return true; } return false; } @@ -142,5 +155,10 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl eglLifecycleCallback = (EGLDisplayLifecycleCallback) newOwnership; return oldOwnership; } + + @Override + public String toString() { + return getClass().getSimpleName()+"[type "+getType()+", v"+eglVersion+", connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+", owner "+isHandleOwner()+", "+toolkitLock+"]"; + } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java index ff149447e..ce7ea858c 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java @@ -32,7 +32,7 @@ package com.jogamp.nativewindow.macosx; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; /** Encapsulates a graphics device on MacOSX platforms. */ diff --git a/src/nativewindow/classes/javax/media/nativewindow/package.html b/src/nativewindow/classes/com/jogamp/nativewindow/package.html index 3fe42bab0..1fe52eea4 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/package.html +++ b/src/nativewindow/classes/com/jogamp/nativewindow/package.html @@ -22,22 +22,22 @@ However, any other native windowing system may be added to the implementation, using a generic string identifier and an optional specialisation of: <ul> - <li>{@link javax.media.nativewindow.AbstractGraphicsDevice AbstractGraphicsDevice}, - <p>Shall return the new string identifier with {@link javax.media.nativewindow.AbstractGraphicsDevice#getType() getType()}</p></li> - <li>{@link javax.media.nativewindow.AbstractGraphicsScreen AbstractGraphicsScreen}</li> - <li>{@link javax.media.nativewindow.AbstractGraphicsConfiguration AbstractGraphicsConfiguration}</li> + <li>{@link com.jogamp.nativewindow.AbstractGraphicsDevice AbstractGraphicsDevice}, + <p>Shall return the new string identifier with {@link com.jogamp.nativewindow.AbstractGraphicsDevice#getType() getType()}</p></li> + <li>{@link com.jogamp.nativewindow.AbstractGraphicsScreen AbstractGraphicsScreen}</li> + <li>{@link com.jogamp.nativewindow.AbstractGraphicsConfiguration AbstractGraphicsConfiguration}</li> </ul> <p>The implementor has to provide the following:</p> <ul> - <li> The specialisation of the abstract class {@link javax.media.nativewindow.NativeWindowFactory NativeWindowFactory} - <p>shall be registered with {@link javax.media.nativewindow.NativeWindowFactory#registerFactory NativeWindowFactory.registerFactory(..)}.</p></li> + <li> The specialisation of the abstract class {@link com.jogamp.nativewindow.NativeWindowFactory NativeWindowFactory} + <p>shall be registered with {@link com.jogamp.nativewindow.NativeWindowFactory#registerFactory NativeWindowFactory.registerFactory(..)}.</p></li> - <li> The specialisation of the abstract class {@link javax.media.nativewindow.GraphicsConfigurationFactory GraphicsConfigurationFactory} - <p>shall be registered with {@link javax.media.nativewindow.GraphicsConfigurationFactory#registerFactory GraphicsConfigurationFactory.registerFactory(..)}.</p></li> + <li> The specialisation of the abstract class {@link com.jogamp.nativewindow.GraphicsConfigurationFactory GraphicsConfigurationFactory} + <p>shall be registered with {@link com.jogamp.nativewindow.GraphicsConfigurationFactory#registerFactory GraphicsConfigurationFactory.registerFactory(..)}.</p></li> </ul> <p>This protocol <i>does not</i> describe how to <i>create</i> native windows, but how to <i>bind</i> a native surface to an implementation of - and window to an implementation of {@link javax.media.nativewindow.NativeSurface NativeSurface}.</p> - <p>{@link javax.media.nativewindow.NativeWindow NativeWindow} specializes the NativeSurface.</p> + and window to an implementation of {@link com.jogamp.nativewindow.NativeSurface NativeSurface}.</p> + <p>{@link com.jogamp.nativewindow.NativeWindow NativeWindow} specializes the NativeSurface.</p> <p>However, an implementation of this protocol (e.g. {@link com.jogamp.newt}) may support the creation.</p> <h3>Dependencies</h3> @@ -62,30 +62,30 @@ <h3>Package Structure</h3> The packages defined by this specification include: <ul> - <li>The <b>javax.media.nativewindow</b> package + <li>The <b>com.jogamp.nativewindow</b> package <p>This package contains Java bindings for a native windowing system.</p> <p>Subsequent packages contain marker type classes, containing native characteristics of the windowing system.</p> <ul> - <li>The <b>javax.media.nativewindow.awt</b> package + <li>The <b>com.jogamp.nativewindow.awt</b> package <p>This sub package contains classes to cover the native characteristics of the AWT windowing system.</p></li> - <li>The <b>javax.media.nativewindow.x11</b> package + <li>The <b>com.jogamp.nativewindow.x11</b> package <p>This sub package contains classes to cover the native characteristics of the X11 windowing system.</p></li> - <li>The <b>javax.media.nativewindow.windows</b> package + <li>The <b>com.jogamp.nativewindow.windows</b> package <p>This sub package contains classes to cover the native characteristics of the Windows windowing system.</p></li> - <li>The <b>javax.media.nativewindow.macosx</b> package + <li>The <b>com.jogamp.nativewindow.macosx</b> package <p>This sub package contains classes to cover the native characteristics of the MacOSX windowing system.</p></li> - <li>The <b>javax.media.nativewindow.egl</b> package + <li>The <b>com.jogamp.nativewindow.egl</b> package <p>This sub package contains classes to cover the native characteristics of the EGL/OpenKODE windowing system.</p></li> </ul></li> </ul> <h3>Factory Model</h3> <p>Running on a platform with a supported windowing system, the factory model shall be used -to instantiate a native window, see {@link javax.media.nativewindow.NativeWindowFactory NativeWindowFactory}.</p> +to instantiate a native window, see {@link com.jogamp.nativewindow.NativeWindowFactory NativeWindowFactory}.</p> <h3>Revision History</h3> diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java index d29e2abbc..b10b12128 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java @@ -37,11 +37,11 @@ import org.eclipse.swt.graphics.GCData; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Control; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.VisualIDHolder; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.common.util.VersionNumber; diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/Dimension.java index 4c9672c26..28c5dd90e 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/Dimension.java @@ -27,7 +27,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow.util; +package com.jogamp.nativewindow.util; public class Dimension implements Cloneable, DimensionImmutable { int width; diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/DimensionImmutable.java index e6cacf4ff..6de77a716 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/DimensionImmutable.java @@ -27,7 +27,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow.util; +package com.jogamp.nativewindow.util; import com.jogamp.common.type.WriteCloneable; diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/Insets.java index 5ec4c758f..205e18346 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/Insets.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow.util; +package com.jogamp.nativewindow.util; /** * Mutable insets representing rectangular window decoration insets on all four edges diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/InsetsImmutable.java index 0f8ba0158..e626a507e 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/InsetsImmutable.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow.util; +package com.jogamp.nativewindow.util; import com.jogamp.common.type.WriteCloneable; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/util/PixelFormat.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/PixelFormat.java new file mode 100644 index 000000000..8b1e91564 --- /dev/null +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/PixelFormat.java @@ -0,0 +1,739 @@ +/** + * Copyright (c) 2014 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.nativewindow.util; + +import java.util.Arrays; + +import com.jogamp.common.util.IntBitfield; + +/** + * Basic pixel formats + * <p> + * Notation follows OpenGL notation, i.e. + * name consist of all it's component names + * followed by their bit size. + * </p> + * <p> + * Order of component names is from lowest-bit to highest-bit. + * </p> + * <p> + * In case component-size is 1 byte (e.g. OpenGL data-type GL_UNSIGNED_BYTE), + * component names are ordered from lowest-byte to highest-byte. + * Note that OpenGL applies special interpretation if + * data-type is e.g. GL_UNSIGNED_8_8_8_8_REV or GL_UNSIGNED_8_8_8_8_REV. + * </p> + * <p> + * PixelFormat can be converted to OpenGL GLPixelAttributes + * via + * <pre> + * GLPixelAttributes glpa = GLPixelAttributes.convert(PixelFormat pixFmt, GLProfile glp); + * </pre> + * </p> + * <p> + * See OpenGL Specification 4.3 - February 14, 2013, Core Profile, + * Section 8.4.4 Transfer of Pixel Rectangles, p. 161-174. + * </ul> + * + * </p> + */ +public enum PixelFormat { + /** + * Stride is 8 bits, 8 bits per pixel, 1 component of 8 bits. + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_ALPHA (< GL3), GL_RED (>= GL3), data-type GL_UNSIGNED_BYTE</li> + * <li>AWT: <i>none</i></li> + * </ul> + * </p> + */ + LUMINANCE(new CType[]{ CType.Y }, 1, 8, 8), + + /** + * Stride is 16 bits, 16 bits per pixel, 3 {@link PackedComposition#isUniform() discrete} components. + * <p> + * The {@link PackedComposition#isUniform() discrete} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>R: 0x1F << 0</li> + * <li>G: 0x3F << 5</li> + * <li>B: 0x1F << 11</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_RGB, data-type GL_UNSIGNED_SHORT_5_6_5_REV</li> + * <li>AWT: <i>None</i></li> + * </ul> + * </p> + */ + RGB565(new CType[]{ CType.R, CType.G, CType.B }, + new int[]{ 0x1F, 0x3F, 0x1F }, + new int[]{ 0, 5, 5+6 }, + 16 ), + + /** + * Stride is 16 bits, 16 bits per pixel, 3 {@link PackedComposition#isUniform() discrete} components. + * <p> + * The {@link PackedComposition#isUniform() discrete} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>B: 0x1F << 0</li> + * <li>G: 0x3F << 5</li> + * <li>R: 0x1F << 11</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_RGB, data-type GL_UNSIGNED_SHORT_5_6_5</li> + * <li>AWT: <i>None</i></li> + * </ul> + * </p> + */ + BGR565(new CType[]{ CType.B, CType.G, CType.R}, + new int[]{ 0x1F, 0x3F, 0x1F }, + new int[]{ 0, 5, 5+6 }, + 16 ), + + /** + * Stride is 16 bits, 16 bits per pixel, 4 {@link PackedComposition#isUniform() discrete} components. + * <p> + * The {@link PackedComposition#isUniform() discrete} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>R: 0x1F << 0</li> + * <li>G: 0x1F << 5</li> + * <li>B: 0x1F << 10</li> + * <li>A: 0x01 << 15</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_SHORT_1_5_5_5_REV</li> + * <li>AWT: <i>None</i></li> + * </ul> + * </p> + */ + RGBA5551(new CType[]{ CType.R, CType.G, CType.B, CType.A}, + new int[]{ 0x1F, 0x1F, 0x1F, 0x01 }, + new int[]{ 0, 5, 5+5, 5+5+5 }, + 16 ), + + /** + * Stride is 16 bits, 16 bits per pixel, 4 {@link PackedComposition#isUniform() discrete} components. + * <p> + * The {@link PackedComposition#isUniform() discrete} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>A: 0x01 << 0</li> + * <li>B: 0x1F << 1</li> + * <li>G: 0x1F << 6</li> + * <li>R: 0x1F << 11</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_SHORT_5_5_5_1</li> + * <li>AWT: <i>None</i></li> + * </ul> + * </p> + */ + ABGR1555(new CType[]{ CType.A, CType.B, CType.G, CType.R }, + new int[]{ 0x01, 0x1F, 0x1F, 0x1F }, + new int[]{ 0, 1, 1+5, 1+5+5 }, + 16 ), + + /** + * Stride 24 bits, 24 bits per pixel, 3 {@link PackedComposition#isUniform() uniform} components of 8 bits. + * <p> + * The {@link PackedComposition#isUniform() uniform} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>R: 0xFF << 0</li> + * <li>G: 0xFF << 8</li> + * <li>B: 0xFF << 16</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_RGB, data-type GL_UNSIGNED_BYTE</li> + * <li>AWT: <i>None</i></li> + * </ul> + * </p> + */ + RGB888(new CType[]{ CType.R, CType.G, CType.B }, 3, 8, 24), + + /** + * Stride is 24 bits, 24 bits per pixel, 3 {@link PackedComposition#isUniform() uniform} components of of 8 bits. + * <p> + * The {@link PackedComposition#isUniform() uniform} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>B: 0xFF << 0</li> + * <li>G: 0xFF << 8</li> + * <li>R: 0xFF << 16</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_BGR (>= GL2), data-type GL_UNSIGNED_BYTE</li> + * <li>AWT: {@link java.awt.image.BufferedImage#TYPE_3BYTE_BGR TYPE_3BYTE_BGR}</li> + * </ul> + * </p> + */ + BGR888(new CType[]{ CType.B, CType.G, CType.R }, 3, 8, 24), + + /** + * Stride is 32 bits, 24 bits per pixel, 3 {@link PackedComposition#isUniform() uniform} components of 8 bits. + * <p> + * The {@link PackedComposition#isUniform() uniform} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>R: 0xFF << 0</li> + * <li>G: 0xFF << 8</li> + * <li>B: 0xFF << 16</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_BYTE, with alpha discarded!</li> + * <li>AWT: {@link java.awt.image.BufferedImage#TYPE_INT_BGR TYPE_INT_BGR}</li> + * </ul> + * </p> + */ + RGBx8888(new CType[]{ CType.R, CType.G, CType.B }, 3, 8, 32), + + /** + * Stride is 32 bits, 24 bits per pixel, 3 {@link PackedComposition#isUniform() uniform} components of 8 bits. + * <p> + * The {@link PackedComposition#isUniform() uniform} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>B: 0xFF << 0</li> + * <li>G: 0xFF << 8</li> + * <li>R: 0xFF << 16</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_BGRA, data-type GL_UNSIGNED_BYTE - with alpha discarded!</li> + * <li>AWT: {@link java.awt.image.BufferedImage#TYPE_INT_RGB TYPE_INT_RGB}</li> + * </ul> + * </p> + */ + BGRx8888(new CType[]{ CType.B, CType.G, CType.R }, 3, 8, 32), + + /** + * Stride is 32 bits, 32 bits per pixel, 4 {@link PackedComposition#isUniform() uniform} components of 8 bits. + * <p> + * The {@link PackedComposition#isUniform() uniform} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>R: 0xFF << 0</li> + * <li>G: 0xFF << 8</li> + * <li>B: 0xFF << 16</li> + * <li>A: 0xFF << 24</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_BYTE</li> + * <li>AWT: <i>None</i></li> + * <li>PointerIcon: OSX (NSBitmapImageRep)</li> + * <li>Window Icon: OSX (NSBitmapImageRep)</li> + * <li>PNGJ: Scanlines</li> + * </ul> + * </p> + */ + RGBA8888(new CType[]{ CType.R, CType.G, CType.B, CType.A }, 4, 8, 32), + + /** + * Stride is 32 bits, 32 bits per pixel, 4 {@link PackedComposition#isUniform() uniform} components of 8 bits. + * <p> + * The {@link PackedComposition#isUniform() uniform} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>A: 0xFF << 0</li> + * <li>B: 0xFF << 8</li> + * <li>G: 0xFF << 16</li> + * <li>R: 0xFF << 24</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_INT_8_8_8_8</li> + * <li>AWT: {@link java.awt.image.BufferedImage#TYPE_4BYTE_ABGR TYPE_4BYTE_ABGR}</li> + * </ul> + * </p> + */ + ABGR8888(new CType[]{ CType.A, CType.B, CType.G, CType.R }, 4, 8, 32), + + /** + * Stride is 32 bits, 32 bits per pixel, 4 {@link PackedComposition#isUniform() uniform} components of 8 bits. + * <p> + * The {@link PackedComposition#isUniform() uniform} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>A: 0xFF << 0</li> + * <li>R: 0xFF << 8</li> + * <li>G: 0xFF << 16</li> + * <li>B: 0xFF << 24</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_BGRA, data-type GL_UNSIGNED_INT_8_8_8_8</li> + * <li>AWT: <i>None</i></li> + * </ul> + * </p> + */ + ARGB8888(new CType[]{ CType.A, CType.R, CType.G, CType.B }, 4, 8, 32), + + /** + * Stride is 32 bits, 32 bits per pixel, 4 {@link PackedComposition#isUniform() uniform} components of 8 bits. + * <p> + * The {@link PackedComposition#isUniform() uniform} {@link PixelFormat#composition components} + * are interleaved in the order Low to High: + * <ol> + * <li>B: 0xFF << 0</li> + * <li>G: 0xFF << 8</li> + * <li>R: 0xFF << 16</li> + * <li>A: 0xFF << 24</li> + * </ol> + * </p> + * <p> + * Compatible with: + * <ul> + * <li>OpenGL: data-format GL_BGRA, data-type GL_UNSIGNED_BYTE</li> + * <li>AWT: {@link java.awt.image.BufferedImage#TYPE_INT_ARGB TYPE_INT_ARGB}</li> + * <li>PointerIcon: X11 (XCURSOR), Win32, AWT</li> + * <li>Window Icon: X11, Win32</li> + * </ul> + * </p> + */ + BGRA8888(new CType[]{ CType.B, CType.G, CType.R, CType.A }, 4, 8, 32); + + /** Unique {@link Composition Pixel Composition}, i.e. layout of its components. */ + public final Composition comp; + + /** + * @param componentOrder {@link CType Component type} order of all components, see {@link Composition#componentBitMask()}. + * @param componentCount number of components + * @param bpc bits per component + * @param bitStride stride bits to next pixel + */ + private PixelFormat(final CType[] componentOrder, final int componentCount, final int bpc, final int bitStride) { + this.comp = new PackedComposition(componentOrder, componentCount, bpc, bitStride); + } + + /** + * @param componentOrder {@link CType Component type} order of all components, see {@link Composition#componentBitMask()}. + * @param componentMask bit-mask of of all components, see {@link Composition##componentBitMask()}. + * @param componentBitShift bit-shift of all components, see {@link Composition##componentBitMask()}. + * @param bitStride stride bits to next pixel + */ + private PixelFormat(final CType[] componentOrder, final int[] componentMask, final int[] componentBitShift, final int bitStride) { + this.comp = new PackedComposition(componentOrder, componentMask, componentBitShift, bitStride); + } + + /** + * Returns the unique matching {@link PixelFormat} of the given {@link Composition} + * or {@code null} if none is available. + */ + public static PixelFormat valueOf(final Composition comp) { + final PixelFormat[] all = PixelFormat.values(); + for(int i=all.length-1; i>=0; i--) { + final PixelFormat pf = all[i]; + if( comp.hashCode() == pf.comp.hashCode() && comp.equals(pf.comp) ) { + return pf; + } + } + return null; + } + + /** Component types */ + public static enum CType { + /** Red component */ + R, + /** Green component */ + G, + /** Blue component */ + B, + /** Alpha component */ + A, + /** Luminance component, e.g. grayscale or Y of YUV */ + Y, + /** U component of YUV */ + U, + /** V component of YUV */ + V; + } + + /** + * Pixel composition, i.e. layout of its components. + */ + public static interface Composition { + /** {@value} */ + public static final int UNDEF = -1; + + /** + * Returns {@code true} if all components are of same bit-size, e.g. {@link PixelFormat#RGBA8888 RGBA8888}, + * otherwise {@code false}, e.g. {@link PixelFormat#RGBA5551 RGBA5551} + */ + boolean isUniform(); + + /** + * Returns {@code true} if all components are packed, i.e. interleaved, e.g. {@link PixelFormat#RGBA8888 RGBA8888}, + * otherwise {@code false}. + */ + boolean isInterleaved(); + + /** Number of components per pixel, e.g. 3 for {@link PixelFormat#RGBx8888 RGBx8888}. */ + int componenCount(); + /** Number of bits per pixel, e.g. 24 bits for {@link PixelFormat#RGBx8888 RGBx8888}. */ + int bitsPerPixel(); + /** + * Bit distance between pixels. + * <p> + * For packed pixels e.g. 32 bits for {@link PixelFormat#RGBx8888 RGBx8888}. + * </p> + */ + int bitStride(); + /** Number of bytes per pixel, i.e. packed {@link #bitStride()} in bytes, e.g. 4 for {@link PixelFormat#RGBx8888 RGBx8888}. */ + int bytesPerPixel(); + /** + * Returns the {@link CType Component type} order of all components, see {@link #componentBitMask()}. + */ + CType[] componentOrder(); + /** + * Returns the index of given {@link CType} within {@link #componentOrder()}, -1 if not exists. + */ + int find(final PixelFormat.CType s); + /** + * Returns the un-shifted bit-mask of all components. + * <p> + * Components mask is returned in the order Low-Index to High-Index, e.g.: + * <ul> + * <li>{@link PixelFormat#RGB565 RGB565}: 0: R 0x1F, 1: G 0x3F, 2: B 0x1F</li> + * <li>{@link PixelFormat#RGBA5551 RGBA5551}: 0: R 0x1F, 1: G 0x1F, 2: B 0x1F, 3: A 0x01</li> + * <li>{@link PixelFormat#RGBA8888 RGBA8888}: 0: R 0xFF, 1: G 0xFF, 2: B 0xFF, 3: A 0xFF</li> + * </ul> + * </p> + * <p> + */ + int[] componentBitMask(); + /** + * Returns the number of bits of all components, see {@link #componentBitMask()}. + */ + int[] componentBitCount(); + /** + * Returns the bit-shift of all components, see {@link #componentBitMask()}. + */ + int[] componentBitShift(); + + /** + * Decodes a component from the shifted pixel data with a {@link #bytesPerPixel()} of up to 32bit. + * @param shifted complete pixel encoded into on 32bit integer + * @param cIdx the desired component index + * @return the decoded component value + */ + int decodeSingleI32(final int shifted, final int cIdx); + /** + * Decodes a component from the shifted pixel data with a {@link #bytesPerPixel()} of up to 64bit. + * @param shifted complete pixel encoded into on 64bit integer + * @param cIdx the desired component index + * @return the decoded component value + */ + int decodeSingleI64(final long shifted, final int cIdx); + + int encodeSingleI32(final int norm, final int cIdx); + long encodeSingleI64(final int norm, final int cIdx); + + int encode3CompI32(final int c1NormI32, final int c2NormI32, final int c3NormI32); + int encode4CompI32(final int c1NormI32, final int c2NormI32, final int c3NormI32, final int c4NormI32); + + int encodeSingleI8(final byte normalI8, final int cIdx); + int encode3CompI8(final byte c1NormI8, final byte c2NormI8, final byte c3NormI8); + int encode4CompI8(final byte c1NormI8, final byte c2NormI8, final byte c3NormI8, final byte c4NormI8); + + float toFloat(final int i32, final int cIdx, final boolean i32Shifted); + int fromFloat(final float f, final int cIdx, final boolean shiftResult); + + int defaultValue(final int cIdx, final boolean shiftResult); + + /** + * Returns cached immutable hash value, see {@link Object#hashCode()}. + */ + int hashCode(); + /** + * Returns {@link Object#equals(Object)} + */ + boolean equals(final Object o); + + /** + * Returns {@link Object#toString()}. + */ + String toString(); + } + + /** + * Packed pixel composition, see {@link Composition}. + * <p> + * Components are interleaved, i.e. packed. + * </p> + */ + public static class PackedComposition implements Composition { + private final CType[] compOrder; + private final int[] compMask; + private final int[] compBitCount; + private final int[] compBitShift; + private final int bitsPerPixel; + private final int bitStride; + private final boolean uniform; + private final int hashCode; + + public final String toString() { + return String.format("PackedComp[order %s, stride %d, bpp %d, uni %b, comp %d: %s]", + Arrays.toString(compOrder), bitStride, bitsPerPixel, uniform, + compMask.length, toHexString(compBitCount, compMask, compBitShift)); + } + + /** + * @param componentOrder {@link CType Component type} order of all components, see {@link #componentBitMask()}. + * @param componentCount number of components + * @param bpc bits per component + * @param bitStride stride bits to next pixel + */ + public PackedComposition(final CType[] componentOrder, final int componentCount, final int bpc, final int bitStride) { + this.compOrder = componentOrder; + this.compMask = new int[componentCount]; + this.compBitShift = new int[componentCount]; + this.compBitCount = new int[componentCount]; + final int compMask = ( 1 << bpc ) - 1; + for(int i=0; i<componentCount; i++) { + this.compMask[i] = compMask; + this.compBitShift[i] = bpc * i; + this.compBitCount[i] = bpc; + } + this.uniform = true; + this.bitsPerPixel = bpc * componentCount; + this.bitStride = bitStride; + if( this.bitStride < this.bitsPerPixel ) { + throw new IllegalArgumentException(String.format("bit-stride %d < bitsPerPixel %d", this.bitStride, this.bitsPerPixel)); + } + this.hashCode = hashCodeImpl(); + } + + /** + * @param componentOrder {@link CType Component type} order of all components, see {@link #componentBitMask()}. + * @param componentMask bit-mask of of all components, see {@link #componentBitMask()}. + * @param componentBitShift bit-shift of all components, see {@link #componentBitMask()}. + * @param bitStride stride bits to next pixel + */ + public PackedComposition(final CType[] componentOrder, final int[] componentMask, final int[] componentBitShift, final int bitStride) { + this.compOrder = componentOrder; + this.compMask = componentMask; + this.compBitShift = componentBitShift; + this.compBitCount = new int[componentMask.length]; + int bpp = 0; + boolean uniform = true; + for(int i = componentMask.length-1; i>=0; i--) { + final int cmask = componentMask[i]; + final int bitCount = IntBitfield.getBitCount(cmask); + bpp += bitCount; + this.compBitCount[i] = bitCount; + if( i > 0 && uniform ) { + uniform = componentMask[i-1] == cmask; + } + } + this.uniform = uniform; + this.bitsPerPixel = bpp; + this.bitStride = bitStride; + if( this.bitStride < this.bitsPerPixel ) { + throw new IllegalArgumentException(String.format("bit-stride %d < bitsPerPixel %d", this.bitStride, this.bitsPerPixel)); + } + this.hashCode = hashCodeImpl(); + } + + @Override + public final boolean isUniform() { return uniform; } + /** + * {@inheritDoc} + * <p> + * Instances of {@link PackedComposition} returns {@code true}. + * </p> + */ + @Override + public final boolean isInterleaved() { return true; } + @Override + public final int componenCount() { return compMask.length; } + @Override + public final int bitsPerPixel() { return bitsPerPixel; } + @Override + public final int bitStride() { return bitStride; } + @Override + public final int bytesPerPixel() { return (7+bitStride)/8; } + @Override + public final CType[] componentOrder() { return compOrder; } + @Override + public final int find(final PixelFormat.CType s) { return PixelFormatUtil.find(s, compOrder, false /* mapRGB2Y */); } + @Override + public final int[] componentBitMask() { return compMask; } + @Override + public final int[] componentBitCount() { return compBitCount; } + @Override + public final int[] componentBitShift() { return compBitShift; } + + @Override + public final int decodeSingleI32(final int shifted, final int cIdx) { + return ( shifted >>> compBitShift[cIdx] ) & compMask[cIdx]; + } + @Override + public final int decodeSingleI64(final long shifted, final int cIdx) { + return ( (int)( 0xffffffffL & ( shifted >>> compBitShift[cIdx] ) ) ) & compMask[cIdx]; + } + @Override + public final int encodeSingleI32(final int norm, final int cIdx) { + return ( norm & compMask[cIdx] ) << compBitShift[cIdx] ; + } + @Override + public final long encodeSingleI64(final int norm, final int cIdx) { + return ( 0xffffffffL & ( norm & compMask[cIdx] ) ) << compBitShift[cIdx] ; + } + @Override + public final int encode3CompI32(final int c1NormI32, final int c2NormI32, final int c3NormI32) { + return ( c1NormI32 & compMask[0] ) << compBitShift[0] | + ( c2NormI32 & compMask[1] ) << compBitShift[1] | + ( c3NormI32 & compMask[2] ) << compBitShift[2] ; + } + @Override + public final int encode4CompI32(final int c1NormI32, final int c2NormI32, final int c3NormI32, final int c4NormI32) { + return ( c1NormI32 & compMask[0] ) << compBitShift[0] | + ( c2NormI32 & compMask[1] ) << compBitShift[1] | + ( c3NormI32 & compMask[2] ) << compBitShift[2] | + ( c4NormI32 & compMask[3] ) << compBitShift[3] ; + } + @Override + public final int encodeSingleI8(final byte normI8, final int cIdx) { + return ( normI8 & compMask[cIdx] ) << compBitShift[cIdx] ; + } + @Override + public final int encode3CompI8(final byte c1NormI8, final byte c2NormI8, final byte c3NormI8) { + return ( c1NormI8 & compMask[0] ) << compBitShift[0] | + ( c2NormI8 & compMask[1] ) << compBitShift[1] | + ( c3NormI8 & compMask[2] ) << compBitShift[2] ; + } + @Override + public final int encode4CompI8(final byte c1NormI8, final byte c2NormI8, final byte c3NormI8, final byte c4NormI8) { + return ( c1NormI8 & compMask[0] ) << compBitShift[0] | + ( c2NormI8 & compMask[1] ) << compBitShift[1] | + ( c3NormI8 & compMask[2] ) << compBitShift[2] | + ( c4NormI8 & compMask[3] ) << compBitShift[3] ; + } + + @Override + public final float toFloat(final int i32, final int cIdx, final boolean i32Shifted) { + if( i32Shifted ) { + return ( ( i32 >>> compBitShift[cIdx] ) & compMask[cIdx] ) / (float)( compMask[cIdx] ) ; + } else { + return ( i32 & compMask[cIdx] ) / (float)( compMask[cIdx] ) ; + } + } + @Override + public final int fromFloat(final float f, final int cIdx, final boolean shiftResult) { + final int v = (int)(f * compMask[cIdx] + 0.5f); + return shiftResult ? v << compBitShift[cIdx] : v; + } + + @Override + public final int defaultValue(final int cIdx, final boolean shiftResult) { + final int v = ( CType.A == compOrder[cIdx] || CType.Y == compOrder[cIdx] ) + ? compMask[cIdx] : 0; + return shiftResult ? v << compBitShift[cIdx] : v; + } + + @Override + public final int hashCode() { return hashCode; } + private final int hashCodeImpl() { + // 31 * x == (x << 5) - x + int hash = 31 + bitStride; + hash = ((hash << 5) - hash) + bitsPerPixel; + hash = ((hash << 5) - hash) + compMask.length; + for(int i=compOrder.length-1; i>=0; i--) { + hash = ((hash << 5) - hash) + compOrder[i].ordinal(); + } + for(int i=compMask.length-1; i>=0; i--) { + hash = ((hash << 5) - hash) + compMask[i]; + } + for(int i=compBitShift.length-1; i>=0; i--) { + hash = ((hash << 5) - hash) + compBitShift[i]; + } + return hash; + } + + @Override + public final boolean equals(final Object obj) { + if(this == obj) { return true; } + if( obj instanceof PackedComposition ) { + final PackedComposition other = (PackedComposition) obj; + return bitStride == other.bitStride && + bitsPerPixel == other.bitsPerPixel && + Arrays.equals(compOrder, other.compOrder) && + Arrays.equals(compMask, other.compMask) && + Arrays.equals(compBitShift, other.compBitShift); + } else { + return false; + } + } + } + + private static String toHexString(final int[] bitCount, final int[] mask, final int[] shift) { + final StringBuilder sb = new StringBuilder(); + sb.append("["); + final int l = mask.length; + for(int i=0; i < l; i++) { + if(i > 0) { + sb.append(", "); + } + sb.append(bitCount[i]).append(": "). + append("0x").append(Integer.toHexString(mask[i])).append(" << ").append(shift[i]); + } + return sb.append("]").toString(); + } +} diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/util/PixelFormatUtil.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/PixelFormatUtil.java new file mode 100644 index 000000000..180f02d72 --- /dev/null +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/PixelFormatUtil.java @@ -0,0 +1,600 @@ +/** + * Copyright (c) 2014 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.nativewindow.util; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.Arrays; + +import com.jogamp.common.nio.Buffers; +import com.jogamp.common.util.Bitstream; + +/** + * Pixel Rectangle Utilities. + * <p> + * All conversion methods are endian independent. + * </p> + */ +public class PixelFormatUtil { + private static boolean DEBUG = false; + + public static class ComponentMap { + /** + * Contains the source index for each destination index, + * length is {@link Composition#componenCount()} of destination. + */ + final int[] dst2src; + /** + * Contains the destination index for each source index, + * length is {@link Composition#componenCount()} of source. + */ + final int[] src2dst; + + /** + * Contains the source index of RGBA components. + */ + final int[] srcRGBA; + final boolean hasSrcRGB; + + public ComponentMap(final PixelFormat.Composition src, final PixelFormat.Composition dst) { + final int sCompCount = src.componenCount(); + final int dCompCount = dst.componenCount(); + final PixelFormat.CType[] sCompOrder = src.componentOrder(); + final PixelFormat.CType[] dCompOrder = dst.componentOrder(); + + dst2src = new int[dCompCount]; + for(int dIdx=0; dIdx<dCompCount; dIdx++) { + dst2src[dIdx] = PixelFormatUtil.find(dCompOrder[dIdx], sCompOrder, true); + } + src2dst = new int[sCompCount]; + for(int sIdx=0; sIdx<sCompCount; sIdx++) { + src2dst[sIdx] = PixelFormatUtil.find(sCompOrder[sIdx], dCompOrder, true); + } + srcRGBA = new int[4]; + srcRGBA[0] = PixelFormatUtil.find(PixelFormat.CType.R, sCompOrder, false); + srcRGBA[1] = PixelFormatUtil.find(PixelFormat.CType.G, sCompOrder, false); + srcRGBA[2] = PixelFormatUtil.find(PixelFormat.CType.B, sCompOrder, false); + srcRGBA[3] = PixelFormatUtil.find(PixelFormat.CType.A, sCompOrder, false); + hasSrcRGB = 0 <= srcRGBA[0] && 0 <= srcRGBA[1] && 0 <= srcRGBA[2]; + } + } + + public static final int find(final PixelFormat.CType s, + final PixelFormat.CType[] pool, final boolean mapRGB2Y) { + int i=pool.length-1; + while( i >= 0 && pool[i] != s) { i--; } + + if( 0 > i && mapRGB2Y && 1 == pool.length && pool[0] == PixelFormat.CType.Y && + ( PixelFormat.CType.R == s || + PixelFormat.CType.G == s || + PixelFormat.CType.B == s ) ) + { + // Special case, fallback for RGB mapping -> LUMINANCE/Y + return 0; + } else { + return i; + } + } + + /** + * Returns shifted bytes from the given {@code data} at given {@code offset} + * of maximal 4 {@code bytesPerPixel}. + * @param bytesPerPixel number of bytes per pixel to fetch, a maximum of 4 are allowed + * @param data byte buffer covering complete pixel at position {@code offset} + * @param offset byte offset of pixel {@code data} start + * @return the shifted 32bit integer value of the pixel + */ + public static int getShiftedI32(final int bytesPerPixel, final byte[] data, final int offset) { + if( bytesPerPixel <= 4 ) { + int shiftedI32 = 0; + for(int i=0; i<bytesPerPixel; i++) { + shiftedI32 |= ( 0xff & data[offset+i] ) << 8*i; + } + return shiftedI32; + } else { + throw new UnsupportedOperationException(bytesPerPixel+" bytesPerPixel too big, i.e. > 4"); + } + } + /** + * Returns shifted bytes from the given {@code data} at given {@code offset} + * of maximal 8 {@code bytesPerPixel}. + * @param bytesPerPixel number of bytes per pixel to fetch, a maximum of 4 are allowed + * @param data byte buffer covering complete pixel at position {@code offset} + * @param offset byte offset of pixel {@code data} start + * @return the shifted 64bit integer value of the pixel + */ + public static long getShiftedI64(final int bytesPerPixel, final byte[] data, final int offset) { + if( bytesPerPixel <= 8 ) { + long shiftedI64 = 0; + for(int i=0; i<bytesPerPixel; i++) { + shiftedI64 |= ( 0xff & data[offset+i] ) << 8*i; + } + return shiftedI64; + } else { + throw new UnsupportedOperationException(bytesPerPixel+" bytesPerPixel too big, i.e. > 8"); + } + } + /** + * Returns shifted bytes from the given {@code data} at current position + * of maximal 4 {@code bytesPerPixel}. + * @param bytesPerPixel number of bytes per pixel to fetch, a maximum of 4 are allowed + * @param data byte buffer covering complete pixel at position {@code offset} + * @param retainDataPos if true, absolute {@link ByteBuffer#get(int)} is used and the {@code data} position stays unchanged. + * Otherwise relative {@link ByteBuffer#get()} is used and the {@code data} position changes. + * @return the shifted 32bit integer value of the pixel + */ + public static int getShiftedI32(final int bytesPerPixel, final ByteBuffer data, final boolean retainDataPos) { + if( bytesPerPixel <= 4 ) { + int shiftedI32 = 0; + if( retainDataPos ) { + final int offset = data.position(); + for(int i=0; i<bytesPerPixel; i++) { + shiftedI32 |= ( 0xff & data.get(offset+i) ) << 8*i; + } + } else { + for(int i=0; i<bytesPerPixel; i++) { + shiftedI32 |= ( 0xff & data.get() ) << 8*i; + } + } + return shiftedI32; + } else { + throw new UnsupportedOperationException(bytesPerPixel+" bytesPerPixel too big, i.e. > 4"); + } + } + /** + * Returns shifted bytes from the given {@code data} at current position + * of maximal 8 {@code bytesPerPixel}. + * @param bytesPerPixel number of bytes per pixel to fetch, a maximum of 4 are allowed + * @param data byte buffer covering complete pixel at position {@code offset} + * @param retainDataPos if true, absolute {@link ByteBuffer#get(int)} is used and the {@code data} position stays unchanged. + * Otherwise relative {@link ByteBuffer#get()} is used and the {@code data} position changes. + * @return the shifted 64bit integer value of the pixel + */ + public static long getShiftedI64(final int bytesPerPixel, final ByteBuffer data, final boolean retainDataPos) { + if( bytesPerPixel <= 8 ) { + long shiftedI64 = 0; + if( retainDataPos ) { + final int offset = data.position(); + for(int i=0; i<bytesPerPixel; i++) { + shiftedI64 |= ( 0xff & data.get(offset+i) ) << 8*i; + } + } else { + for(int i=0; i<bytesPerPixel; i++) { + shiftedI64 |= ( 0xff & data.get() ) << 8*i; + } + } + return shiftedI64; + } else { + throw new UnsupportedOperationException(bytesPerPixel+" bytesPerPixel too big, i.e. > 8"); + } + } + + /** + * Returns the {@link PixelFormat} with reversed components of <code>fmt</code>. + * If no reversed {@link PixelFormat} is available, returns <code>fmt</code>. + */ + public static PixelFormat getReversed(final PixelFormat fmt) { + switch(fmt) { + case RGB565: + return PixelFormat.BGR565; + case BGR565: + return PixelFormat.RGB565; + case RGBA5551: + return PixelFormat.ABGR1555; + case ABGR1555: + return PixelFormat.RGBA5551; + case RGB888: + return PixelFormat.BGR888; + case BGR888: + return PixelFormat.RGB888; + case RGBA8888: + return PixelFormat.ABGR8888; + case ABGR8888: + return PixelFormat.RGBA8888; + case ARGB8888: + return PixelFormat.BGRA8888; + case BGRA8888: + return PixelFormat.ABGR8888; + default: + return fmt; + } + } + + public static int convertToInt32(final PixelFormat dst_fmt, final byte r, final byte g, final byte b, final byte a) { + switch(dst_fmt) { + case LUMINANCE: { + final byte l = ( byte) ( ( ( ( 0xff & r ) + ( 0xff & g ) + ( 0xff & b ) ) / 3 ) * a ); + return ( 0xff ) << 24 | ( 0xff & l ) << 16 | ( 0xff & l ) << 8 | ( 0xff & l ); + } + case RGB888: + return ( 0xff ) << 24 | ( 0xff & b ) << 16 | ( 0xff & g ) << 8 | ( 0xff & r ); + case BGR888: + return ( 0xff ) << 24 | ( 0xff & r ) << 16 | ( 0xff & g ) << 8 | ( 0xff & b ); + case RGBA8888: + return ( 0xff & a ) << 24 | ( 0xff & b ) << 16 | ( 0xff & g ) << 8 | ( 0xff & r ); + case ABGR8888: + return ( 0xff & r ) << 24 | ( 0xff & g ) << 16 | ( 0xff & b ) << 8 | ( 0xff & a ); + case ARGB8888: + return ( 0xff & b ) << 24 | ( 0xff & g ) << 16 | ( 0xff & r ) << 8 | ( 0xff & a ); + case BGRA8888: + return ( 0xff & a ) << 24 | ( 0xff & r ) << 16 | ( 0xff & g ) << 8 | ( 0xff & b ); + default: + throw new InternalError("Unhandled format "+dst_fmt); + } + } + + public static int convertToInt32(final PixelFormat dst_fmt, final PixelFormat src_fmt, final ByteBuffer src, int srcOff) { + final byte r, g, b, a; + switch(src_fmt) { + case LUMINANCE: + r = src.get(srcOff++); // R + g = r; // G + b = r; // B + a = (byte) 0xff; // A + break; + case RGB888: + r = src.get(srcOff++); // R + g = src.get(srcOff++); // G + b = src.get(srcOff++); // B + a = (byte) 0xff; // A + break; + case BGR888: + b = src.get(srcOff++); // B + g = src.get(srcOff++); // G + r = src.get(srcOff++); // R + a = (byte) 0xff; // A + break; + case RGBA8888: + r = src.get(srcOff++); // R + g = src.get(srcOff++); // G + b = src.get(srcOff++); // B + a = src.get(srcOff++); // A + break; + case ABGR8888: + a = src.get(srcOff++); // A + b = src.get(srcOff++); // B + g = src.get(srcOff++); // G + r = src.get(srcOff++); // R + break; + case ARGB8888: + a = src.get(srcOff++); // A + r = src.get(srcOff++); // R + g = src.get(srcOff++); // G + b = src.get(srcOff++); // B + break; + case BGRA8888: + b = src.get(srcOff++); // B + g = src.get(srcOff++); // G + r = src.get(srcOff++); // R + a = src.get(srcOff++); // A + break; + default: + throw new InternalError("Unhandled format "+src_fmt); + } + return convertToInt32(dst_fmt, r, g, b, a); + } + + public static int convertToInt32(final PixelFormat dest_fmt, final PixelFormat src_fmt, final int src_pixel) { + final byte r, g, b, a; + switch(src_fmt) { + case LUMINANCE: + r = (byte) ( src_pixel ); // R + g = r; // G + b = r; // B + a = (byte) 0xff; // A + break; + case RGB888: + r = (byte) ( src_pixel ); // R + g = (byte) ( src_pixel >>> 8 ); // G + b = (byte) ( src_pixel >>> 16 ); // B + a = (byte) 0xff; // A + break; + case BGR888: + b = (byte) ( src_pixel ); // B + g = (byte) ( src_pixel >>> 8 ); // G + r = (byte) ( src_pixel >>> 16 ); // R + a = (byte) 0xff; // A + break; + case RGBA8888: + r = (byte) ( src_pixel ); // R + g = (byte) ( src_pixel >>> 8 ); // G + b = (byte) ( src_pixel >>> 16 ); // B + a = (byte) ( src_pixel >>> 24 ); // A + break; + case ABGR8888: + a = (byte) ( src_pixel ); // A + b = (byte) ( src_pixel >>> 8 ); // B + g = (byte) ( src_pixel >>> 16 ); // G + r = (byte) ( src_pixel >>> 24 ); // R + break; + case ARGB8888: + a = (byte) ( src_pixel ); // A + r = (byte) ( src_pixel >>> 8 ); // R + g = (byte) ( src_pixel >>> 16 ); // G + b = (byte) ( src_pixel >>> 24 ); // B + break; + case BGRA8888: + b = (byte) ( src_pixel ); // B + g = (byte) ( src_pixel >>> 8 ); // G + r = (byte) ( src_pixel >>> 16 ); // R + a = (byte) ( src_pixel >>> 24 ); // A + break; + default: + throw new InternalError("Unhandled format "+src_fmt); + } + return convertToInt32(dest_fmt, r, g, b, a); + } + + public static PixelRectangle convert(final PixelRectangle src, + final PixelFormat destFmt, final int ddestStride, final boolean isGLOriented, + final boolean destIsDirect) { + final int width = src.getSize().getWidth(); + final int height = src.getSize().getHeight(); + final int bpp = destFmt.comp.bytesPerPixel(); + final int destStride; + if( 0 != ddestStride ) { + destStride = ddestStride; + } else { + destStride = bpp * width; + } + final int capacity = destStride*height; + final ByteBuffer destBB = destIsDirect ? Buffers.newDirectByteBuffer(capacity) : ByteBuffer.allocate(capacity).order(src.getPixels().order()); + convert(src, destBB, destFmt, isGLOriented, destStride); + return new PixelRectangle.GenericPixelRect(destFmt, src.getSize(), destStride, isGLOriented, destBB); + } + + /** + * @param src + * @param dst_bb {@link ByteBuffer} sink + * @param dst_fmt destination {@link PixelFormat} + * @param dst_glOriented if true, the source memory is laid out in OpenGL's coordinate system, <i>origin at bottom left</i>, + * otherwise <i>origin at top left</i>. + * @param dst_lineStride line stride in byte-size for destination, i.e. byte count from one line to the next. + * Must be >= {@link PixelFormat.Composition#bytesPerPixel() dst_fmt.comp.bytesPerPixel()} * width + * or {@code zero} for default stride. + * + * @throws IllegalStateException + * @throws IllegalArgumentException if {@code src_lineStride} or {@code dst_lineStride} is invalid + */ + public static void convert(final PixelRectangle src, + final ByteBuffer dst_bb, final PixelFormat dst_fmt, final boolean dst_glOriented, final int dst_lineStride) + throws IllegalStateException + { + convert(src.getSize().getWidth(), src.getSize().getHeight(), + src.getPixels(), src.getPixelformat(), src.isGLOriented(), src.getStride(), + dst_bb, dst_fmt, dst_glOriented, dst_lineStride); + } + + + /** + * @param width width of the to be converted pixel rectangle + * @param height height of the to be converted pixel rectangle + * @param src_bb {@link ByteBuffer} source + * @param src_fmt source {@link PixelFormat} + * @param src_glOriented if true, the source memory is laid out in OpenGL's coordinate system, <i>origin at bottom left</i>, + * otherwise <i>origin at top left</i>. + * @param src_lineStride line stride in byte-size for source, i.e. byte count from one line to the next. + * Must be >= {@link PixelFormat.Composition#bytesPerPixel() src_fmt.comp.bytesPerPixel()} * width + * or {@code zero} for default stride. + * @param dst_bb {@link ByteBuffer} sink + * @param dst_fmt destination {@link PixelFormat} + * @param dst_glOriented if true, the source memory is laid out in OpenGL's coordinate system, <i>origin at bottom left</i>, + * otherwise <i>origin at top left</i>. + * @param dst_lineStride line stride in byte-size for destination, i.e. byte count from one line to the next. + * Must be >= {@link PixelFormat.Composition#bytesPerPixel() dst_fmt.comp.bytesPerPixel()} * width + * or {@code zero} for default stride. + * + * @throws IllegalStateException + * @throws IllegalArgumentException if {@code src_lineStride} or {@code dst_lineStride} is invalid + */ + public static void convert(final int width, final int height, + final ByteBuffer src_bb, final PixelFormat src_fmt, final boolean src_glOriented, int src_lineStride, + final ByteBuffer dst_bb, final PixelFormat dst_fmt, final boolean dst_glOriented, int dst_lineStride + ) throws IllegalStateException, IllegalArgumentException { + final PixelFormat.Composition src_comp = src_fmt.comp; + final PixelFormat.Composition dst_comp = dst_fmt.comp; + final int src_bpp = src_comp.bytesPerPixel(); + final int dst_bpp = dst_comp.bytesPerPixel(); + + if( 0 != src_lineStride ) { + if( src_lineStride < src_bpp * width ) { + throw new IllegalArgumentException(String.format("Invalid %s stride %d, must be greater than bytesPerPixel %d * width %d", + "source", src_lineStride, src_bpp, width)); + } + } else { + src_lineStride = src_bpp * width; + } + if( 0 != dst_lineStride ) { + if( dst_lineStride < dst_bpp * width ) { + throw new IllegalArgumentException(String.format("Invalid %s stride %d, must be greater than bytesPerPixel %d * width %d", + "destination", dst_lineStride, dst_bpp, width)); + } + } else { + dst_lineStride = dst_bpp * width; + } + + // final int src_comp_bitStride = src_comp.bitStride(); + final int dst_comp_bitStride = dst_comp.bitStride(); + final boolean vert_flip = src_glOriented != dst_glOriented; + final boolean fast_copy = src_comp.equals(dst_comp) && 0 == dst_comp_bitStride%8; + if( DEBUG ) { + System.err.println("XXX: size "+width+"x"+height+", fast_copy "+fast_copy); + System.err.println("XXX: SRC fmt "+src_fmt+", "+src_comp+", stride "+src_lineStride+", isGLOrient "+src_glOriented); + System.err.println("XXX: DST fmt "+dst_fmt+", "+dst_comp+", stride "+dst_lineStride+", isGLOrient "+dst_glOriented); + } + + if( fast_copy ) { + // Fast copy + for(int y=0; y<height; y++) { + int src_off = vert_flip ? ( height - 1 - y ) * src_lineStride : y * src_lineStride; + int dst_off = dst_lineStride*y; + for(int x=0; x<width; x++) { + dst_bb.put(dst_off+0, src_bb.get(src_off+0)); // 1 + if( 2 <= dst_bpp ) { + dst_bb.put(dst_off+1, src_bb.get(src_off+1)); // 2 + if( 3 <= dst_bpp ) { + dst_bb.put(dst_off+2, src_bb.get(src_off+2)); // 3 + if( 4 <= dst_bpp ) { + dst_bb.put(dst_off+3, src_bb.get(src_off+3)); // 4 + } + } + } + src_off += src_bpp; + dst_off += dst_bpp; + } + } + } else { + // Conversion + final ComponentMap cmap = new ComponentMap(src_fmt.comp, dst_fmt.comp); + + final Bitstream.ByteBufferStream srcBBS = new Bitstream.ByteBufferStream(src_bb); + final Bitstream<ByteBuffer> srcBitStream = new Bitstream<ByteBuffer>(srcBBS, false /* outputMode */); + srcBitStream.setThrowIOExceptionOnEOF(true); + + final Bitstream.ByteBufferStream dstBBS = new Bitstream.ByteBufferStream(dst_bb); + final Bitstream<ByteBuffer> dstBitStream = new Bitstream<ByteBuffer>(dstBBS, true /* outputMode */); + dstBitStream.setThrowIOExceptionOnEOF(true); + + if( DEBUG ) { + System.err.println("XXX: cmap.dst2src "+Arrays.toString(cmap.dst2src)); + System.err.println("XXX: cmap.src2dst "+Arrays.toString(cmap.src2dst)); + System.err.println("XXX: cmap.srcRGBA "+Arrays.toString(cmap.srcRGBA)); + System.err.println("XXX: srcBitStream "+srcBitStream); + System.err.println("XXX: dstBitStream "+dstBitStream); + } + try { + for(int y=0; y<height; y++) { + final int src_off = vert_flip ? ( height - 1 - y ) * src_lineStride * 8 : y * src_lineStride * 8; + // final int dst_off = dst_lineStride*8*y; + srcBitStream.position(src_off); + for(int x=0; x<width; x++) { + convert(cmap, dst_comp, dstBitStream, src_comp, srcBitStream); + } + // srcBitStream.skip(( src_lineStride * 8 ) - ( src_comp_bitStride * width )); + dstBitStream.skip(( dst_lineStride * 8 ) - ( dst_comp_bitStride * width )); + } + } catch(final IOException ioe) { + throw new RuntimeException(ioe); + } + if( DEBUG ) { + System.err.println("XXX: srcBitStream "+srcBitStream); + System.err.println("XXX: dstBitStream "+dstBitStream); + } + } + } + + public static void convert(final ComponentMap cmap, + final PixelFormat.Composition dstComp, + final Bitstream<ByteBuffer> dstBitStream, + final PixelFormat.Composition srcComp, + final Bitstream<ByteBuffer> srcBitStream) throws IllegalStateException, IOException { + final int sCompCount = srcComp.componenCount(); + final int dCompCount = dstComp.componenCount(); + final int[] sc = new int[sCompCount]; + final int[] dcDef = new int[dCompCount]; + final int[] srcCompBitCount = srcComp.componentBitCount(); + final int[] srcCompBitMask = srcComp.componentBitMask(); + final int[] dstCompBitCount = dstComp.componentBitCount(); + + // Fill w/ source values + for(int sIdx=0; sIdx<sCompCount; sIdx++) { + sc[sIdx] = srcBitStream.readBits31(srcCompBitCount[sIdx]) & srcCompBitMask[sIdx]; + } + srcBitStream.skip(srcComp.bitStride() - srcComp.bitsPerPixel()); + + // Cache missing defaults + for(int i=0; i<dCompCount; i++) { + dcDef[i] = dstComp.defaultValue(i, false); + } + + if( 1 == dCompCount && + PixelFormat.CType.Y == dstComp.componentOrder()[0] && + cmap.hasSrcRGB + ) + { + // RGB[A] -> Y conversion + final int r = sc[cmap.srcRGBA[0]]; + final int g = sc[cmap.srcRGBA[1]]; + final int b = sc[cmap.srcRGBA[2]]; + final float rF = srcComp.toFloat(r, cmap.srcRGBA[0], false); + final float gF = srcComp.toFloat(g, cmap.srcRGBA[1], false); + final float bF = srcComp.toFloat(b, cmap.srcRGBA[2], false); + final int a; + final float aF; + /** if( 0 <= cmap.srcRGBA[3] ) { // disable premultiplied-alpha + a = sc[cmap.srcRGBA[3]]; + aF = srcComp.toFloat(a, false, cmap.srcRGBA[3]); + } else */ { + a = 1; + aF = 1f; + } + final float lF = ( rF + gF + bF ) * aF / 3f; + final int v = dstComp.fromFloat(lF, 0, false); + + dstBitStream.writeBits31(dstCompBitCount[0], v); + dstBitStream.skip(dstComp.bitStride() - dstComp.bitsPerPixel()); + if( DEBUG ) { + if( srcBitStream.position() <= 8*4 ) { + System.err.printf("convert: rgb[a] -> Y: rgb 0x%02X 0x%02X 0x%02X 0x%02X -> %f %f %f %f"+ + " -> %f -> dstC 0 0x%08X (%d bits: %s)%n", + r, g, b, a, + rF, gF, bF, aF, + lF, v, dstCompBitCount[0], Bitstream.toBinString(true, v, dstCompBitCount[0]) + ); + } + } + return; + } + + for(int dIdx=0; dIdx<dCompCount; dIdx++) { + int sIdx; + if( 0 <= ( sIdx = cmap.dst2src[dIdx] ) ) { + final float f = srcComp.toFloat(sc[sIdx], sIdx, false); + final int v = dstComp.fromFloat(f, dIdx, false); + dstBitStream.writeBits31(dstCompBitCount[dIdx], v); + if( DEBUG ) { + if( srcBitStream.position() <= 8*4 ) { + System.err.printf("convert: srcC %d: 0x%08X -> %f -> dstC %d 0x%08X (%d bits: %s)%n", + sIdx, sc[sIdx], f, dIdx, v, dstCompBitCount[dIdx], Bitstream.toBinString(true, v, dstCompBitCount[dIdx])); + } + } + } else { + dstBitStream.writeBits31(dstCompBitCount[dIdx], dcDef[dIdx]); + if( DEBUG ) { + if( srcBitStream.position() <= 8*4 ) { + System.err.printf("convert: srcC %d: undef -> dstC %d 0x%08X (%d bits: %s)%n", + sIdx, dIdx, dcDef[dIdx], dstCompBitCount[dIdx], Bitstream.toBinString(true, dcDef[dIdx], dstCompBitCount[dIdx])); + } + } + } + } + dstBitStream.skip(dstComp.bitStride() - dstComp.bitsPerPixel()); + return; + } +} + diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PixelRectangle.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/PixelRectangle.java index 96c1f7b33..f58ba0ce2 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/PixelRectangle.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/PixelRectangle.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package javax.media.nativewindow.util; +package com.jogamp.nativewindow.util; import java.nio.ByteBuffer; @@ -113,11 +113,11 @@ public interface PixelRectangle { throws IllegalArgumentException, IndexOutOfBoundsException { if( 0 != strideInBytes ) { - if( strideInBytes < pixelformat.bytesPerPixel() * size.getWidth()) { - throw new IllegalArgumentException("Invalid stride "+strideInBytes+", must be greater than bytesPerPixel "+pixelformat.bytesPerPixel()+" * width "+size.getWidth()); + if( strideInBytes < pixelformat.comp.bytesPerPixel() * size.getWidth()) { + throw new IllegalArgumentException("Invalid stride "+strideInBytes+", must be greater than bytesPerPixel "+pixelformat.comp.bytesPerPixel()+" * width "+size.getWidth()); } } else { - strideInBytes = pixelformat.bytesPerPixel() * size.getWidth(); + strideInBytes = pixelformat.comp.bytesPerPixel() * size.getWidth(); } final int reqBytes = strideInBytes * size.getHeight(); if( pixels.limit() < reqBytes ) { @@ -148,7 +148,7 @@ public interface PixelRectangle { synchronized (this) { if( !hashCodeComputed ) { // 31 * x == (x << 5) - x - int hash = 31 + pixelformat.hashCode(); + int hash = pixelformat.comp.hashCode(); hash = ((hash << 5) - hash) + size.hashCode(); hash = ((hash << 5) - hash) + strideInBytes; hash = ((hash << 5) - hash) + ( isGLOriented ? 1 : 0); diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/Point.java index 3576a7dd0..fc5465bbf 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/Point.java @@ -27,7 +27,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow.util; +package com.jogamp.nativewindow.util; public class Point implements Cloneable, PointImmutable { int x; @@ -145,6 +145,22 @@ public class Point implements Cloneable, PointImmutable { } /** + * Scale this instance's x- and y-components, + * i.e. multiply them by the given scale factors. + * <p> + * The product is rounded back to integer. + * </p> + * @param sx scale factor for x + * @param sy scale factor for y + * @return this instance for scaling + */ + public final Point scale(final float sx, final float sy) { + x = (int)(x * sx + 0.5f); + y = (int)(y * sy + 0.5f); + return this; + } + + /** * Inverse scale this instance's x- and y-components, * i.e. divide them by the given scale factors. * @param sx inverse scale factor for x @@ -156,4 +172,19 @@ public class Point implements Cloneable, PointImmutable { y /= sy ; return this; } + /** + * Inverse scale this instance's x- and y-components, + * i.e. divide them by the given scale factors. + * <p> + * The product is rounded back to integer. + * </p> + * @param sx inverse scale factor for x + * @param sy inverse scale factor for y + * @return this instance for scaling + */ + public final Point scaleInv(final float sx, final float sy) { + x = (int)(x / sx + 0.5f); + y = (int)(y / sy + 0.5f); + return this; + } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/PointImmutable.java index 08c628cc1..59372f67d 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/PointImmutable.java @@ -27,7 +27,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow.util; +package com.jogamp.nativewindow.util; import com.jogamp.common.type.WriteCloneable; diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/Rectangle.java index c30968c4b..33a1955e8 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/Rectangle.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow.util; +package com.jogamp.nativewindow.util; import java.util.List; diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/RectangleImmutable.java index 7ca92ff53..ff2209598 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/RectangleImmutable.java @@ -26,7 +26,7 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow.util; +package com.jogamp.nativewindow.util; import com.jogamp.common.type.WriteCloneable; diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/util/SurfaceSize.java index 601e6dd71..b9e6ded95 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/util/SurfaceSize.java @@ -27,12 +27,12 @@ * or implied, of JogAmp Community. */ -package javax.media.nativewindow.util; +package com.jogamp.nativewindow.util; /** * Immutable SurfaceSize Class, consisting of it's read only components:<br> * <ul> - * <li>{@link javax.media.nativewindow.util.DimensionImmutable size in pixels}</li> + * <li>{@link com.jogamp.nativewindow.util.DimensionImmutable size in pixels}</li> * <li><code>bits per pixel</code></li> * </ul> */ @@ -105,7 +105,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> { @Override public final int hashCode() { // 31 * x == (x << 5) - x - int hash = 31 + getResolution().hashCode(); + int hash = getResolution().hashCode(); hash = ((hash << 5) - hash) + getBitsPerPixel(); return hash; } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java index ef0cbddd7..549f4d21e 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java @@ -32,7 +32,7 @@ package com.jogamp.nativewindow.windows; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; /** * Encapsulates a graphics device on Windows platforms.<br> diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java index 223cb5194..04619962d 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java @@ -33,7 +33,7 @@ package com.jogamp.nativewindow.x11; -import javax.media.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.CapabilitiesImmutable; import com.jogamp.nativewindow.MutableGraphicsConfiguration; @@ -41,7 +41,7 @@ import jogamp.nativewindow.x11.XVisualInfo; /** Encapsulates a graphics configuration, or OpenGL pixel format, on X11 platforms. Objects of this type are returned from {@link - javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration + com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration GraphicsConfigurationFactory.chooseGraphicsConfiguration()} on X11 platforms when toolkits other than the AWT are being used. */ diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java index fea4e7019..5e706884c 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java @@ -36,10 +36,10 @@ package com.jogamp.nativewindow.x11; import jogamp.nativewindow.x11.X11Lib; import jogamp.nativewindow.x11.X11Util; -import javax.media.nativewindow.DefaultGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.ToolkitLock; +import com.jogamp.nativewindow.DefaultGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ToolkitLock; /** Encapsulates a graphics device on X11 platforms. */ @@ -49,7 +49,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl final boolean isXineramaEnabled; /** Constructs a new X11GraphicsDevice corresponding to the given connection and default - * {@link javax.media.nativewindow.ToolkitLock} via {@link NativeWindowFactory#getDefaultToolkitLock(String)}.<br> + * {@link com.jogamp.nativewindow.ToolkitLock} via {@link NativeWindowFactory#getDefaultToolkitLock(String)}.<br> * Note that this is not an open connection, ie no native display handle exist. * This constructor exist to setup a default device connection. * @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int) @@ -61,7 +61,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl } /** Constructs a new X11GraphicsDevice corresponding to the given native display handle and default - * {@link javax.media.nativewindow.ToolkitLock} via {@link NativeWindowFactory#getDefaultToolkitLock(String, long)}. + * {@link com.jogamp.nativewindow.ToolkitLock} via {@link NativeWindowFactory#getDefaultToolkitLock(String, long)}. * @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int, long) */ public X11GraphicsDevice(final long display, final int unitID, final boolean owner) { @@ -70,7 +70,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl /** * @param display the Display connection - * @param locker custom {@link javax.media.nativewindow.ToolkitLock}, eg to force null locking w/ private connection + * @param locker custom {@link com.jogamp.nativewindow.ToolkitLock}, eg to force null locking w/ private connection * @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int, long, ToolkitLock) */ public X11GraphicsDevice(final long display, final int unitID, final ToolkitLock locker, final boolean owner) { @@ -88,7 +88,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * The constructor opens the native connection and takes ownership. * </p> * @param displayConnection the semantic display connection name - * @param locker custom {@link javax.media.nativewindow.ToolkitLock}, eg to force null locking w/ private connection + * @param locker custom {@link com.jogamp.nativewindow.ToolkitLock}, eg to force null locking w/ private connection * @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int, long, ToolkitLock) */ public X11GraphicsDevice(final String displayConnection, final int unitID, final ToolkitLock locker) { diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java index 8ebf3c379..82ae92288 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java @@ -33,16 +33,16 @@ package com.jogamp.nativewindow.x11; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.NativeWindowException; import jogamp.nativewindow.x11.X11Lib; /** Encapsulates a screen index on X11 platforms. Objects of this type are passed to {@link - javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration + com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration GraphicsConfigurationFactory.chooseGraphicsConfiguration()} on X11 platforms when toolkits other than the AWT are being used. */ diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java b/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java deleted file mode 100644 index e5901f584..000000000 --- a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java +++ /dev/null @@ -1,197 +0,0 @@ -/** - * Copyright (c) 2014 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ - -package javax.media.nativewindow.util; - -/** - * Basic pixel formats - * <p> - * Notation follows OpenGL notation, i.e. - * name consist of all it's component names - * followed by their bit size. - * </p> - * <p> - * Order of component names is from lowest-bit to highest-bit. - * </p> - * <p> - * In case component-size is 1 byte (e.g. OpenGL data-type GL_UNSIGNED_BYTE), - * component names are ordered from lowest-byte to highest-byte. - * Note that OpenGL applies special interpretation if - * data-type is e.g. GL_UNSIGNED_8_8_8_8_REV or GL_UNSIGNED_8_8_8_8_REV. - * </p> - * <p> - * PixelFormat can be converted to OpenGL GLPixelAttributes - * via - * <pre> - * GLPixelAttributes glpa = GLPixelAttributes.convert(PixelFormat pixFmt, GLProfile glp); - * </pre> - * </p> - * <p> - * See OpenGL Specification 4.3 - February 14, 2013, Core Profile, - * Section 8.4.4 Transfer of Pixel Rectangles, p. 161-174. - * </ul> - * - * </p> - */ -public enum PixelFormat { - /** - * Pixel size is 1 bytes (8 bits) with one component of size 1 byte (8 bits). - * Compatible with: - * <ul> - * <li>OpenGL: data-format GL_ALPHA (< GL3), GL_RED (>= GL3), data-type GL_UNSIGNED_BYTE</li> - * <li>AWT: <i>none</i></li> - * </ul> - * </p> - */ - LUMINANCE(1, 8), - - /** - * Pixel size is 3 bytes (24 bits) with each component of size 1 byte (8 bits). - * <p> - * The components are interleaved in the order: - * <ul> - * <li>Low to High: R, G, B</li> - * </ul> - * </p> - * <p> - * Compatible with: - * <ul> - * <li>OpenGL: data-format GL_RGB, data-type GL_UNSIGNED_BYTE</li> - * <li>AWT: <i>None</i></li> - * </ul> - * </p> - */ - RGB888(3, 24), - - /** - * Pixel size is 3 bytes (24 bits) with each component of size 1 byte (8 bits). - * <p> - * The components are interleaved in the order: - * <ul> - * <li>Low to High: B, G, R</li> - * </ul> - * </p> - * <p> - * Compatible with: - * <ul> - * <li>OpenGL: data-format GL_BGR (>= GL2), data-type GL_UNSIGNED_BYTE</li> - * <li>AWT: {@link java.awt.image.BufferedImage#TYPE_3BYTE_BGR TYPE_3BYTE_BGR}</li> - * </ul> - * </p> - */ - BGR888(3, 24), - - /** - * Pixel size is 4 bytes (32 bits) with each component of size 1 byte (8 bits). - * <p> - * The components are interleaved in the order: - * <ul> - * <li>Low to High: R, G, B, A</li> - * </ul> - * </p> - * <p> - * Compatible with: - * <ul> - * <li>OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_BYTE</li> - * <li>AWT: <i>None</i></li> - * <li>PointerIcon: OSX (NSBitmapImageRep)</li> - * <li>Window Icon: OSX (NSBitmapImageRep)</li> - * <li>PNGJ: Scanlines</li> - * </ul> - * </p> - */ - RGBA8888(4, 32), - - /** - * Pixel size is 4 bytes (32 bits) with each component of size 1 byte (8 bits). - * <p> - * The components are interleaved in the order: - * <ul> - * <li>Low to High: A, B, G, R</li> - * </ul> - * </p> - * <p> - * Compatible with: - * <ul> - * <li>OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_8_8_8_8</li> - * <li>AWT: {@link java.awt.image.BufferedImage#TYPE_4BYTE_ABGR TYPE_4BYTE_ABGR}</li> - * </ul> - * </p> - */ - ABGR8888(4, 32), - - /** - * Pixel size is 4 bytes (32 bits) with each component of size 1 byte (8 bits). - * <p> - * The components are interleaved in the order: - * <ul> - * <li>Low to High: A, R, G, B</li> - * </ul> - * </p> - * <p> - * Compatible with: - * <ul> - * <li>OpenGL: data-format GL_BGRA, data-type GL_UNSIGNED_INT_8_8_8_8</li> - * <li>AWT: <i>None</i></li> - * </ul> - * </p> - */ - ARGB8888(4, 32), - - /** - * Pixel size is 4 bytes (32 bits) with each component of size 1 byte (8 bits). - * <p> - * The components are interleaved in the order: - * <ul> - * <li>Low to High: B, G, R, A</li> - * </ul> - * </p> - * <p> - * Compatible with: - * <ul> - * <li>OpenGL: data-format GL_BGRA, data-type GL_UNSIGNED_BYTE</li> - * <li>AWT: {@link java.awt.image.BufferedImage#TYPE_INT_ARGB TYPE_INT_ARGB}</li> - * <li>PointerIcon: X11 (XCURSOR), Win32, AWT</li> - * <li>Window Icon: X11, Win32</li> - * </ul> - * </p> - */ - BGRA8888(4, 32); - - /** Number of components per pixel, e.g. 4 for RGBA. */ - public final int componentCount; - /** Number of bits per pixel, e.g. 32 for RGBA. */ - public final int bitsPerPixel; - /** Number of bytes per pixel, e.g. 4 for RGBA. */ - public final int bytesPerPixel() { return (7+bitsPerPixel)/8; } - - private PixelFormat(final int componentCount, final int bpp) { - this.componentCount = componentCount; - this.bitsPerPixel = bpp; - } -} diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java b/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java deleted file mode 100644 index 21bfa8a54..000000000 --- a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java +++ /dev/null @@ -1,373 +0,0 @@ -/** - * Copyright (c) 2014 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ -package javax.media.nativewindow.util; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -import com.jogamp.common.nio.Buffers; - -/** - * Pixel Rectangle Utilities. - * <p> - * All conversion methods are endian independent. - * </p> - */ -public class PixelFormatUtil { - public static interface PixelSink { - /** Return the sink's destination pixelformat. */ - PixelFormat getPixelformat(); - - /** - * Returns stride in byte-size, i.e. byte count from one line to the next. - * <p> - * Must be >= {@link #getPixelformat()}.{@link PixelFormat#bytesPerPixel() bytesPerPixel()} * {@link #getSize()}.{@link DimensionImmutable#getWidth() getWidth()}. - * </p> - */ - int getStride(); - - /** - * Returns <code>true</code> if the sink's memory is laid out in - * OpenGL's coordinate system, <i>origin at bottom left</i>. - * Otherwise returns <code>false</code>, i.e. <i>origin at top left</i>. - */ - boolean isGLOriented(); - } - /** - * Pixel sink for up-to 32bit. - */ - public static interface PixelSink32 extends PixelSink { - /** - * Will be invoked over all rows top-to down - * and all columns left-to-right. - * <p> - * Shall consider dest pixelformat and only store as much components - * as defined, up to 32bit. - * </p> - * <p> - * Implementation may better write single bytes from low-to-high bits, - * e.g. {@link ByteOrder#LITTLE_ENDIAN} order. - * Otherwise a possible endian conversion must be taken into consideration. - * </p> - * @param x - * @param y - * @param pixel - */ - void store(int x, int y, int pixel); - } - - /** - * Returns the {@link PixelFormat} with reversed components of <code>fmt</code>. - * If no reversed {@link PixelFormat} is available, returns <code>fmt</code>. - */ - public static PixelFormat getReversed(final PixelFormat fmt) { - switch(fmt) { - case LUMINANCE: - return PixelFormat.LUMINANCE; - case RGB888: - return PixelFormat.BGR888; - case BGR888: - return PixelFormat.RGB888; - case RGBA8888: - return PixelFormat.ABGR8888; - case ABGR8888: - return PixelFormat.RGBA8888; - case ARGB8888: - return PixelFormat.BGRA8888; - case BGRA8888: - return PixelFormat.ABGR8888; - default: - throw new InternalError("Unhandled format "+fmt); - } - } - - public static int getValue32(final PixelFormat src_fmt, final ByteBuffer src, int srcOff) { - switch(src_fmt) { - case LUMINANCE: { - final byte c1 = src.get(srcOff++); - return ( 0xff ) << 24 | ( 0xff & c1 ) << 16 | ( 0xff & c1 ) << 8 | ( 0xff & c1 ); - } - case RGB888: - case BGR888: { - final byte c1 = src.get(srcOff++); - final byte c2 = src.get(srcOff++); - final byte c3 = src.get(srcOff++); - return ( 0xff ) << 24 | ( 0xff & c3 ) << 16 | ( 0xff & c2 ) << 8 | ( 0xff & c1 ); - } - case RGBA8888: - case ABGR8888: - case ARGB8888: - case BGRA8888: { - final byte c1 = src.get(srcOff++); - final byte c2 = src.get(srcOff++); - final byte c3 = src.get(srcOff++); - final byte c4 = src.get(srcOff++); - return ( 0xff & c4 ) << 24 | ( 0xff & c3 ) << 16 | ( 0xff & c2 ) << 8 | ( 0xff & c1 ); - } - default: - throw new InternalError("Unhandled format "+src_fmt); - } - } - - public static int convertToInt32(final PixelFormat dest_fmt, final byte r, final byte g, final byte b, final byte a) { - switch(dest_fmt) { - case LUMINANCE: { - final byte l = ( byte) ( ( ( ( 0xff & r ) + ( 0xff & g ) + ( 0xff & b ) ) / 3 ) ); - return ( 0xff ) << 24 | ( 0xff & l ) << 16 | ( 0xff & l ) << 8 | ( 0xff & l ); - } - case RGB888: - return ( 0xff ) << 24 | ( 0xff & b ) << 16 | ( 0xff & g ) << 8 | ( 0xff & r ); - case BGR888: - return ( 0xff ) << 24 | ( 0xff & r ) << 16 | ( 0xff & g ) << 8 | ( 0xff & b ); - case RGBA8888: - return ( 0xff & a ) << 24 | ( 0xff & b ) << 16 | ( 0xff & g ) << 8 | ( 0xff & r ); - case ABGR8888: - return ( 0xff & r ) << 24 | ( 0xff & g ) << 16 | ( 0xff & b ) << 8 | ( 0xff & a ); - case ARGB8888: - return ( 0xff & b ) << 24 | ( 0xff & g ) << 16 | ( 0xff & r ) << 8 | ( 0xff & a ); - case BGRA8888: - return ( 0xff & a ) << 24 | ( 0xff & r ) << 16 | ( 0xff & g ) << 8 | ( 0xff & b ); - default: - throw new InternalError("Unhandled format "+dest_fmt); - } - } - - public static int convertToInt32(final PixelFormat dest_fmt, final PixelFormat src_fmt, final ByteBuffer src, int srcOff) { - final byte r, g, b, a; - switch(src_fmt) { - case LUMINANCE: - r = src.get(srcOff++); // R - g = r; // G - b = r; // B - a = (byte) 0xff; // A - break; - case RGB888: - r = src.get(srcOff++); // R - g = src.get(srcOff++); // G - b = src.get(srcOff++); // B - a = (byte) 0xff; // A - break; - case BGR888: - b = src.get(srcOff++); // B - g = src.get(srcOff++); // G - r = src.get(srcOff++); // R - a = (byte) 0xff; // A - break; - case RGBA8888: - r = src.get(srcOff++); // R - g = src.get(srcOff++); // G - b = src.get(srcOff++); // B - a = src.get(srcOff++); // A - break; - case ABGR8888: - a = src.get(srcOff++); // A - b = src.get(srcOff++); // B - g = src.get(srcOff++); // G - r = src.get(srcOff++); // R - break; - case ARGB8888: - a = src.get(srcOff++); // A - r = src.get(srcOff++); // R - g = src.get(srcOff++); // G - b = src.get(srcOff++); // B - break; - case BGRA8888: - b = src.get(srcOff++); // B - g = src.get(srcOff++); // G - r = src.get(srcOff++); // R - a = src.get(srcOff++); // A - break; - default: - throw new InternalError("Unhandled format "+src_fmt); - } - return convertToInt32(dest_fmt, r, g, b, a); - } - - public static int convertToInt32(final PixelFormat dest_fmt, final PixelFormat src_fmt, final int src_pixel) { - final byte r, g, b, a; - switch(src_fmt) { - case LUMINANCE: - r = (byte) ( src_pixel ); // R - g = r; // G - b = r; // B - a = (byte) 0xff; // A - break; - case RGB888: - r = (byte) ( src_pixel ); // R - g = (byte) ( src_pixel >>> 8 ); // G - b = (byte) ( src_pixel >>> 16 ); // B - a = (byte) 0xff; // A - break; - case BGR888: - b = (byte) ( src_pixel ); // B - g = (byte) ( src_pixel >>> 8 ); // G - r = (byte) ( src_pixel >>> 16 ); // R - a = (byte) 0xff; // A - break; - case RGBA8888: - r = (byte) ( src_pixel ); // R - g = (byte) ( src_pixel >>> 8 ); // G - b = (byte) ( src_pixel >>> 16 ); // B - a = (byte) ( src_pixel >>> 24 ); // A - break; - case ABGR8888: - a = (byte) ( src_pixel ); // A - b = (byte) ( src_pixel >>> 8 ); // B - g = (byte) ( src_pixel >>> 16 ); // G - r = (byte) ( src_pixel >>> 24 ); // R - break; - case ARGB8888: - a = (byte) ( src_pixel ); // A - r = (byte) ( src_pixel >>> 8 ); // R - g = (byte) ( src_pixel >>> 16 ); // G - b = (byte) ( src_pixel >>> 24 ); // B - break; - case BGRA8888: - b = (byte) ( src_pixel ); // B - g = (byte) ( src_pixel >>> 8 ); // G - r = (byte) ( src_pixel >>> 16 ); // R - a = (byte) ( src_pixel >>> 24 ); // A - break; - default: - throw new InternalError("Unhandled format "+src_fmt); - } - return convertToInt32(dest_fmt, r, g, b, a); - } - - public static PixelRectangle convert32(final PixelRectangle src, - final PixelFormat destFmt, final int ddestStride, final boolean isGLOriented, - final boolean destIsDirect) { - final int width = src.getSize().getWidth(); - final int height = src.getSize().getHeight(); - final int bpp = destFmt.bytesPerPixel(); - final int destStride; - if( 0 != ddestStride ) { - destStride = ddestStride; - if( destStride < bpp * width ) { - throw new IllegalArgumentException("Invalid stride "+destStride+", must be greater than bytesPerPixel "+bpp+" * width "+width); - } - } else { - destStride = bpp * width; - } - final int capacity = destStride*height; - final ByteBuffer bb = destIsDirect ? Buffers.newDirectByteBuffer(capacity) : ByteBuffer.allocate(capacity).order(src.getPixels().order()); - - // System.err.println("XXX: SOURCE "+src); - // System.err.println("XXX: DEST fmt "+destFmt+", stride "+destStride+" ("+ddestStride+"), isGL "+isGLOriented+", "+width+"x"+height+", capacity "+capacity+", "+bb); - - final PixelFormatUtil.PixelSink32 imgSink = new PixelFormatUtil.PixelSink32() { - public void store(final int x, final int y, final int pixel) { - int o = destStride*y+x*bpp; - bb.put(o++, (byte) ( pixel )); // 1 - if( 3 <= bpp ) { - bb.put(o++, (byte) ( pixel >>> 8 )); // 2 - bb.put(o++, (byte) ( pixel >>> 16 )); // 3 - if( 4 <= bpp ) { - bb.put(o++, (byte) ( pixel >>> 24 )); // 4 - } - } - } - @Override - public final PixelFormat getPixelformat() { - return destFmt; - } - @Override - public final int getStride() { - return destStride; - } - @Override - public final boolean isGLOriented() { - return isGLOriented; - } - }; - convert32(imgSink, src); - return new PixelRectangle.GenericPixelRect(destFmt, src.getSize(), destStride, isGLOriented, bb); - } - - public static void convert32(final PixelSink32 destInt32, final PixelRectangle src) { - convert32(destInt32, - src.getPixels(), src.getPixelformat(), - src.isGLOriented(), - src.getSize().getWidth(), src.getSize().getHeight(), - src.getStride()); - } - - /** - * - * @param dest32 32bit pixel sink - * @param src_bb - * @param src_fmt - * @param src_glOriented if true, the source memory is laid out in OpenGL's coordinate system, <i>origin at bottom left</i>, - * otherwise <i>origin at top left</i>. - * @param width - * @param height - * @param strideInBytes stride in byte-size, i.e. byte count from one line to the next. - * If zero, stride is set to <code>width * bytes-per-pixel</code>. - * If not zero, value must be >= <code>width * bytes-per-pixel</code>. - * @param stride_bytes stride in byte-size, i.e. byte count from one line to the next. - * Must be >= {@link PixelFormat#bytesPerPixel() src_fmt.bytesPerPixel()} * width. - * @throws IllegalArgumentException if <code>strideInBytes</code> is invalid - */ - public static void convert32(final PixelSink32 dest32, - final ByteBuffer src_bb, final PixelFormat src_fmt, final boolean src_glOriented, final int width, final int height, int stride_bytes) { - final int src_bpp = src_fmt.bytesPerPixel(); - if( 0 != stride_bytes ) { - if( stride_bytes < src_bpp * width ) { - throw new IllegalArgumentException("Invalid stride "+stride_bytes+", must be greater than bytesPerPixel "+src_bpp+" * width "+width); - } - } else { - stride_bytes = src_bpp * width; - } - final PixelFormat dest_fmt = dest32.getPixelformat(); - final boolean vert_flip = src_glOriented != dest32.isGLOriented(); - final boolean fast_copy = src_fmt == dest_fmt && dest_fmt.bytesPerPixel() == 4 ; - // System.err.println("XXX: SRC fmt "+src_fmt+", stride "+stride_bytes+", isGL "+src_glOriented+", "+width+"x"+height); - // System.err.println("XXX: DST fmt "+dest_fmt+", fast_copy "+fast_copy); - - if( fast_copy ) { - // Fast copy - for(int y=0; y<height; y++) { - int o = vert_flip ? ( height - 1 - y ) * stride_bytes : y * stride_bytes; - for(int x=0; x<width; x++) { - dest32.store(x, y, getValue32(src_fmt, src_bb, o)); - o += src_bpp; - } - } - } else { - // Conversion - for(int y=0; y<height; y++) { - int o = vert_flip ? ( height - 1 - y ) * stride_bytes : y * stride_bytes; - for(int x=0; x<width; x++) { - dest32.store( x, y, convertToInt32( dest_fmt, src_fmt, src_bb, o)); - o += src_bpp; - } - } - } - } -} - diff --git a/src/nativewindow/classes/jogamp/nativewindow/Debug.java b/src/nativewindow/classes/jogamp/nativewindow/Debug.java index f2a45377e..8d8fd0667 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/Debug.java +++ b/src/nativewindow/classes/jogamp/nativewindow/Debug.java @@ -51,7 +51,7 @@ public class Debug extends PropertyAccess { verbose = isPropertyDefined("nativewindow.verbose", true); debugAll = isPropertyDefined("nativewindow.debug", true); if (verbose) { - final Package p = Package.getPackage("javax.media.nativewindow"); + final Package p = Package.getPackage("com.jogamp.nativewindow"); System.err.println("NativeWindow specification version " + p.getSpecificationVersion()); System.err.println("NativeWindow implementation version " + p.getImplementationVersion()); System.err.println("NativeWindow implementation vendor " + p.getImplementationVendor()); diff --git a/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java index 6061c4e79..6fb29e6c0 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java @@ -33,7 +33,7 @@ package jogamp.nativewindow; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; public class DefaultGraphicsConfigurationFactoryImpl extends GraphicsConfigurationFactory { @Override diff --git a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java index 4f6c0d155..40c0be965 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java @@ -28,13 +28,13 @@ package jogamp.nativewindow; -import javax.media.nativewindow.ToolkitLock; +import com.jogamp.nativewindow.ToolkitLock; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; /** - * Implementing a global recursive {@link javax.media.nativewindow.ToolkitLock}. + * Implementing a global recursive {@link com.jogamp.nativewindow.ToolkitLock}. * <p> * This is the last resort for unstable driver where multiple X11 display connections * to the same connection name are not treated thread safe within the GL/X11 driver. diff --git a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java index 40fca0f7b..a4fcb1d6b 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java @@ -34,10 +34,10 @@ package jogamp.nativewindow; import java.lang.reflect.Constructor; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.ToolkitLock; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ToolkitLock; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.common.util.ReflectionUtil.AWTNames; @@ -68,7 +68,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { throw new IllegalArgumentException("Target window object type " + winObj.getClass().getName() + " is unsupported; expected " + - "javax.media.nativewindow.NativeWindow or "+AWTNames.ComponentClass); + "com.jogamp.nativewindow.NativeWindow or "+AWTNames.ComponentClass); } private Constructor<?> nativeWindowConstructor = null; diff --git a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java index bbfb585ac..afe434a37 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java @@ -28,11 +28,11 @@ package jogamp.nativewindow; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.ToolkitLock; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ToolkitLock; /** - * Implementing a singleton global NOP {@link javax.media.nativewindow.ToolkitLock} + * Implementing a singleton global NOP {@link com.jogamp.nativewindow.ToolkitLock} * without any locking. Since there is no locking it all, it is intrinsically recursive. */ public class NullToolkitLock implements ToolkitLock { diff --git a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java index deb685b51..4c53ddb94 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java @@ -28,13 +28,15 @@ package jogamp.nativewindow; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.SurfaceUpdatedListener; -import javax.media.nativewindow.UpstreamSurfaceHook; +import java.io.PrintStream; + +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.SurfaceUpdatedListener; +import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; @@ -279,6 +281,13 @@ public abstract class ProxySurfaceImpl implements ProxySurface { sink.append("WINDOW_INVISIBLE"); needsOr = true; } + if( 0 != ( implBitfield & OPT_UPSTREAM_SURFACELESS ) ) { + if(needsOr) { + sink.append(" | "); + } + sink.append("SURFACELESS"); + needsOr = true; + } sink.append(" ]"); return sink; } @@ -297,6 +306,34 @@ public abstract class ProxySurfaceImpl implements ProxySurface { @Override public final void clearUpstreamOptionBits(final int v) { implBitfield &= ~v; } + public static void dumpHierarchy(final PrintStream out, final ProxySurface s) { + out.println("Surface Hierarchy of "+s.getClass().getName()); + dumpHierarchy(out, s, ""); + out.println(); + } + private static void dumpHierarchy(final PrintStream out, final NativeSurface s, String indentation) { + indentation = indentation + " "; + out.println(indentation+"Surface device "+s.getGraphicsConfiguration().getScreen().getDevice()); + out.println(indentation+"Surface size "+s.getSurfaceWidth()+"x"+s.getSurfaceHeight()+", handle 0x"+Long.toHexString(s.getSurfaceHandle())); + if( s instanceof ProxySurfaceImpl ) { + final ProxySurface ps = (ProxySurface)s; + out.println(indentation+"Upstream options "+ps.getUpstreamOptionBits(null).toString()); + + final UpstreamSurfaceHook psUSH = ps.getUpstreamSurfaceHook(); + if( null != psUSH ) { + out.println(indentation+"Upstream Hook "+psUSH.getClass().getName()); + final NativeSurface upstreamSurface = psUSH.getUpstreamSurface(); + indentation = indentation + " "; + if( null != upstreamSurface ) { + out.println(indentation+"Upstream Hook's Surface "+upstreamSurface.getClass().getName()); + dumpHierarchy(out, upstreamSurface, indentation); + } else { + out.println(indentation+"Upstream Hook's Surface NULL"); + } + } + } + } + @Override public StringBuilder toString(StringBuilder sink) { if(null == sink) { diff --git a/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java index e4e557d36..d7090f3b3 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java @@ -28,13 +28,13 @@ package jogamp.nativewindow; -import javax.media.nativewindow.ToolkitLock; +import com.jogamp.nativewindow.ToolkitLock; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; /** - * Implementing a resource based recursive {@link javax.media.nativewindow.ToolkitLock}. + * Implementing a resource based recursive {@link com.jogamp.nativewindow.ToolkitLock}. * <p> * A resource handle maybe used within a unique object * and can be synchronized across threads via an instance of ResourceToolkitLock. diff --git a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java index 881fd56a6..823d97491 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java @@ -31,14 +31,15 @@ package jogamp.nativewindow; import java.util.Iterator; import java.util.concurrent.atomic.AtomicInteger; -import javax.media.nativewindow.ToolkitLock; +import com.jogamp.nativewindow.ToolkitLock; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.LongObjectHashMap; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; /** - * Implementing a shared resource based recursive {@link javax.media.nativewindow.ToolkitLock}. + * Implementing a shared resource based recursive {@link com.jogamp.nativewindow.ToolkitLock}. * <p> * A resource handle maybe used within many objects * and can be synchronized across threads via an unique instance of SharedResourceToolkitLock. @@ -63,7 +64,7 @@ public class SharedResourceToolkitLock implements ToolkitLock { if(DEBUG || verbose || handle2Lock.size() > 0 ) { System.err.println("SharedResourceToolkitLock: Shutdown (open: "+handle2Lock.size()+")"); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if( handle2Lock.size() > 0) { dumpOpenDisplayConnections(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java b/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java index 73413cf59..c42dc613d 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java +++ b/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java @@ -27,146 +27,169 @@ */ package jogamp.nativewindow; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.ScalableSurface; /** * Basic {@link ScalableSurface} utility to validate and compute pixel-scale values. */ public class SurfaceScaleUtils { - private static final int[] PlatformMaxPixelScale; - private static final boolean PlatformUniformPixelScale; - private static final boolean PlatformPixelScaleSupported; + private static final float EPSILON = 1.1920929E-7f; // Float.MIN_VALUE == 1.4e-45f ; double EPSILON 2.220446049250313E-16d - static { - if( NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(true) ) { - PlatformMaxPixelScale = new int[] { jogamp.nativewindow.macosx.OSXUtil.MAX_PIXELSCALE, jogamp.nativewindow.macosx.OSXUtil.MAX_PIXELSCALE }; - PlatformUniformPixelScale = true; - PlatformPixelScaleSupported = true; - } else { - PlatformMaxPixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; - PlatformUniformPixelScale = false; - PlatformPixelScaleSupported = false; - } + private static boolean isZero(final float a) { + return Math.abs(a) < EPSILON; } /** - * Compute a new valid pixelScale to be used by {@link NativeSurface} implementations, - * based on the given request and surface's pixelScale + * Returns integer rounded product, i.e. {@code (int) ( a * pixelScale + 0.5f )} * - * @param result int[2] storage for result, maybe same as <code>prePixelScale</code> for in-place - * @param prePixelScale previous pixelScale - * @param reqPixelScale requested pixelScale, validated via {@link #validateReqPixelScale(int[], int, String)}. - * @param newPixelScaleRaw new raw surface pixelScale - * @param DEBUG_PREFIX if set, dumps debug info on stderr using this prefix - * @return true if pixelScale has changed, otherwise false + * @param a the int value + * @param pixelScale the float scale factor + * @return the integer rounded product */ - public static boolean computePixelScale(final int[] result, final int[] prePixelScale, final int[] reqPixelScale, final int[] newPixelScaleRaw, final String DEBUG_PREFIX) { - final int newPixelScaleSafeX = 0 < newPixelScaleRaw[0] ? newPixelScaleRaw[0] : ScalableSurface.IDENTITY_PIXELSCALE; - final int newPixelScaleSafeY = 0 < newPixelScaleRaw[1] ? newPixelScaleRaw[1] : ScalableSurface.IDENTITY_PIXELSCALE; - final boolean useHiDPI = ScalableSurface.IDENTITY_PIXELSCALE != reqPixelScale[0] || ScalableSurface.IDENTITY_PIXELSCALE != reqPixelScale[1]; - final int prePixelScaleX = prePixelScale[0]; - final int prePixelScaleY = prePixelScale[1]; - - if( useHiDPI ) { - result[0] = newPixelScaleSafeX; - result[1] = newPixelScaleSafeY; - } else { - result[0] = ScalableSurface.IDENTITY_PIXELSCALE; - result[1] = ScalableSurface.IDENTITY_PIXELSCALE; - } - - final boolean changed = result[0] != prePixelScaleX || result[1] != prePixelScaleY; - if( null != DEBUG_PREFIX ) { - System.err.println(DEBUG_PREFIX+".computePixelScale: useHiDPI "+useHiDPI+", ["+prePixelScaleX+"x"+prePixelScaleY+" (pre), "+ - reqPixelScale[0]+"x"+reqPixelScale[1]+" (req)] -> "+ - newPixelScaleRaw[0]+"x"+newPixelScaleRaw[1]+" (raw) -> "+ - newPixelScaleSafeX+"x"+newPixelScaleSafeY+" (safe) -> "+ - result[0]+"x"+result[1]+" (use), changed "+changed); - } - return changed; + public static int scale(final int a, final float pixelScale) { + return (int) ( a * pixelScale + 0.5f ); } /** - * Validate the given requested pixelScale value pair, i.e. clip it to the - * limits of {@link ScalableSurface#AUTOMAX_PIXELSCALE} and {@link #getPlatformMaxPixelScale(int[])} - * <p> - * To be used by {@link ScalableSurface#setSurfaceScale(int[])} implementations. - * </p> + * Returns integer rounded product, i.e. {@code (int) ( a / pixelScale + 0.5f )} * - * @param result int[2] storage for result - * @param reqPixelScale requested pixelScale - * @param DEBUG_PREFIX if set, dumps debug info on stderr using this prefix + * @param a the int value + * @param pixelScale the float scale factor + * @return the integer rounded product */ - public static void validateReqPixelScale(final int[] result, final int[] reqPixelScale, final String DEBUG_PREFIX) { - final int minPS = Math.min(reqPixelScale[0], reqPixelScale[1]); - if( ScalableSurface.AUTOMAX_PIXELSCALE >= minPS ) { - result[0] = ScalableSurface.AUTOMAX_PIXELSCALE; - result[1] = ScalableSurface.AUTOMAX_PIXELSCALE; - } else if( PlatformUniformPixelScale ) { - final int maxPS = Math.max(reqPixelScale[0], reqPixelScale[1]); - if( maxPS >= PlatformMaxPixelScale[0] ) { - result[0] = PlatformMaxPixelScale[0]; - result[1] = PlatformMaxPixelScale[1]; - } else { - result[0] = maxPS; - result[1] = maxPS; - } - } else { - if( reqPixelScale[0] >= PlatformMaxPixelScale[0] ) { - result[0] = PlatformMaxPixelScale[0]; - } else { - result[0] = reqPixelScale[0]; - } - if( reqPixelScale[1] >= PlatformMaxPixelScale[1] ) { - result[1] = PlatformMaxPixelScale[1]; - } else { - result[1] = reqPixelScale[1]; - } - } - if( null != DEBUG_PREFIX ) { - System.err.println(DEBUG_PREFIX+".validateReqPixelScale: ["+reqPixelScale[0]+"x"+reqPixelScale[1]+" (req), "+ - PlatformMaxPixelScale[0]+"x"+PlatformMaxPixelScale[1]+" (max)] -> "+ - result[0]+"x"+result[1]+" (valid)"); - } + public static int scaleInv(final int a, final float pixelScale) { + return (int) ( a / pixelScale + 0.5f ); } /** - * Replaces {@link ScalableSurface#AUTOMAX_PIXELSCALE} with {@link #getPlatformMaxPixelScale(int[])}, - * for each component. + * Returns integer rounded product, i.e. {@code (int) ( a * pixelScale + 0.5f )} * - * @param pixelScale int[2] value array to be tested and replaced + * @param result the int[2] result, may be {@code a} for in-place operation + * @param a the int[2] values + * @param pixelScale the float[2] scale factors + * @return the result for chaining */ - public static void replaceAutoMaxWithPlatformMax(final int[] pixelScale) { - if( ScalableSurface.AUTOMAX_PIXELSCALE == pixelScale[0] ) { - pixelScale[0] = PlatformMaxPixelScale[0]; - } - if( ScalableSurface.AUTOMAX_PIXELSCALE == pixelScale[1] ) { - pixelScale[1] = PlatformMaxPixelScale[1]; - } + public static int[] scale(final int[] result, final int[] a, final float[] pixelScale) { + result[0] = (int) ( a[0] * pixelScale[0] + 0.5f ); + result[1] = (int) ( a[1] * pixelScale[1] + 0.5f ); + return result; } - /** - * Returns the maximum platform pixelScale + * Returns integer rounded product, i.e. {@code (int) ( a / pixelScale + 0.5f )} + * + * @param result the int[2] result, may be {@code a} for in-place operation + * @param a the int[2] values + * @param pixelScale the float[2] scale factors + * @return the result for chaining */ - public static int[] getPlatformMaxPixelScale(final int[] result) { - System.arraycopy(PlatformMaxPixelScale, 0, result, 0, 2); + public static int[] scaleInv(final int[] result, final int[] a, final float[] pixelScale) { + result[0] = (int) ( a[0] / pixelScale[0] + 0.5f ); + result[1] = (int) ( a[1] / pixelScale[1] + 0.5f ); return result; } /** - * Returns true if platform pixelScale is uniform, i.e. same scale factor for x- and y-direction, otherwise false. + * Method constrains the given pixel-scale within ]0..{@code maxPixelScale}], as described below. + * <p> + * Method returns {@link ScalableSurface#IDENTITY_PIXELSCALE IDENTITY_PIXELSCALE} if: + * <ul> + * <li>{@code pixelScale} ~= {@link ScalableSurface#IDENTITY_PIXELSCALE IDENTITY_PIXELSCALE}</li> + * </ul> + * </p> + * <p> + * Method returns {@code maxPixelScale} if + * <ul> + * <li>{@code pixelScale} ~= {@link ScalableSurface#AUTOMAX_PIXELSCALE AUTOMAX_PIXELSCALE}</li> + * <li>{@code pixelScale} > {@code maxPixelScale}</li> + * <li>{@code pixelScale} ~= {@code maxPixelScale}</li> + * </ul> + * </p> + * <p> + * Method returns {@code minPixelScale} if + * <ul> + * <li>{@code pixelScale} < {@code minPixelScale}</li> + * <li>{@code pixelScale} ~= {@code minPixelScale}</li> + * </ul> + * </p> + * <p> + * Otherwise method returns the given {@code pixelScale}. + * </p> + * <p> + * <i>~=</i> denominates a delta ≤ {@link FloatUtil#EPSILON}. + * </p> + * @param pixelScale pixel-scale to be constrained + * @param minPixelScale minimum pixel-scale + * @param maxPixelScale maximum pixel-scale + * @return the constrained pixel-scale */ - public static boolean isPlatformPixelScaleUniform() { - return PlatformUniformPixelScale; + public static float clampPixelScale(final float pixelScale, final float minPixelScale, final float maxPixelScale) { + if( isZero(pixelScale-ScalableSurface.IDENTITY_PIXELSCALE) ) { + return ScalableSurface.IDENTITY_PIXELSCALE; + } else if( isZero(pixelScale-ScalableSurface.AUTOMAX_PIXELSCALE) || + pixelScale > maxPixelScale || + isZero(pixelScale-maxPixelScale) + ) + { + return maxPixelScale; + } else if( pixelScale < minPixelScale || isZero(pixelScale-minPixelScale) ) + { + return minPixelScale; + } else { + return pixelScale; + } } /** - * Returns whether the platform supports pixelScale + * Method {@link #clampPixelScale(float, float, float) constrains} the given float[2] pixel-scale + * within ]0..{@code maxPixelScale}], as described in {@link #clampPixelScale(float, float, float)}. + * + * @param result float[2] storage for result, maybe same as <code>s</code> for in-place + * @param pixelScale float[2] pixelScale to be constrained + * @param minPixelScale float[2] minimum pixel-scale + * @param maxPixelScale float[2] maximum pixel-scale + * @return the constrained result for chaining */ - public static boolean isPlatformPixelScaleSupported() { - return PlatformPixelScaleSupported; + public static float[] clampPixelScale(final float[] result, final float[] pixelScale, + final float[] minPixelScale, final float[] maxPixelScale) { + result[0] = clampPixelScale(pixelScale[0], minPixelScale[0], maxPixelScale[0]); + result[1] = clampPixelScale(pixelScale[1], minPixelScale[1], maxPixelScale[1]); + return result; } + /** + * Method writes the given float[2] requested pixel-scale {@code reqPixelScale} + * into {@code result} within its constraints ]0..{@code maxPixelScale}], as described in {@link #clampPixelScale(float, float, float)}. + * <p> + * Method only differs from {@link #clampPixelScale(float[], float[], float[], float[])} + * by returning the whether the value has changed, i.e. different from the given {@code prePixelScale}. + * </p> + * + * @param result int[2] storage for result, maybe same as <code>prePixelScale</code> for in-place + * @param prePixelScale float[2] previous pixel-scale + * @param reqPixelScale float[2] requested pixel-scale, validated via {@link #validateReqPixelScale(float[], float[], String)}. + * @param minPixelScale float[2] minimum pixel-scale + * @param maxPixelScale float[2] maximum pixel-scale + * @param DEBUG_PREFIX if set, dumps debug info on stderr using this prefix + * @param newPixelScaleRaw new raw surface pixel-scale + * @return {@code true} if pixel-scale has changed, otherwise {@code false}. + */ + public static boolean setNewPixelScale(final float[] result, + final float[] prePixelScale, final float[] reqPixelScale, + final float[] minPixelScale, final float[] maxPixelScale, + final String DEBUG_PREFIX) { + final float resultX = clampPixelScale(reqPixelScale[0], minPixelScale[0], maxPixelScale[0]); + final float resultY = clampPixelScale(reqPixelScale[1], minPixelScale[1], maxPixelScale[1]); + final boolean changed = resultX != prePixelScale[0] || resultY != prePixelScale[1]; + if( null != DEBUG_PREFIX ) { + System.err.println(DEBUG_PREFIX+".setNewPixelScale: pre["+prePixelScale[0]+", "+prePixelScale[1]+"], req["+ + reqPixelScale[0]+", "+reqPixelScale[1]+"], min["+ + minPixelScale[0]+", "+minPixelScale[1]+"], max["+ + maxPixelScale[0]+", "+maxPixelScale[1]+"] -> result["+ + resultX+", "+resultY+"], changed "+changed); + } + result[0] = resultX; + result[1] = resultY; + return changed; + } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java b/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java index a7e136f76..130caff3c 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java +++ b/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java @@ -30,8 +30,8 @@ package jogamp.nativewindow; import java.util.ArrayList; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.SurfaceUpdatedListener; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.SurfaceUpdatedListener; public class SurfaceUpdatedHelper implements SurfaceUpdatedListener { private final Object surfaceUpdatedListenersLock = new Object(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java index 47b3e63fa..b980922b1 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java @@ -1,6 +1,6 @@ package jogamp.nativewindow; -import javax.media.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.NativeWindowFactory; /** * Marker interface. diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java index d3439b53f..a417de4cb 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java @@ -28,11 +28,11 @@ package jogamp.nativewindow; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.ScalableSurface; -import javax.media.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; @@ -42,7 +42,7 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; * @see ProxySurface */ public class WrappedSurface extends ProxySurfaceImpl implements ScalableSurface { - private final int[] hasPixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + private final float[] hasPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; private long surfaceHandle; /** @@ -104,27 +104,23 @@ public class WrappedSurface extends ProxySurfaceImpl implements ScalableSurface /** * {@inheritDoc} * <p> - * {@link WrappedSurface}'s implementation uses the {@link #setSurfaceScale(int[]) given pixelScale} directly. + * {@link WrappedSurface}'s implementation uses the {@link #setSurfaceScale(float[]) given pixelScale} directly. * </p> */ @Override public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) { - pixelUnitsAndResult[0] /= hasPixelScale[0]; - pixelUnitsAndResult[1] /= hasPixelScale[1]; - return pixelUnitsAndResult; + return SurfaceScaleUtils.scaleInv(pixelUnitsAndResult, pixelUnitsAndResult, hasPixelScale); } /** * {@inheritDoc} * <p> - * {@link WrappedSurface}'s implementation uses the {@link #setSurfaceScale(int[]) given pixelScale} directly. + * {@link WrappedSurface}'s implementation uses the {@link #setSurfaceScale(float[]) given pixelScale} directly. * </p> */ @Override public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) { - windowUnitsAndResult[0] *= hasPixelScale[0]; - windowUnitsAndResult[1] *= hasPixelScale[1]; - return windowUnitsAndResult; + return SurfaceScaleUtils.scale(windowUnitsAndResult, windowUnitsAndResult, hasPixelScale); } /** @@ -147,25 +143,32 @@ public class WrappedSurface extends ProxySurfaceImpl implements ScalableSurface * </p> */ @Override - public final void setSurfaceScale(final int[] pixelScale) { - hasPixelScale[0] = pixelScale[0]; - hasPixelScale[1] = pixelScale[1]; + public final boolean setSurfaceScale(final float[] pixelScale) { + final boolean changed = hasPixelScale[0] != pixelScale[0] || hasPixelScale[1] != pixelScale[1]; + System.arraycopy(pixelScale, 0, hasPixelScale, 0, 2); + return changed; } @Override - public final int[] getRequestedSurfaceScale(final int[] result) { + public final float[] getRequestedSurfaceScale(final float[] result) { System.arraycopy(hasPixelScale, 0, result, 0, 2); return result; } @Override - public final int[] getCurrentSurfaceScale(final int[] result) { + public final float[] getCurrentSurfaceScale(final float[] result) { System.arraycopy(hasPixelScale, 0, result, 0, 2); return result; } @Override - public final int[] getNativeSurfaceScale(final int[] result) { + public float[] getMinimumSurfaceScale(final float[] result) { + System.arraycopy(hasPixelScale, 0, result, 0, 2); + return result; + } + + @Override + public final float[] getMaximumSurfaceScale(final float[] result) { System.arraycopy(hasPixelScale, 0, result, 0, 2); return result; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java index fd39a3b4a..4231402c7 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java @@ -1,14 +1,14 @@ package jogamp.nativewindow; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.util.Point; import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos; diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java index b0eda63b6..0c072d05b 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java +++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java @@ -37,19 +37,22 @@ import java.awt.Component; import java.awt.Container; import java.awt.Frame; import java.awt.image.BufferedImage; +import java.nio.ByteBuffer; import java.util.HashMap; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JRootPane; import javax.swing.WindowConstants; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.WindowClosingProtocol; -import javax.media.nativewindow.util.PixelRectangle; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.nativewindow.util.PixelFormatUtil; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.WindowClosingProtocol; +import com.jogamp.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.PixelFormatUtil; import javax.swing.MenuSelectionManager; +import com.jogamp.nativewindow.awt.DirectDataBufferInt; + import jogamp.nativewindow.jawt.JAWTUtil; public class AWTMisc { @@ -210,25 +213,13 @@ public class AWTMisc { private static synchronized Cursor createCursor(final PixelRectangle pixelrect, final Point hotSpot) { final int width = pixelrect.getSize().getWidth(); final int height = pixelrect.getSize().getHeight(); - final BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); // PixelFormat.BGRA8888 - final PixelFormatUtil.PixelSink32 imgSink = new PixelFormatUtil.PixelSink32() { - public void store(final int x, final int y, final int pixel) { - img.setRGB(x, y, pixel); - } - @Override - public final PixelFormat getPixelformat() { - return PixelFormat.BGRA8888; - } - @Override - public int getStride() { - return width*4; - } - @Override - public final boolean isGLOriented() { - return false; - } - }; - PixelFormatUtil.convert32(imgSink, pixelrect); + // final BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); // PixelFormat.BGRA8888 + final DirectDataBufferInt.BufferedImageInt img = + DirectDataBufferInt.createBufferedImage(width, height, BufferedImage.TYPE_INT_ARGB, + null /* location */, null /* properties */); + final ByteBuffer imgBuffer = img.getDataBuffer().getDataBytes(); + PixelFormatUtil.convert(pixelrect, imgBuffer, PixelFormat.BGRA8888, false /* dst_glOriented */, width*4 /* dst_lineStride */); + final Toolkit toolkit = Toolkit.getDefaultToolkit(); return toolkit.createCustomCursor(img, hotSpot, pixelrect.toString()); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java index 8aaffbd84..fe83ebc76 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java @@ -39,7 +39,7 @@ package jogamp.nativewindow.jawt; -import javax.media.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.NativeWindowFactory; import jogamp.nativewindow.NWJNILibLoader; diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java index 231a89c26..e733b7233 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java @@ -49,13 +49,14 @@ import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Map; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.ToolkitLock; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ToolkitLock; import jogamp.common.os.PlatformPropsImpl; import jogamp.nativewindow.Debug; import jogamp.nativewindow.NWJNILibLoader; +import jogamp.nativewindow.macosx.OSXUtil; import com.jogamp.common.os.Platform; import com.jogamp.common.util.PropertyAccess; @@ -93,6 +94,7 @@ public class JAWTUtil { private static final ToolkitLock jawtToolkitLock; private static final Method getScaleFactorMethod; + private static final Method getCGDisplayIDMethodOnOSX; private static class PrivilegedDataBlob1 { PrivilegedDataBlob1() { @@ -101,6 +103,7 @@ public class JAWTUtil { Method sunToolkitAWTLockMethod; Method sunToolkitAWTUnlockMethod; Method getScaleFactorMethod; + Method getCGDisplayIDMethodOnOSX; boolean ok; } @@ -321,6 +324,7 @@ public class JAWTUtil { hasSunToolkitAWTLock = false; // hasSunToolkitAWTLock = false; getScaleFactorMethod = null; + getCGDisplayIDMethodOnOSX = null; } else { // Non-headless case JAWTJNILibLoader.initSingleton(); // load libjawt.so @@ -357,8 +361,13 @@ public class JAWTUtil { } try { final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); - d.getScaleFactorMethod = gd.getClass().getDeclaredMethod("getScaleFactor"); + final Class<?> gdClass = gd.getClass(); + d.getScaleFactorMethod = gdClass.getDeclaredMethod("getScaleFactor"); d.getScaleFactorMethod.setAccessible(true); + if( Platform.OSType.MACOS == PlatformPropsImpl.OS_TYPE ) { + d.getCGDisplayIDMethodOnOSX = gdClass.getDeclaredMethod("getCGDisplayID"); + d.getCGDisplayIDMethodOnOSX.setAccessible(true); + } } catch (final Throwable t) {} return d; } @@ -366,6 +375,7 @@ public class JAWTUtil { sunToolkitAWTLockMethod = pdb1.sunToolkitAWTLockMethod; sunToolkitAWTUnlockMethod = pdb1.sunToolkitAWTUnlockMethod; getScaleFactorMethod = pdb1.getScaleFactorMethod; + getCGDisplayIDMethodOnOSX = pdb1.getCGDisplayIDMethodOnOSX; boolean _hasSunToolkitAWTLock = false; if ( pdb1.ok ) { @@ -545,20 +555,46 @@ public class JAWTUtil { * Note: Currently only supported on OSX since 1.7.0_40 for HiDPI retina displays * </p> * @param device the {@link GraphicsDevice} instance used to query the pixel scale - * @return the pixel scale factor + * @param minScale current and output min scale values + * @param maxScale current and output max scale values + * @return {@code true} if the given min and max scale values have changed, otherwise {@code false}. */ - public static final int getPixelScale(final GraphicsDevice device) { + public static final boolean getPixelScale(final GraphicsDevice device, final float[] minScale, final float[] maxScale) { + // Shall we allow ]0..1[ minimum scale? + boolean changed = minScale[0] != 1f || minScale[1] != 1f; + minScale[0] = 1f; + minScale[1] = 1f; + float sx = 1f; + float sy = 1f; if( !SKIP_AWT_HIDPI ) { + if( null != getCGDisplayIDMethodOnOSX ) { + // OSX specific, preserving double type + try { + final Object res = getCGDisplayIDMethodOnOSX.invoke(device); + if (res instanceof Integer) { + final int displayID = ((Integer)res).intValue(); + sx = (float) OSXUtil.GetPixelScaleByDisplayID(displayID); + sy = sx; + } + } catch (final Throwable t) {} + } if( null != getScaleFactorMethod ) { + // Generic (?) try { final Object res = getScaleFactorMethod.invoke(device); if (res instanceof Integer) { - return ((Integer)res).intValue(); + sx = ((Integer)res).floatValue(); + } else if ( res instanceof Double) { + sx = ((Double)res).floatValue(); } + sy = sx; } catch (final Throwable t) {} } } - return 1; + changed = maxScale[0] != sx || maxScale[1] != sy; + maxScale[0] = sx; + maxScale[1] = sy; + return changed; } /** @@ -574,20 +610,23 @@ public class JAWTUtil { * Note: Currently only supported on OSX since 1.7.0_40 for HiDPI retina displays * </p> * @param gc the {@link GraphicsConfiguration} instance used to query the pixel scale - * @return the pixel scale factor + * @param minScale current and output min scale values + * @param maxScale current and output max scale values + * @return {@code true} if the given min and max scale values have changed, otherwise {@code false}. */ - public static final int getPixelScale(final GraphicsConfiguration gc) { + public static final boolean getPixelScale(final GraphicsConfiguration gc, final float[] minScale, final float[] maxScale) { final GraphicsDevice device = null != gc ? gc.getDevice() : null; - final int ps; + boolean changed; if( null == device ) { - ps = 0; + changed = minScale[0] != 1f || minScale[1] != 1f || maxScale[0] != 1f || maxScale[1] != 1f; + minScale[0] = 1f; + minScale[1] = 1f; + maxScale[0] = 1f; + maxScale[1] = 1f; } else { - ps = JAWTUtil.getPixelScale(device); - } - if( DEBUG ) { - System.err.println("JAWTUtil.updatePixelScale: Fetched "+ps); + changed = JAWTUtil.getPixelScale(device, minScale, maxScale); } - return ps; + return changed; } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index fae8db52a..6ac480120 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -45,13 +45,12 @@ import java.nio.Buffer; import java.security.AccessController; import java.security.PrivilegedAction; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.Capabilities; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.MutableSurface; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.Capabilities; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.MutableSurface; +import com.jogamp.nativewindow.util.Point; import com.jogamp.common.util.PropertyAccess; import com.jogamp.nativewindow.awt.JAWTWindow; @@ -116,13 +115,10 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } @Override - public void setSurfaceScale(final int[] pixelScale) { + public boolean setSurfaceScale(final float[] pixelScale) { super.setSurfaceScale(pixelScale); - if( 0 != getWindowHandle() ) { // locked at least once ! - final int hadPixelScaleX = getPixelScaleX(); - updatePixelScale(); - - if( hadPixelScaleX != getPixelScaleX() && 0 != getAttachedSurfaceLayer() ) { + if( 0 != getWindowHandle() && setReqPixelScale() ) { // locked at least once _and_ updated pixel-scale + if( 0 != getAttachedSurfaceLayer() ) { OSXUtil.RunOnMainThread(false, false, new Runnable() { @Override public void run() { @@ -133,6 +129,9 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } }); } + return true; + } else { + return false; } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java index 5d191f7e5..40fdaa296 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java @@ -47,7 +47,7 @@ import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; -import javax.media.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java index 7ad914e0a..a6c9452af 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java @@ -40,11 +40,11 @@ package jogamp.nativewindow.jawt.windows; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.util.Point; import com.jogamp.nativewindow.awt.JAWTWindow; diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java index 9abaed731..2620b60e0 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java @@ -37,11 +37,11 @@ package jogamp.nativewindow.jawt.x11; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.util.Point; import com.jogamp.nativewindow.awt.JAWTWindow; diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java index fea1be11a..3ae3b4840 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java @@ -47,7 +47,7 @@ import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; -import javax.media.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java index 6b54c32ea..e800e9ea8 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java @@ -1,9 +1,9 @@ package jogamp.nativewindow.macosx; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java index cf163bd82..8ec7b7e95 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java @@ -27,10 +27,10 @@ */ package jogamp.nativewindow.macosx; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.Point; import com.jogamp.common.util.Function; import com.jogamp.common.util.FunctionTask; @@ -107,12 +107,14 @@ public class OSXUtil implements ToolkitProperties { return (Insets) GetInsets0(windowOrView); } - public static double GetPixelScale(final int screenIndex) { + public static double GetPixelScaleByScreenIdx(final int screenIndex) { return GetPixelScale0(screenIndex); } - + public static double GetPixelScaleByDisplayID(final int displayID) { + return GetPixelScale1(displayID); + } public static double GetPixelScale(final long windowOrView) { - return GetPixelScale1(windowOrView); + return GetPixelScale2(windowOrView); } public static long CreateNSWindow(final int x, final int y, final int width, final int height) { @@ -394,7 +396,8 @@ public class OSXUtil implements ToolkitProperties { private static native Object GetLocationOnScreen0(long windowOrView, int src_x, int src_y); private static native Object GetInsets0(long windowOrView); private static native double GetPixelScale0(int screenIndex); - private static native double GetPixelScale1(long windowOrView); + private static native double GetPixelScale1(int displayID); + private static native double GetPixelScale2(long windowOrView); private static native long CreateNSWindow0(int x, int y, int width, int height); private static native void DestroyNSWindow0(long nsWindow); private static native long GetNSView0(long nsWindow); diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java index a08cf9b51..9366308c1 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java @@ -1,9 +1,9 @@ package jogamp.nativewindow.windows; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java index 2f335c428..faa0b2cac 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java @@ -28,11 +28,11 @@ package jogamp.nativewindow.windows; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; import jogamp.nativewindow.ProxySurfaceImpl; import jogamp.nativewindow.windows.GDI; diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java index c409b6a39..bdf9630af 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java @@ -27,9 +27,11 @@ */ package jogamp.nativewindow.windows; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; + +import com.jogamp.common.ExceptionUtils; import jogamp.nativewindow.NWJNILibLoader; import jogamp.nativewindow.Debug; @@ -132,7 +134,7 @@ public class GDIUtil implements ToolkitProperties { SetProcessThreadsAffinityMask0(affinityMask, verbose); } - private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI + private static final void dumpStack() { ExceptionUtils.dumpStack(System.err); } // Callback for JNI /** Creates WNDCLASSEX instance */ static native boolean CreateWindowClass0(long hInstance, String clazzName, long wndProc, long iconSmallHandle, long iconBigHandle); diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java index e3ea49314..2f62b7a4d 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java @@ -32,7 +32,7 @@ import jogamp.nativewindow.Debug; import java.util.ArrayList; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowException; public class RegisteredClassFactory { private static final boolean DEBUG = Debug.debug("RegisteredClass"); diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java index 0ac3d4a2e..99cfca97b 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java @@ -28,9 +28,9 @@ package jogamp.nativewindow.x11; -import javax.media.nativewindow.Capabilities; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.Capabilities; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.VisualIDHolder; public class X11Capabilities extends Capabilities { final private XVisualInfo xVisualInfo; // maybe null if !onscreen diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java index 7e61ba6d0..06176934b 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java @@ -1,9 +1,9 @@ package jogamp.nativewindow.x11; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.ProxySurface; -import javax.media.nativewindow.UpstreamSurfaceHook; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.ProxySurface; +import com.jogamp.nativewindow.UpstreamSurfaceHook; import jogamp.nativewindow.x11.X11Lib; @@ -44,7 +44,7 @@ public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize s.setSurfaceHandle(windowHandle); s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); } - s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE); + s.addUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE ); } finally { device.unlock(); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java index e12c3fd13..f8a11f91e 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java @@ -33,13 +33,13 @@ package jogamp.nativewindow.x11; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.VisualIDHolder; import com.jogamp.nativewindow.x11.X11GraphicsConfiguration; import com.jogamp.nativewindow.x11.X11GraphicsScreen; diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java index 2414248b4..e59ff2ea8 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java @@ -37,14 +37,15 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; import jogamp.nativewindow.Debug; import jogamp.nativewindow.NWJNILibLoader; import jogamp.nativewindow.ToolkitProperties; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.LongObjectHashMap; import com.jogamp.common.util.PropertyAccess; import com.jogamp.nativewindow.x11.X11GraphicsDevice; @@ -196,7 +197,7 @@ public class X11Util implements ToolkitProperties { ", pending (open in creation order): "+pendingDisplayList.size()+ ")"); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if( openDisplayList.size() > 0) { X11Util.dumpOpenDisplayConnections(); @@ -615,7 +616,7 @@ public class X11Util implements ToolkitProperties { } private static final String getCurrentThreadName() { return Thread.currentThread().getName(); } // Callback for JNI - private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI + private static final void dumpStack() { ExceptionUtils.dumpStack(System.err); } // Callback for JNI private static native boolean initialize0(boolean debug); private static native void shutdown0(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java index 6b606df97..b022a3089 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java @@ -36,17 +36,17 @@ package jogamp.nativewindow.x11.awt; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.ToolkitLock; -import javax.media.nativewindow.VisualIDHolder.VIDType; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ToolkitLock; +import com.jogamp.nativewindow.VisualIDHolder.VIDType; import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; import com.jogamp.nativewindow.awt.AWTGraphicsDevice; diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m index 127b329d1..2cc272a41 100644 --- a/src/nativewindow/native/macosx/OSXmisc.m +++ b/src/nativewindow/native/macosx/OSXmisc.m @@ -65,12 +65,12 @@ static jmethodID runnableRunID = NULL; static const char * const ClazzAnyCstrName = "<init>"; -static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point"; +static const char * const ClazzNamePoint = "com/jogamp/nativewindow/util/Point"; static const char * const ClazzNamePointCstrSignature = "(II)V"; static jclass pointClz = NULL; static jmethodID pointCstr = NULL; -static const char * const ClazzNameInsets = "javax/media/nativewindow/util/Insets"; +static const char * const ClazzNameInsets = "com/jogamp/nativewindow/util/Insets"; static const char * const ClazzNameInsetsCstrSignature = "(IIII)V"; static jclass insetsClz = NULL; static jmethodID insetsCstr = NULL; @@ -138,17 +138,29 @@ Java_jogamp_nativewindow_macosx_OSXUtil_isNSWindow0(JNIEnv *env, jclass _unused, } static CGDirectDisplayID OSXUtil_getCGDirectDisplayIDByNSScreen(NSScreen *screen) { - // Mind: typedef uint32_t CGDirectDisplayID; - however, we assume it's 64bit on 64bit ?! + // Mind: typedef uint32_t CGDirectDisplayID; NSDictionary * dict = [screen deviceDescription]; NSNumber * val = (NSNumber *) [dict objectForKey: @"NSScreenNumber"]; // [NSNumber integerValue] returns NSInteger which is 32 or 64 bit native size return (CGDirectDisplayID) [val integerValue]; } +static NSScreen * OSXUtil_getNSScreenByCGDirectDisplayID(CGDirectDisplayID displayID) { + NSArray *screens = [NSScreen screens]; + int i; + for(i=[screens count]-1; i>=0; i--) { + NSScreen * screen = (NSScreen *) [screens objectAtIndex: i]; + CGDirectDisplayID dID = OSXUtil_getCGDirectDisplayIDByNSScreen(screen); + if( dID == displayID ) { + return screen; + } + } + return (NSScreen *) [screens objectAtIndex: 0]; +} /* * Class: Java_jogamp_nativewindow_macosx_OSXUtil * Method: getLocationOnScreen0 - * Signature: (JII)Ljavax/media/nativewindow/util/Point; + * Signature: (JII)Lcom/jogamp/nativewindow/util/Point; */ JNIEXPORT jobject JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetLocationOnScreen0 (JNIEnv *env, jclass unused, jlong winOrView, jint src_x, jint src_y) @@ -209,7 +221,7 @@ JNIEXPORT jobject JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetLocationOnS /* * Class: Java_jogamp_nativewindow_macosx_OSXUtil * Method: getInsets0 - * Signature: (J)Ljavax/media/nativewindow/util/Insets; + * Signature: (J)Lcom/jogamp/nativewindow/util/Insets; */ JNIEXPORT jobject JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetInsets0 (JNIEnv *env, jclass unused, jlong winOrView) @@ -264,7 +276,7 @@ JNIEXPORT jdouble JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetPixelScale0 NSArray *screens = [NSScreen screens]; if( screen_idx<0 || screen_idx>=[screens count] ) { screen = NULL; - pixelScale = 0.0; + pixelScale = 1.0; } else { screen = (NSScreen *) [screens objectAtIndex: screen_idx]; pixelScale = 1.0; // default @@ -282,9 +294,32 @@ NS_ENDHANDLER /* * Class: Java_jogamp_nativewindow_macosx_OSXUtil * Method: GetPixelScale1 - * Signature: (J)D + * Signature: (I)D */ JNIEXPORT jdouble JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetPixelScale1 + (JNIEnv *env, jclass unused, jint displayID) +{ + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + + CGFloat pixelScale; + NSScreen *screen = OSXUtil_getNSScreenByCGDirectDisplayID((CGDirectDisplayID)displayID); + pixelScale = 1.0; // default +NS_DURING + // Available >= 10.7 + pixelScale = [screen backingScaleFactor]; // HiDPI scaling +NS_HANDLER +NS_ENDHANDLER + [pool release]; + + return (jdouble)pixelScale; +} + +/* + * Class: Java_jogamp_nativewindow_macosx_OSXUtil + * Method: GetPixelScale1 + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetPixelScale2 (JNIEnv *env, jclass unused, jlong winOrView) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; diff --git a/src/nativewindow/native/win32/GDImisc.c b/src/nativewindow/native/win32/GDImisc.c index 76143c426..29eed540b 100644 --- a/src/nativewindow/native/win32/GDImisc.c +++ b/src/nativewindow/native/win32/GDImisc.c @@ -26,7 +26,7 @@ #define DBG_PRINT_FLUSH(args...) #endif -static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point"; +static const char * const ClazzNamePoint = "com/jogamp/nativewindow/util/Point"; static const char * const ClazzAnyCstrName = "<init>"; static const char * const ClazzNamePointCstrSignature = "(II)V"; @@ -528,7 +528,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_windows_GDIUtil_getDummyWndProc /* * Class: jogamp_nativewindow_windows_GDIUtil * Method: GetRelativeLocation0 - * Signature: (JJII)Ljavax/media/nativewindow/util/Point; + * Signature: (JJII)Lcom/jogamp/nativewindow/util/Point; */ JNIEXPORT jobject JNICALL Java_jogamp_nativewindow_windows_GDIUtil_GetRelativeLocation0 (JNIEnv *env, jclass unused, jlong jsrc_win, jlong jdest_win, jint src_x, jint src_y) diff --git a/src/nativewindow/native/x11/Xmisc.c b/src/nativewindow/native/x11/Xmisc.c index 247dc1311..a2e744cd8 100644 --- a/src/nativewindow/native/x11/Xmisc.c +++ b/src/nativewindow/native/x11/Xmisc.c @@ -98,7 +98,7 @@ static const char * const ClazzNameBuffers = "com/jogamp/common/nio/Buffers"; static const char * const ClazzNameBuffersStaticCstrName = "copyByteBuffer"; static const char * const ClazzNameBuffersStaticCstrSignature = "(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;"; static const char * const ClazzNameByteBuffer = "java/nio/ByteBuffer"; -static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point"; +static const char * const ClazzNamePoint = "com/jogamp/nativewindow/util/Point"; static const char * const ClazzAnyCstrName = "<init>"; static const char * const ClazzNamePointCstrSignature = "(II)V"; static jclass X11UtilClazz = NULL; @@ -669,7 +669,7 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_x11_X11Lib_SetWindowPosSize /* * Class: jogamp_nativewindow_x11_X11Lib * Method: GetRelativeLocation - * Signature: (JIJJII)Ljavax/media/nativewindow/util/Point; + * Signature: (JIJJII)Lcom/jogamp/nativewindow/util/Point; */ JNIEXPORT jobject JNICALL Java_jogamp_nativewindow_x11_X11Lib_GetRelativeLocation0 (JNIEnv *env, jclass unused, jlong jdisplay, jint screen_index, jlong jsrc_win, jlong jdest_win, jint src_x, jint src_y) diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index c4b919951..d683eb9f2 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -34,11 +34,11 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.util.PixelRectangle; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.PointImmutable; import jogamp.newt.Debug; @@ -235,7 +235,7 @@ public abstract class Display { /** * Manual trigger the native creation, if it is not done yet.<br> - * This is useful to be able to request the {@link javax.media.nativewindow.AbstractGraphicsDevice}, via + * This is useful to be able to request the {@link com.jogamp.nativewindow.AbstractGraphicsDevice}, via * {@link #getGraphicsDevice()}.<br> * Otherwise the abstract device won't be available before the dependent components (Screen and Window) are realized. * <p> @@ -324,7 +324,7 @@ public abstract class Display { public abstract String getName(); /** - * @return the native display type, ie {@link javax.media.nativewindow.NativeWindowFactory#getNativeWindowType(boolean)} + * @return the native display type, ie {@link com.jogamp.nativewindow.NativeWindowFactory#getNativeWindowType(boolean)} */ public abstract String getType(); diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java index 126162006..4d9c6493a 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java +++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java @@ -30,10 +30,11 @@ package com.jogamp.newt; import java.util.List; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.nativewindow.util.SurfaceSize; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.SurfaceSize; import com.jogamp.common.util.ArrayHashSet; @@ -51,6 +52,7 @@ import com.jogamp.common.util.ArrayHashSet; * <ul> * <li>{@link MonitorMode} current mode</li> * <li>{@link RectangleImmutable} viewport (rotated)</li> + * <li>pixel-scale (rotated)</li> * </ul></li> * </ul> * <p> @@ -65,16 +67,31 @@ public abstract class MonitorDevice { protected final ArrayHashSet<MonitorMode> supportedModes; // FIXME: May need to support mutable mode, i.e. adding modes on the fly! protected MonitorMode currentMode; protected boolean modeChanged; - protected Rectangle viewportPU; // in pixel units - protected Rectangle viewportWU; // in window units + protected final float[] pixelScale; + protected final Rectangle viewportPU; // in pixel units + protected final Rectangle viewportWU; // in window units - protected MonitorDevice(final Screen screen, final int nativeId, final DimensionImmutable sizeMM, final Rectangle viewportPU, final Rectangle viewportWU, final MonitorMode currentMode, final ArrayHashSet<MonitorMode> supportedModes) { + /** + * @param screen associated {@link Screen} + * @param nativeId unique monitor device ID + * @param sizeMM size in millimeters + * @param currentMode + * @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}. + * @param viewportPU viewport in pixel-units + * @param viewportWU viewport in window-units + * @param supportedModes all supported {@link MonitorMode}s + */ + protected MonitorDevice(final Screen screen, final int nativeId, final DimensionImmutable sizeMM, + final MonitorMode currentMode, + final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU, + final ArrayHashSet<MonitorMode> supportedModes) { this.screen = screen; this.nativeId = nativeId; this.sizeMM = sizeMM; this.originalMode = currentMode; this.supportedModes = supportedModes; this.currentMode = currentMode; + this.pixelScale = null != pixelScale ? pixelScale : new float[] { 1.0f, 1.0f }; this.viewportPU = viewportPU; this.viewportWU = viewportWU; this.modeChanged = false; @@ -180,26 +197,40 @@ public abstract class MonitorDevice { } /** - * Returns the {@link RectangleImmutable rectangular} portion + * Returns the current {@link RectangleImmutable rectangular} portion * of the <b>rotated</b> virtual {@link Screen} size in pixel units * represented by this monitor, i.e. top-left origin and size. - * @see Screen + * @see #getPixelScale() + * @see Screen#getViewport() */ public final RectangleImmutable getViewport() { return viewportPU; } /** - * Returns the {@link RectangleImmutable rectangular} portion + * Returns the current {@link RectangleImmutable rectangular} portion * of the <b>rotated</b> virtual {@link Screen} size in window units * represented by this monitor, i.e. top-left origin and size. - * @see Screen + * @see #getPixelScale() + * @see Screen#getViewportInWindowUnits() */ public final RectangleImmutable getViewportInWindowUnits() { return viewportWU; } /** + * Returns the current <b>rotated</b> pixel-scale + * of this monitor, i.e. horizontal and vertical. + * @see #getViewportInWindowUnits() + * @see #getViewport() + * @see ScalableSurface#getMaximumSurfaceScale(float[]) + */ + public float[] getPixelScale(final float[] result) { + System.arraycopy(pixelScale, 0, result, 0, 2); + return result; + } + + /** * Returns <code>true</code> if given screen coordinates in pixel units * are contained by this {@link #getViewport() viewport}, otherwise <code>false</code>. * @param x x-coord in pixel units @@ -292,7 +323,8 @@ public abstract class MonitorDevice { @Override public String toString() { - return "Monitor[Id "+Display.toHexString(nativeId)+", "+sizeMM+" mm, viewport "+viewportPU+ " [pixels], "+viewportWU+" [window], orig "+originalMode+", curr "+currentMode+ + return "Monitor[Id "+Display.toHexString(nativeId)+", "+sizeMM+" mm, pixelScale ["+pixelScale[0]+", "+pixelScale[1]+ + "], viewport "+viewportPU+ " [pixels], "+viewportWU+" [window], orig "+originalMode+", curr "+currentMode+ ", modeChanged "+modeChanged+", modeCount "+supportedModes.size()+"]"; } } diff --git a/src/newt/classes/com/jogamp/newt/MonitorMode.java b/src/newt/classes/com/jogamp/newt/MonitorMode.java index 09bc06ebd..cd5600b48 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorMode.java +++ b/src/newt/classes/com/jogamp/newt/MonitorMode.java @@ -30,9 +30,9 @@ package com.jogamp.newt; import java.util.Comparator; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.nativewindow.util.SurfaceSize; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.SurfaceSize; import com.jogamp.newt.util.MonitorModeUtil; diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index 9606fae08..2ed2194d8 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -38,12 +38,12 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Arrays; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.PropertyAccess; @@ -260,7 +260,7 @@ public class NewtFactory { * you have to add an appropriate {@link com.jogamp.newt.event.WindowListener} for this use case.<br> * The parents visibility is passed to the new Window<br></p> * <p> - * In case <code>parentWindowObject</code> is a different {@link javax.media.nativewindow.NativeWindow} implementation,<br> + * In case <code>parentWindowObject</code> is a different {@link com.jogamp.nativewindow.NativeWindow} implementation,<br> * you have to handle all events appropriate.<br></p> * <p> * <p> diff --git a/src/newt/classes/com/jogamp/newt/NewtVersion.java b/src/newt/classes/com/jogamp/newt/NewtVersion.java index f4cdee487..f4ecdd17f 100644 --- a/src/newt/classes/com/jogamp/newt/NewtVersion.java +++ b/src/newt/classes/com/jogamp/newt/NewtVersion.java @@ -47,7 +47,7 @@ public class NewtVersion extends JogampVersion { synchronized(NewtVersion.class) { if( null == jogampCommonVersionInfo ) { final String packageName1 = "com.jogamp.newt"; // atomic packaging - and identity - final String packageName2 = "javax.media.opengl"; // all packaging + final String packageName2 = "com.jogamp.opengl"; // all packaging final Manifest mf = VersionUtil.getManifest(NativeWindowVersion.class.getClassLoader(), new String[]{ packageName1, packageName2 } ); jogampCommonVersionInfo = new NewtVersion(packageName1, mf); } diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index 0ba557972..65031a565 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -36,10 +36,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; /** * A screen may span multiple {@link MonitorDevice}s representing their combined virtual size. @@ -82,7 +82,7 @@ public abstract class Screen { /** * Manual trigger the native creation, if not done yet..<br> - * This is useful to be able to request the {@link javax.media.nativewindow.AbstractGraphicsScreen}, via + * This is useful to be able to request the {@link com.jogamp.nativewindow.AbstractGraphicsScreen}, via * {@link #getGraphicsScreen()}.<br> * Otherwise the abstract device won't be available before the dependent component (Window) is realized. * <p> diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index ec6d767fa..2afa464d6 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -42,14 +42,14 @@ import com.jogamp.newt.event.MouseListener; import jogamp.newt.Debug; import jogamp.newt.WindowImpl; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.ScalableSurface; -import javax.media.nativewindow.WindowClosingProtocol; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.nativewindow.util.SurfaceSize; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.WindowClosingProtocol; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.SurfaceSize; /** * Specifying NEWT's Window functionality: @@ -95,6 +95,17 @@ import javax.media.nativewindow.util.SurfaceSize; * System.setProperty("newt.window.icons", "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png"); * </pre> * </p> + * + * <a name="lifecycleHeavy"><h5>Use of Lifecycle Heavy functions</h5></a> + * <p> + * Some of the methods specified here are lifecycle-heavy. That is, they are able + * to destroy and/or reattach resources to/from the window. Because of this, the methods + * are <i>not safe</i> to be called from EDT related threads. For example, it is not + * safe for a method in an attached {@link KeyListener} to call {@link #setFullscreen(boolean)} + * on a {@link Window} directly. It is safe, however, for that method to spawn a background + * worker thread which calls the method directly. The documentation for individual methods + * indicates whether or not they are lifecycle-heavy. + * </p> */ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSurface { public static final boolean DEBUG_MOUSE_EVENT = Debug.debug("Window.MouseEvent"); @@ -174,6 +185,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * <p> * The Window can be recreate via {@link #setVisible(boolean) setVisible(true)}. * </p> + * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> * @see #destroy() * @see #setVisible(boolean) */ @@ -193,6 +205,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur /** * Calls {@link #setVisible(boolean, boolean) setVisible(true, visible)}, * i.e. blocks until the window becomes visible. + * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> * @see #setVisible(boolean, boolean) */ void setVisible(boolean visible); @@ -221,11 +234,12 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * } * </pre></p> * <p> - * In case this window is a child window and has a {@link javax.media.nativewindow.NativeWindow} parent,<br> + * In case this window is a child window and has a {@link com.jogamp.nativewindow.NativeWindow} parent,<br> * <code>setVisible(wait, true)</code> has no effect as long the parent's is not valid yet, - * i.e. {@link javax.media.nativewindow.NativeWindow#getWindowHandle()} returns <code>null</code>.<br> + * i.e. {@link com.jogamp.nativewindow.NativeWindow#getWindowHandle()} returns <code>null</code>.<br> * <code>setVisible(wait, true)</code> shall be repeated when the parent becomes valid. * </p> + * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> */ void setVisible(boolean wait, boolean visible); @@ -259,7 +273,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * according to the {@link #getMainMonitor() main monitor}'s <i>current</i> {@link MonitorMode mode}'s * {@link SurfaceSize#getResolution() surface resolution}. * <p> - * Method takes the {@link #getCurrentSurfaceScale(int[]) current surface-scale} and {@link #getNativeSurfaceScale(int[]) native surface-scale} + * Method takes the {@link #getCurrentSurfaceScale(float[]) current surface-scale} and {@link #getMaximumSurfaceScale(float[]) native surface-scale} * into account, i.e.: * <pre> * surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale, @@ -470,6 +484,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * this window is removed from it's list of children.<br> * In case the new parent is not null and a Window, * this window is added to it's list of children.<br></P> + * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> * * @param newParent The new parent NativeWindow. If null, this Window becomes a top level window. * @param x new top-level position in window units, use -1 for default position. @@ -485,6 +500,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * <p> * Fullscreen mode is established on the {@link #getMainMonitor() main monitor}. * </p> + * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> * @param fullscreen enable or disable fullscreen mode * @return success * @see #setFullscreen(List) @@ -498,6 +514,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * <p> * Disable fullscreen via {@link #setFullscreen(boolean)}. * </p> + * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> * @param monitors if <code>null</code> fullscreen will be spanned across all {@link MonitorDevice}s, * otherwise across the given list of {@link MonitorDevice}. * @return success diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index c470f6840..5920d6de8 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -47,17 +47,17 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Set; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.OffscreenLayerOption; -import javax.media.nativewindow.WindowClosingProtocol; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLException; -import javax.media.opengl.GLOffscreenAutoDrawable; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.OffscreenLayerOption; +import com.jogamp.nativewindow.WindowClosingProtocol; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLOffscreenAutoDrawable; import javax.swing.MenuSelectionManager; import jogamp.nativewindow.awt.AWTMisc; @@ -69,6 +69,7 @@ import jogamp.newt.awt.event.AWTParentWindowAdapter; import jogamp.newt.driver.DriverClearFocus; import jogamp.opengl.awt.AWTTilePainter; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.awt.AWTEDTExecutor; import com.jogamp.nativewindow.awt.AWTPrintLifecycle; import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol; @@ -469,10 +470,17 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto determineIfApplet(); if(DEBUG) { System.err.println("NewtCanvasAWT.addNotify.0 - isApplet "+isApplet+", addedOnAWTEDT "+EventQueue.isDispatchThread()+" @ "+currentThreadName()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } jawtWindow = NewtFactoryAWT.getNativeWindow(NewtCanvasAWT.this, null != newtChild ? newtChild.getRequestedCapabilities() : null); jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer); + // enforce initial lock on AWT-EDT, allowing acquisition of pixel-scale + jawtWindow.lockSurface(); + try { + // attachNewtChild sets surface scale! + } finally { + jawtWindow.unlockSurface(); + } awtWindowClosingProtocol.addClosingListener(); componentAdded = true; // Bug 910 if(DEBUG) { @@ -485,6 +493,25 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } } + private final boolean updatePixelScale() { + if( jawtWindow.updatePixelScale(true) ) { + final Window cWin = newtChild; + final Window dWin = cWin.getDelegatedWindow(); + if( dWin instanceof WindowImpl ) { + final float[] maxPixelScale = jawtWindow.getMaximumSurfaceScale(new float[2]); + final float[] minPixelScale = jawtWindow.getMinimumSurfaceScale(new float[2]); + ((WindowImpl)dWin).pixelScaleChangeNotify(minPixelScale, maxPixelScale, true); + // ((WindowImpl)dWin).sizeChangedNotify(true /* defer */, getWidth(), getHeight(), true /* force */); + } else { + final float[] reqPixelScale = jawtWindow.getRequestedSurfaceScale(new float[2]); + if( jawtWindow.setSurfaceScale(reqPixelScale) ) { + // jawtWindow.getRequestedSurfaceScale(reqPixelScale); + } + } + return true; + } + return false; + } @Override public void removeNotify() { @@ -493,7 +520,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } else { if(DEBUG) { System.err.println("NewtCanvasAWT.removeNotify.0 - isApplet "+isApplet+" @ "+currentThreadName()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } componentAdded = false; // Bug 910 awtWindowClosingProtocol.removeClosingListener(); @@ -518,7 +545,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto public final void destroy() { if(DEBUG) { System.err.println("NewtCanvasAWT.destroy() @ "+currentThreadName()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } AWTEDTExecutor.singleton.invoke(true, new Runnable() { @Override @@ -587,7 +614,11 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto System.err.println("NewtCanvasAWT.reshape: "+x+"/"+y+" "+width+"x"+height); } if( validateComponent(true) ) { - // newtChild.setSize(width, height); + if( !printActive && updatePixelScale() ) { + // NOP + } else { + // newtChild.setSize(width, height); + } } } } @@ -876,18 +907,12 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } final int w = getWidth(); final int h = getHeight(); - final boolean isNValid = newtChild.isNativeValid(); if(DEBUG) { - System.err.println("NewtCanvasAWT.attachNewtChild.2: size "+w+"x"+h+", isNValid "+isNValid); + System.err.println("NewtCanvasAWT.attachNewtChild.2: size "+w+"x"+h+", isNValid "+newtChild.isNativeValid()); } newtChild.setVisible(false); newtChild.setSize(w, h); - final int[] reqSurfaceScale = new int[2]; - if( isNValid ) { - newtChild.getCurrentSurfaceScale(reqSurfaceScale); - } else { - newtChild.getRequestedSurfaceScale(reqSurfaceScale); - } + final float[] reqSurfaceScale = newtChild.getRequestedSurfaceScale(new float[2]); jawtWindow.setSurfaceScale(reqSurfaceScale); newtChild.reparentWindow(jawtWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE); newtChild.addSurfaceUpdatedListener(jawtWindow); diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java index 72b3e43f3..cd53294a1 100644 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java @@ -38,11 +38,11 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.Arrays; -import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; -import javax.media.opengl.FPSCounter; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode; +import com.jogamp.opengl.FPSCounter; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.jawt.JAWTUtil; diff --git a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java index 9c7a4bcb8..166f30d7c 100644 --- a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java +++ b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java @@ -27,7 +27,7 @@ */ package com.jogamp.newt.event; -import javax.media.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeSurface; import com.jogamp.newt.event.MouseEvent.PointerClass; diff --git a/src/newt/classes/com/jogamp/newt/event/WindowListener.java b/src/newt/classes/com/jogamp/newt/event/WindowListener.java index e097edf23..b45a9dea7 100644 --- a/src/newt/classes/com/jogamp/newt/event/WindowListener.java +++ b/src/newt/classes/com/jogamp/newt/event/WindowListener.java @@ -34,7 +34,7 @@ package com.jogamp.newt.event; -import javax.media.nativewindow.WindowClosingProtocol; +import com.jogamp.nativewindow.WindowClosingProtocol; /** NEWT {@link WindowEvent} listener. */ public interface WindowListener extends NEWTEventListener { diff --git a/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java b/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java index 4a5fecd83..dc12307ed 100644 --- a/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java @@ -28,7 +28,7 @@ package com.jogamp.newt.event; -import javax.media.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.Rectangle; @SuppressWarnings("serial") public class WindowUpdateEvent extends WindowEvent { diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java index a49c10a1e..89fece2dc 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java @@ -28,7 +28,7 @@ package com.jogamp.newt.event.awt; -import javax.media.nativewindow.NativeSurfaceHolder; +import com.jogamp.nativewindow.NativeSurfaceHolder; import jogamp.newt.Debug; @@ -39,10 +39,10 @@ import jogamp.newt.Debug; * it is converted to a NEWT event and the given NEWT listener is being called.<br></p> * <p> * This adapter fullfills three use cases. First as a plain utility to write code AWT agnostic, - * ie write an {@link javax.media.opengl.GLEvenListener} and some appropriate NEWT {@link com.jogamp.newt.event.NEWTEventListener}.<br></p> + * ie write an {@link com.jogamp.opengl.GLEvenListener} and some appropriate NEWT {@link com.jogamp.newt.event.NEWTEventListener}.<br></p> * <p> - * Attach the {@link javax.media.opengl.GLEvenListener} to a NEWT {@link javax.media.opengl.GLAutoDrawable}, e.g. {@link com.jogamp.newt.opengl.GLWindow},<br> - * or to an AWT {@link javax.media.opengl.GLAutoDrawable}, e.g. {@link javax.media.opengl.awt.GLCanvas}.<br> + * Attach the {@link com.jogamp.opengl.GLEvenListener} to a NEWT {@link com.jogamp.opengl.GLAutoDrawable}, e.g. {@link com.jogamp.newt.opengl.GLWindow},<br> + * or to an AWT {@link com.jogamp.opengl.GLAutoDrawable}, e.g. {@link com.jogamp.opengl.awt.GLCanvas}.<br> * <br> * Attach the NEWT {@link com.jogamp.newt.event.NEWTEventListener} to a NEWT component, e.g. {@link com.jogamp.newt.Window},<br> * or to an AWT component, e.g. {@link java.awt.Component}.<br></p> @@ -50,7 +50,7 @@ import jogamp.newt.Debug; * Common:<br> * <pre> // your demo/render code - javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ; + com.jogamp.opengl.GLEvenListener demo1 = new com.jogamp.opengl.GLEvenListener() { ... } ; // your AWT agnostic NEWT mouse listener code com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ; diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java index 4f11e8772..a69c2a9d9 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java @@ -28,7 +28,7 @@ package com.jogamp.newt.event.awt; -import javax.media.nativewindow.NativeSurfaceHolder; +import com.jogamp.nativewindow.NativeSurfaceHolder; import jogamp.newt.awt.event.AWTNewtEventFactory; diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java index d9531cd5f..553349201 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java @@ -28,7 +28,7 @@ package com.jogamp.newt.event.awt; -import javax.media.nativewindow.NativeSurfaceHolder; +import com.jogamp.nativewindow.NativeSurfaceHolder; import jogamp.newt.awt.event.AWTNewtEventFactory; diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java index a8105403d..2e5d75782 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java @@ -30,7 +30,7 @@ package com.jogamp.newt.event.awt; import java.awt.Dimension; -import javax.media.nativewindow.NativeSurfaceHolder; +import com.jogamp.nativewindow.NativeSurfaceHolder; import jogamp.newt.awt.event.AWTNewtEventFactory; diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 2ba030f76..d638b3ae5 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -38,34 +38,34 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.SurfaceUpdatedListener; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.Rectangle; -import javax.media.opengl.FPSCounter; -import javax.media.opengl.GL; -import javax.media.opengl.GL3; -import javax.media.opengl.GL4ES3; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLES2; -import javax.media.opengl.GLES3; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.GLSharedContextSetter; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.SurfaceUpdatedListener; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.opengl.FPSCounter; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL3; +import com.jogamp.opengl.GL4ES3; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLES2; +import com.jogamp.opengl.GLES3; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.GLSharedContextSetter; import jogamp.newt.WindowImpl; import jogamp.opengl.GLAutoDrawableBase; @@ -401,23 +401,28 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setSurfaceScale(final int[] pixelScale) { - window.setSurfaceScale(pixelScale); + public final boolean setSurfaceScale(final float[] pixelScale) { + return window.setSurfaceScale(pixelScale); } @Override - public final int[] getRequestedSurfaceScale(final int[] result) { + public final float[] getRequestedSurfaceScale(final float[] result) { return window.getRequestedSurfaceScale(result); } @Override - public final int[] getCurrentSurfaceScale(final int[] result) { + public final float[] getCurrentSurfaceScale(final float[] result) { return window.getCurrentSurfaceScale(result); } @Override - public final int[] getNativeSurfaceScale(final int[] result) { - return window.getNativeSurfaceScale(result); + public final float[] getMinimumSurfaceScale(final float[] result) { + return window.getMinimumSurfaceScale(result); + } + + @Override + public final float[] getMaximumSurfaceScale(final float[] result) { + return window.getMaximumSurfaceScale(result); } @Override diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java index 76af2d0ec..186ffb162 100644 --- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java +++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java @@ -28,22 +28,22 @@ package com.jogamp.newt.swt; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.Capabilities; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.SurfaceUpdatedListener; -import javax.media.nativewindow.WindowClosingProtocol; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.nativewindow.util.Point; -import javax.media.opengl.GLCapabilities; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.Capabilities; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.SurfaceUpdatedListener; +import com.jogamp.nativewindow.WindowClosingProtocol; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.opengl.GLCapabilities; import jogamp.nativewindow.macosx.OSXUtil; import jogamp.nativewindow.windows.GDIUtil; diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java index 80da1ce3b..8bf4bc20f 100644 --- a/src/newt/classes/com/jogamp/newt/util/MainThread.java +++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java @@ -42,7 +42,7 @@ import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.common.os.Platform; import com.jogamp.common.util.PropertyAccess; diff --git a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java index e5f8ff17c..26263770c 100644 --- a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java +++ b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java @@ -34,8 +34,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.SurfaceSize; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.SurfaceSize; /** * Convenient {@link com.jogamp.newt.MonitorMode} utility methods, diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java index 9a3e79a8f..6ea63f69c 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java @@ -34,15 +34,15 @@ import com.jogamp.plugin.applet.Applet3Context; import com.jogamp.plugin.ui.NativeWindowDownstream; import com.jogamp.plugin.ui.NativeWindowUpstream; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.opengl.FPSCounter; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.opengl.FPSCounter; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos; import com.jogamp.newt.NewtFactory; diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java index d40e09d96..cc159e6ed 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java @@ -31,14 +31,14 @@ import java.lang.reflect.Field; import java.security.AccessController; import java.security.PrivilegedAction; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.FPSCounter; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLPipelineFactory; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.FPSCounter; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLPipelineFactory; import jogamp.newt.Debug; @@ -281,14 +281,14 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { if(glDebug) { try { - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, _gl, null) ); } catch (final Exception e) {e.printStackTrace();} } if(glTrace) { try { // Trace .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, _gl, new Object[] { System.err } ) ); } catch (final Exception e) {e.printStackTrace();} } diff --git a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java index 7ec790ee2..518337d20 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java @@ -8,13 +8,13 @@ import com.jogamp.plugin.ui.NativeWindowUpstream; import java.util.List; import java.util.Locale; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; import com.jogamp.common.GlueGenVersion; import com.jogamp.common.util.VersionUtil; diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java index ef8ea66b6..bf46ce609 100644 --- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java +++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java @@ -39,10 +39,11 @@ package jogamp.newt; import java.util.ArrayList; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowException; import jogamp.common.util.locks.LockDebugUtil; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.RunnableTask; import com.jogamp.common.util.locks.Lock; import com.jogamp.newt.util.EDTUtil; @@ -144,7 +145,7 @@ public class DefaultEDTUtil implements EDTUtil { public final boolean invokeStop(final boolean wait, final Runnable task) { if(DEBUG) { System.err.println(Thread.currentThread()+": Default-EDT.invokeStop wait "+wait); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return invokeImpl(wait, task, true /* stop */, false /* provokeError */); } @@ -152,7 +153,7 @@ public class DefaultEDTUtil implements EDTUtil { public final boolean invokeAndWaitError(final Runnable task) { if(DEBUG) { System.err.println(Thread.currentThread()+": Default-EDT.invokeAndWaitError"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return invokeImpl(true /* wait */, task, false /* stop */, true /* provokeError */); } @@ -177,7 +178,7 @@ public class DefaultEDTUtil implements EDTUtil { // drop task .. System.err.println(Thread.currentThread()+": Warning: Default-EDT about (1) to stop, won't enqueue new task: "+edt); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } @@ -191,7 +192,7 @@ public class DefaultEDTUtil implements EDTUtil { if( edt.tasks.size()>0 ) { System.err.println(Thread.currentThread()+": Warning: Default-EDT about (2) to stop, task executed. Remaining tasks: "+edt.tasks.size()+" - "+edt); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } @@ -204,7 +205,7 @@ public class DefaultEDTUtil implements EDTUtil { System.err.println(Thread.currentThread()+": Warning: Default-EDT is not running, dropping task. NEDT "+edt); } if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return false; diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index 84ce45238..cc1f3d8e0 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.java @@ -34,6 +34,7 @@ package jogamp.newt; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.ReflectionUtil; @@ -52,14 +53,14 @@ import java.net.URLConnection; import java.nio.ByteBuffer; import java.util.ArrayList; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.util.PixelFormatUtil; -import javax.media.nativewindow.util.PixelRectangle; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.util.PixelFormatUtil; +import com.jogamp.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; public abstract class DisplayImpl extends Display { private static int serialno = 1; @@ -164,7 +165,7 @@ public abstract class DisplayImpl extends Display { final PixelRectangle fpixelrect; if( getNativePointerIconPixelFormat() != pixelrect.getPixelformat() || pixelrect.isGLOriented() ) { // conversion ! - fpixelrect = PixelFormatUtil.convert32(pixelrect, getNativePointerIconPixelFormat(), + fpixelrect = PixelFormatUtil.convert(pixelrect, getNativePointerIconPixelFormat(), 0 /* ddestStride */, false /* isGLOriented */, getNativePointerIconForceDirectNIO() ); if( DEBUG_POINTER_ICON ) { System.err.println("createPointerIconRES.0: Conversion-FMT "+pixelrect+" -> "+fpixelrect); @@ -398,7 +399,7 @@ public abstract class DisplayImpl extends Display { if( DEBUG ) { if ( !res ) { System.err.println("Warning: invokeStop() failed"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } @@ -416,7 +417,7 @@ public abstract class DisplayImpl extends Display { if( !_edtUtil.isRunning() ) { // // volatile dbl-checked-locking OK if( DEBUG ) { System.err.println("Info: EDT start "+Thread.currentThread().getName()+", "+this); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } _edtUtil.start(); } @@ -428,7 +429,7 @@ public abstract class DisplayImpl extends Display { } if( DEBUG ) { System.err.println("Warning: invoke(wait "+wait+", ..) on EDT failed .. invoke on current thread "+Thread.currentThread().getName()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } task.run(); @@ -685,7 +686,7 @@ public abstract class DisplayImpl extends Display { if(null == event) { // Ooops ? System.err.println("Warning: event of eventTask is NULL"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); return; } dispatchMessage(event); @@ -739,7 +740,7 @@ public abstract class DisplayImpl extends Display { // oops .. we are already dead if(DEBUG) { System.err.println("Warning: EDT already stopped: wait:="+wait+", "+e); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return; } diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java index 72300740f..7c7d54680 100644 --- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java +++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java @@ -28,8 +28,9 @@ package jogamp.newt; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Rectangle; import com.jogamp.common.util.ArrayHashSet; import com.jogamp.newt.MonitorDevice; @@ -38,8 +39,21 @@ import com.jogamp.newt.Screen; public class MonitorDeviceImpl extends MonitorDevice { - public MonitorDeviceImpl(final ScreenImpl screen, final int nativeId, final DimensionImmutable sizeMM, final Rectangle viewportPU, final Rectangle viewportWU, final MonitorMode currentMode, final ArrayHashSet<MonitorMode> supportedModes) { - super(screen, nativeId, sizeMM, viewportPU, viewportWU, currentMode, supportedModes); + /** + * @param screen associated {@link Screen} + * @param nativeId unique monitor device ID + * @param sizeMM size in millimeters + * @param currentMode + * @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}. + * @param viewportPU viewport in pixel-units + * @param viewportWU viewport in window-units + * @param supportedModes all supported {@link MonitorMode}s + */ + public MonitorDeviceImpl(final ScreenImpl screen, final int nativeId, final DimensionImmutable sizeMM, + final MonitorMode currentMode, + final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU, + final ArrayHashSet<MonitorMode> supportedModes) { + super(screen, nativeId, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes); } @Override diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java index 6e376ce48..3f9e0be78 100644 --- a/src/newt/classes/jogamp/newt/MonitorModeProps.java +++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java @@ -33,10 +33,11 @@ import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.MonitorMode; import java.util.List; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.SurfaceSize; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.SurfaceSize; import jogamp.newt.MonitorDeviceImpl; import jogamp.newt.ScreenImpl; @@ -256,14 +257,19 @@ public class MonitorModeProps { * <p> * Note: This variant only works for impl. w/ a unique mode key pair <i>modeId, rotation</i>. * </p> - * @param mode_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}. * @param cache hash arrays of unique {@link MonitorMode} components and {@link MonitorDevice}s, allowing to avoid duplicates - * @param modeProperties the input data + * @param screen the associated {@link ScreenImpl} + * @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}. + * @param monitorProperties the input data minus supported modes! * @param offset the offset to the input data + * @param monitor_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}. * @return {@link MonitorDevice} of the identical (old or new) element in {@link Cache#monitorDevices}, * matching the input <code>modeProperties</code>, or null if input could not be processed. */ - public static MonitorDevice streamInMonitorDevice(final int[] monitor_idx, final Cache cache, final ScreenImpl screen, final int[] monitorProperties, int offset) { + public static MonitorDevice streamInMonitorDevice(final Cache cache, final ScreenImpl screen, + final float[] pixelScale, + final int[] monitorProperties, int offset, + final int[] monitor_idx) { // min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+ final int count = monitorProperties[offset]; if(MIN_MONITOR_DEVICE_PROPERTIES > count) { @@ -298,7 +304,7 @@ public class MonitorModeProps { } } } - MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, sizeMM, viewportPU, viewportWU, currentMode, supportedModes); + MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes); if(null!=cache) { monitorDevice = cache.monitorDevices.getOrAdd(monitorDevice); } @@ -329,17 +335,23 @@ public class MonitorModeProps { * This variant expects <code>count</code> to be <code>{@link MIN_MONITOR_DEVICE_PROPERTIES} - 1 - {@link NUM_MONITOR_MODE_PROPERTIES}</code>, * due to lack of supported mode and current mode. * </p> - * - * @param mode_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}. * @param cache hash arrays of unique {@link MonitorMode} components and {@link MonitorDevice}s, allowing to avoid duplicates - * @param supportedModes pre-assembled list of supported {@link MonitorMode}s from cache. + * @param screen the associated {@link ScreenImpl} * @param currentMode pre-fetched current {@link MonitorMode}s from cache. - * @param modeProperties the input data minus supported modes! + * @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}. + * @param supportedModes pre-assembled list of supported {@link MonitorMode}s from cache. + * @param monitorProperties the input data minus supported modes! * @param offset the offset to the input data + * @param monitor_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}. * @return {@link MonitorDevice} of the identical (old or new) element in {@link Cache#monitorDevices}, * matching the input <code>modeProperties</code>, or null if input could not be processed. */ - public static MonitorDevice streamInMonitorDevice(final int[] monitor_idx, final Cache cache, final ScreenImpl screen, final ArrayHashSet<MonitorMode> supportedModes, final MonitorMode currentMode, final int[] monitorProperties, int offset) { + public static MonitorDevice streamInMonitorDevice(final Cache cache, final ScreenImpl screen, + final MonitorMode currentMode, + final float[] pixelScale, + final ArrayHashSet<MonitorMode> supportedModes, + final int[] monitorProperties, int offset, + final int[] monitor_idx) { // min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+ final int count = monitorProperties[offset]; if(MIN_MONITOR_DEVICE_PROPERTIES - 1 - NUM_MONITOR_MODE_PROPERTIES != count) { @@ -356,7 +368,7 @@ public class MonitorModeProps { final DimensionImmutable sizeMM = streamInResolution(monitorProperties, offset); offset+=NUM_RESOLUTION_PROPERTIES; final Rectangle viewportPU = new Rectangle(monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++]); final Rectangle viewportWU = new Rectangle(monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++]); - MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, sizeMM, viewportPU, viewportWU, currentMode, supportedModes); + MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes); if(null!=cache) { monitorDevice = cache.monitorDevices.getOrAdd(monitorDevice); } diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java index 749391f1f..fa9bd21bb 100644 --- a/src/newt/classes/jogamp/newt/OffscreenWindow.java +++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java @@ -36,14 +36,14 @@ package jogamp.newt; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.MutableSurface; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.MutableSurface; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.Point; import com.jogamp.newt.MonitorDevice; @@ -71,7 +71,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { setGraphicsConfiguration(cfg); synchronized(OffscreenWindow.class) { - setWindowHandle(nextWindowHandle++); + setWindowHandle(nextWindowHandle++); // just a marker } visibleChanged(false, true); } diff --git a/src/newt/classes/jogamp/newt/PointerIconImpl.java b/src/newt/classes/jogamp/newt/PointerIconImpl.java index 546a463de..da72752fa 100644 --- a/src/newt/classes/jogamp/newt/PointerIconImpl.java +++ b/src/newt/classes/jogamp/newt/PointerIconImpl.java @@ -29,10 +29,10 @@ package jogamp.newt; import java.nio.ByteBuffer; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.nativewindow.util.PixelRectangle; -import javax.media.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.PointImmutable; import com.jogamp.newt.Display; import com.jogamp.newt.Display.PointerIcon; @@ -154,7 +154,7 @@ public class PointerIconImpl implements PointerIcon { } @Override public final int getStride() { - return size.getWidth() * pixelformat.bytesPerPixel(); + return size.getWidth() * pixelformat.comp.bytesPerPixel(); } @Override public final boolean isGLOriented() { diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index e73e153ad..b8383b631 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -38,11 +38,11 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; import com.jogamp.common.util.ArrayHashSet; import com.jogamp.common.util.PropertyAccess; @@ -364,8 +364,8 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { * <li>{@link MonitorModeProps#MIN_MONITOR_DEVICE_PROPERTIES}</li> * </ul>, i.e. * <ul> - * <li>{@link MonitorModeProps#streamInMonitorDevice(int[], jogamp.newt.MonitorModeProps.Cache, ScreenImpl, int[], int)}</li> - * <li>{@link MonitorModeProps#streamInMonitorDevice(int[], jogamp.newt.MonitorModeProps.Cache, ScreenImpl, ArrayHashSet, int[], int)}</li> + * <li>{@link MonitorModeProps#streamInMonitorDevice(jogamp.newt.MonitorModeProps.Cache, ScreenImpl, double[], int[], int, int[])}</li> + * <li>{@link MonitorModeProps#streamInMonitorDevice(int[], jogamp.newt.MonitorModeProps.Cache, ArrayHashSet, int[], int, ScreenImpl)}</li> * <li>{@link MonitorModeProps#streamInMonitorMode(int[], jogamp.newt.MonitorModeProps.Cache, int[], int)}</li> * </ul> * @param cache memory pool caching the result @@ -373,6 +373,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { protected abstract void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache); protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, + final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU) { return false; } @@ -428,9 +429,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { final List<MonitorDevice> monitors = getMonitorDevices(); for(int i=monitors.size()-1; i>=0; i--) { final MonitorDeviceImpl monitor = (MonitorDeviceImpl) monitors.get(i); - final boolean viewportUpdated = updateNativeMonitorDeviceViewportImpl(monitor, monitor.getMutuableViewportPU(), monitor.getMutuableViewportWU()); + final float[] pixelScale = monitor.getPixelScale(new float[2]); + final boolean viewportUpdated = updateNativeMonitorDeviceViewportImpl(monitor, pixelScale, + monitor.getMutuableViewportPU(), + monitor.getMutuableViewportWU()); if( DEBUG ) { - System.err.println("Screen.updateMonitorViewport["+i+"] @ "+Thread.currentThread().getName()+": updated: "+viewportUpdated+", PU "+monitor.getViewport()+", WU "+monitor.getViewportInWindowUnits()); + System.err.println("Screen.updateMonitorViewport["+i+"] @ "+Thread.currentThread().getName()+": updated: "+viewportUpdated+ + ", PU "+monitor.getViewport()+", WU "+monitor.getViewportInWindowUnits()+ + ", pixelScale ["+pixelScale[0]+", "+pixelScale[1]+"]"); } } } @@ -510,7 +516,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { if( MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES != i ) { throw new InternalError("XX"); } - return MonitorModeProps.streamInMonitorDevice(null, cache, this, props, 0); + return MonitorModeProps.streamInMonitorDevice(cache, this, null, props, 0, null); } /** diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index b62628962..49fa1da4b 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -39,30 +39,31 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.OffscreenLayerSurface; -import javax.media.nativewindow.ScalableSurface; -import javax.media.nativewindow.SurfaceUpdatedListener; -import javax.media.nativewindow.WindowClosingProtocol; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.nativewindow.util.PixelRectangle; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.OffscreenLayerSurface; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.SurfaceUpdatedListener; +import com.jogamp.nativewindow.WindowClosingProtocol; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; import jogamp.nativewindow.SurfaceScaleUtils; import jogamp.nativewindow.SurfaceUpdatedHelper; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.ArrayHashSet; import com.jogamp.common.util.IntBitfield; import com.jogamp.common.util.PropertyAccess; @@ -153,9 +154,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private volatile boolean hasFocus = false; private volatile int pixWidth = 128, pixHeight = 128; // client-area size w/o insets in pixel units, default: may be overwritten by user private volatile int winWidth = 128, winHeight = 128; // client-area size w/o insets in window units, default: may be overwritten by user - protected final int[] nativePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; - protected final int[] hasPixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; - protected final int[] reqPixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + protected final float[] minPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + protected final float[] maxPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + protected final float[] hasPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + protected final float[] reqPixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; private volatile int x = 64, y = 64; // client-area pos w/o insets in window units private volatile Insets insets = new Insets(); // insets of decoration (if top-level && decorated) @@ -722,7 +724,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * </p> * <p> * May return <code>null</code>, in which case the caller shall traverse through the NativeWindow tree - * as demonstrated in {@link #getLocationOnScreen(javax.media.nativewindow.util.Point)}. + * as demonstrated in {@link #getLocationOnScreen(com.jogamp.nativewindow.util.Point)}. * </p> * * @return if not null, the screen location of the given coordinates @@ -1086,8 +1088,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override public final void setSurfaceSize(final int pixelWidth, final int pixelHeight) { - // FIXME HiDPI: Shortcut, may need to adjust if we change scaling methodology - setSize(pixelWidth / getPixelScaleX(), pixelHeight / getPixelScaleY()); + setSize( SurfaceScaleUtils.scaleInv(pixelWidth, getPixelScaleX()), + SurfaceScaleUtils.scaleInv(pixelHeight, getPixelScaleY()) ); } @Override public final void setTopLevelSize(final int width, final int height) { @@ -1180,8 +1182,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer parentWindowHandle = 0; hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; - nativePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; - nativePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; + minPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; + minPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; + maxPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; + maxPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; _lock.unlock(); } @@ -1925,16 +1929,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer @Override public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) { - pixelUnitsAndResult[0] /= getPixelScaleX(); - pixelUnitsAndResult[1] /= getPixelScaleY(); - return pixelUnitsAndResult; + return SurfaceScaleUtils.scaleInv(pixelUnitsAndResult, pixelUnitsAndResult, hasPixelScale); } @Override public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) { - windowUnitsAndResult[0] *= getPixelScaleX(); - windowUnitsAndResult[1] *= getPixelScaleY(); - return windowUnitsAndResult; + return SurfaceScaleUtils.scale(windowUnitsAndResult, windowUnitsAndResult, hasPixelScale); } protected final Point convertToWindowUnits(final Point pixelUnitsAndResult) { @@ -1946,43 +1946,50 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } /** HiDPI: We currently base scaling of window units to pixel units on an integer scale factor per component. */ - protected final int getPixelScaleX() { + protected final float getPixelScaleX() { return hasPixelScale[0]; } /** HiDPI: We currently base scaling of window units to pixel units on an integer scale factor per component. */ - protected final int getPixelScaleY() { + protected final float getPixelScaleY() { return hasPixelScale[1]; } @Override - public void setSurfaceScale(final int[] pixelScale) { - SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG_IMPLEMENTATION ? getClass().getSimpleName() : null); + public boolean setSurfaceScale(final float[] pixelScale) { + System.arraycopy(pixelScale, 0, reqPixelScale, 0, 2); + return false; } @Override - public final int[] getRequestedSurfaceScale(final int[] result) { + public final float[] getRequestedSurfaceScale(final float[] result) { System.arraycopy(reqPixelScale, 0, result, 0, 2); return result; } @Override - public final int[] getCurrentSurfaceScale(final int[] result) { + public final float[] getCurrentSurfaceScale(final float[] result) { System.arraycopy(hasPixelScale, 0, result, 0, 2); return result; } @Override - public final int[] getNativeSurfaceScale(final int[] result) { - System.arraycopy(nativePixelScale, 0, result, 0, 2); + public final float[] getMinimumSurfaceScale(final float[] result) { + System.arraycopy(minPixelScale, 0, result, 0, 2); + return result; + } + + @Override + public final float[] getMaximumSurfaceScale(final float[] result) { + System.arraycopy(maxPixelScale, 0, result, 0, 2); return result; } @Override public final float[] getPixelsPerMM(final float[] ppmmStore) { getMainMonitor().getPixelsPerMM(ppmmStore); - ppmmStore[0] *= (float)hasPixelScale[0] / (float)nativePixelScale[0]; - ppmmStore[1] *= (float)hasPixelScale[1] / (float)nativePixelScale[1]; + ppmmStore[0] *= hasPixelScale[0] / maxPixelScale[0]; + ppmmStore[1] *= hasPixelScale[1] / maxPixelScale[1]; return ppmmStore; } @@ -1992,7 +1999,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected final void definePosition(final int x, final int y) { if(DEBUG_IMPLEMENTATION) { System.err.println("definePosition: "+this.x+"/"+this.y+" -> "+x+"/"+y); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err); } autoPosition = false; this.x = x; this.y = y; @@ -2003,12 +2010,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * and {@link #pixWidth} and {@link #pixHeight} in pixel units according to {@link #convertToPixelUnits(int[])}. */ protected final void defineSize(final int winWidth, final int winHeight) { - final int pixWidth = winWidth * getPixelScaleX(); // FIXME HiDPI: Shortcut, may need to adjust if we change scaling methodology - final int pixHeight = winHeight * getPixelScaleY(); + final int pixWidth = SurfaceScaleUtils.scale(winWidth, getPixelScaleX()); // FIXME HiDPI: Shortcut, may need to adjust if we change scaling methodology + final int pixHeight = SurfaceScaleUtils.scale(winHeight, getPixelScaleY()); + if(DEBUG_IMPLEMENTATION) { System.err.println("defineSize: win["+this.winWidth+"x"+this.winHeight+" -> "+winWidth+"x"+winHeight+ "], pixel["+this.pixWidth+"x"+this.pixHeight+" -> "+pixWidth+"x"+pixHeight+"]"); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err); } this.winWidth = winWidth; this.winHeight = winHeight; this.pixWidth = pixWidth; this.pixHeight = pixHeight; @@ -2630,14 +2638,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // special repaint treatment case WindowEvent.EVENT_WINDOW_REPAINT: // queue repaint event in case window is locked, ie in operation - if( null != windowLock.getOwner() ) { + if( windowLock.isLockedByOtherThread() ) { // make sure only one repaint event is queued if(!repaintQueued) { repaintQueued=true; final boolean discardTO = QUEUED_EVENT_TO <= System.currentTimeMillis()-e.getWhen(); if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.consumeEvent: REPAINT "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO); - // Thread.dumpStack(); + System.err.println("Window.consumeEvent: REPAINT [me "+Thread.currentThread().getName()+", owner "+windowLock.getOwner()+"] - queued "+e+", discard-to "+discardTO); + // ExceptionUtils.dumpStackTrace(System.err); } return discardTO; // discardTO:=true -> consumed } @@ -2649,11 +2657,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // common treatment case WindowEvent.EVENT_WINDOW_RESIZED: // queue event in case window is locked, ie in operation - if( null != windowLock.getOwner() ) { + if( windowLock.isLockedByOtherThread() ) { final boolean discardTO = QUEUED_EVENT_TO <= System.currentTimeMillis()-e.getWhen(); if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.consumeEvent: RESIZED "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO); - // Thread.dumpStack(); + System.err.println("Window.consumeEvent: RESIZED [me "+Thread.currentThread().getName()+", owner "+windowLock.getOwner()+"] - queued "+e+", discard-to "+discardTO); + // ExceptionUtils.dumpStackTrace(System.err); } return discardTO; // discardTO:=true -> consumed } @@ -3745,7 +3753,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new NativeWindowException(msg); } else if (DEBUG_IMPLEMENTATION) { System.err.println(msg); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return -1; } else if( 0 < remaining ){ @@ -3755,6 +3763,21 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } + /** + * Notify to update the pixel-scale values. + * @param minPixelScale + * @param maxPixelScale + * @param reset if {@code true} {@link #setSurfaceScale(float[]) reset pixel-scale} w/ {@link #getRequestedSurfaceScale(float[]) requested values} + * value to reflect the new minimum and maximum values. + */ + public final void pixelScaleChangeNotify(final float[] minPixelScale, final float[] maxPixelScale, final boolean reset) { + System.arraycopy(minPixelScale, 0, this.minPixelScale, 0, 2); + System.arraycopy(maxPixelScale, 0, this.maxPixelScale, 0, 2); + if( reset ) { + setSurfaceScale(reqPixelScale); + } + } + /** Triggered by implementation's WM events to update the client-area size in window units w/o insets/decorations. */ protected void sizeChanged(final boolean defer, final int newWidth, final int newHeight, final boolean force) { if(force || getWidth() != newWidth || getHeight() != newHeight) { @@ -3791,7 +3814,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new NativeWindowException(msg); } else if (DEBUG_IMPLEMENTATION) { System.err.println(msg); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } else { @@ -3851,7 +3874,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } else { System.err.println("Auto position not reached within timeout, has "+getX()+"/"+getY()+", autoPosition "+autoPosition+", remaining "+remaining); } - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return ok; @@ -3892,7 +3915,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final WindowClosingMode mode = force ? WindowClosingMode.DISPOSE_ON_CLOSE : defMode; if(DEBUG_IMPLEMENTATION) { System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+defMode+" -> "+mode+") "+getThreadName()+": "+this); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err); } final boolean destroyed; diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java index 682313ef4..23e9c4370 100644 --- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java +++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java @@ -28,11 +28,11 @@ package jogamp.newt.awt; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; import jogamp.newt.Debug; @@ -44,8 +44,8 @@ public class NewtFactoryAWT extends NewtFactory { public static final boolean DEBUG_IMPLEMENTATION = Debug.debug("Window"); /** - * Wraps an AWT component into a {@link javax.media.nativewindow.NativeWindow} utilizing the {@link javax.media.nativewindow.NativeWindowFactory},<br> - * using a configuration agnostic dummy {@link javax.media.nativewindow.DefaultGraphicsConfiguration}.<br> + * Wraps an AWT component into a {@link com.jogamp.nativewindow.NativeWindow} utilizing the {@link com.jogamp.nativewindow.NativeWindowFactory},<br> + * using a configuration agnostic dummy {@link com.jogamp.nativewindow.DefaultGraphicsConfiguration}.<br> * <p> * The actual wrapping implementation is {@link com.jogamp.nativewindow.awt.JAWTWindow}.<br></p> * <p> diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java index 31ee92ca4..86f0ba20e 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java @@ -28,8 +28,8 @@ package jogamp.newt.awt.event; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeSurfaceHolder; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeSurfaceHolder; import com.jogamp.newt.event.MouseEvent; diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java index 93cdd7e56..1cd4f654e 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java @@ -30,7 +30,7 @@ package jogamp.newt.awt.event; import java.awt.KeyboardFocusManager; -import javax.media.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindow; import jogamp.newt.driver.DriverUpdatePosition; diff --git a/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java index a5f4fc769..216dccb2b 100644 --- a/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java @@ -31,7 +31,9 @@ package jogamp.newt.driver.android; import jogamp.newt.*; import jogamp.opengl.egl.*; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; + +import com.jogamp.opengl.egl.EGL; public class DisplayDriver extends jogamp.newt.DisplayImpl { static { diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java index 68d43ac75..486257ee9 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java @@ -30,10 +30,10 @@ package jogamp.newt.driver.android; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.opengl.FPSCounter; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.opengl.FPSCounter; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.newt.Window; import com.jogamp.opengl.GLEventListenerState; diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java index 4dd96c9a0..e9b4e494c 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java @@ -27,11 +27,11 @@ */ package jogamp.newt.driver.android; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import jogamp.common.os.PlatformPropsImpl; diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java index 190f55e71..2aecb54b9 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java @@ -11,7 +11,7 @@ public class NewtVersionActivityLauncher extends Activity { public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - final Uri uri = Uri.parse("launch://jogamp.org/jogamp.newt.driver.android.NewtVersionActivity?sys=com.jogamp.common&sys=javax.media.opengl&pkg=com.jogamp.opengl.test&jogamp.debug=all&nativewindow.debug=all&jogl.debug=all&newt.debug=all"); + final Uri uri = Uri.parse("launch://jogamp.org/jogamp.newt.driver.android.NewtVersionActivity?sys=com.jogamp.common&sys=com.jogamp.opengl&pkg=com.jogamp.opengl.test&jogamp.debug=all&nativewindow.debug=all&jogl.debug=all&newt.debug=all"); final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri); Log.d(getClass().getSimpleName(), "Launching Activity: "+intent); startActivity (intent); diff --git a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java index b28cdcbed..273ff2b45 100644 --- a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java @@ -28,7 +28,7 @@ package jogamp.newt.driver.android; -import javax.media.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.DefaultGraphicsScreen; import jogamp.newt.MonitorModeProps; import jogamp.newt.MonitorModeProps.Cache; @@ -113,7 +113,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = 0; // rotated viewport y window-units props[i++] = outMetrics.widthPixels; // rotated viewport width window-units props[i++] = outMetrics.heightPixels; // rotated viewport height window-units - MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); + MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null); } @Override diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java index 786ebb31c..1cee1b45d 100644 --- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java @@ -33,26 +33,27 @@ import jogamp.newt.WindowImpl; import jogamp.newt.driver.android.event.AndroidNewtEventFactory; import jogamp.newt.driver.android.event.AndroidNewtEventTranslator; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.Capabilities; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLException; - +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.Capabilities; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLException; + +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.os.AndroidVersion; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.Window; +import com.jogamp.opengl.egl.EGL; -import jogamp.opengl.egl.EGL; import jogamp.opengl.egl.EGLDisplayUtil; import jogamp.opengl.egl.EGLGraphicsConfiguration; import jogamp.opengl.egl.EGLGraphicsConfigurationFactory; @@ -282,7 +283,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { protected final boolean canCreateNativeImpl() { Log.d(MD.TAG, "canCreateNativeImpl.0: surfaceHandle ready "+(0!=surfaceHandle)+" - on thread "+Thread.currentThread().getName()); if(Window.DEBUG_IMPLEMENTATION) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if( isFullscreen() ) { @@ -386,7 +387,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"],"+ " - on thread "+Thread.currentThread().getName()); if(Window.DEBUG_IMPLEMENTATION) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } setupInputListener(false); @@ -557,7 +558,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { public final void surfaceChanged(final SurfaceHolder aHolder, final int aFormat, final int aWidth, final int aHeight) { Log.d(MD.TAG, "surfaceChanged: f "+nativeFormat+" -> "+aFormat+", "+aWidth+"x"+aHeight+", current surfaceHandle: 0x"+Long.toHexString(surfaceHandle)+" - on thread "+Thread.currentThread().getName()); if(Window.DEBUG_IMPLEMENTATION) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if(0!=surfaceHandle && androidFormat != aFormat ) { // re-create @@ -611,7 +612,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { public final void surfaceDestroyed(final SurfaceHolder holder) { Log.d(MD.TAG, "surfaceDestroyed - on thread "+Thread.currentThread().getName()); windowDestroyNotify(true); // actually too late .. however .. - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } @Override diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java index eccdd63cf..40e3bf85a 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java @@ -42,15 +42,15 @@ import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.CapabilitiesChooser; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.CapabilitiesChooser; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.VisualIDHolder; import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; import com.jogamp.nativewindow.awt.AWTGraphicsDevice; @@ -69,8 +69,8 @@ public class AWTCanvas extends Canvas { private final UpstreamScalable upstreamScale; public static interface UpstreamScalable { - int[] getReqPixelScale(); - void setHasPixelScale(final int[] pixelScale); + float[] getReqPixelScale(); + void setHasPixelScale(final float[] pixelScale); } private boolean displayConfigChanged=false; @@ -148,7 +148,7 @@ public class AWTCanvas extends Canvas { // trigger initialization cycle jawtWindow.setSurfaceScale(upstreamScale.getReqPixelScale() ); jawtWindow.lockSurface(); - upstreamScale.setHasPixelScale(jawtWindow.getCurrentSurfaceScale(new int[2])); + upstreamScale.setHasPixelScale(jawtWindow.getCurrentSurfaceScale(new float[2])); jawtWindow.unlockSurface(); } diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java index 39e68e48c..9d3121635 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java @@ -30,8 +30,9 @@ package jogamp.newt.driver.awt; import java.awt.EventQueue; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.RunnableTask; import com.jogamp.common.util.awt.AWTEDTExecutor; import com.jogamp.newt.util.EDTUtil; @@ -140,7 +141,7 @@ public class AWTEDTUtil implements EDTUtil { // drop task .. System.err.println(Thread.currentThread()+": Warning: AWT-EDT about (1) to stop, won't enqueue new task: "+nedt); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } @@ -161,7 +162,7 @@ public class AWTEDTUtil implements EDTUtil { System.err.println(Thread.currentThread()+": Warning: AWT-EDT is not running, dropping task. NEDT "+nedt); } if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return false; diff --git a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java index 23da69dba..f0e481471 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java @@ -34,7 +34,7 @@ package jogamp.newt.driver.awt; -import javax.media.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsDevice; import com.jogamp.nativewindow.awt.AWTGraphicsDevice; import com.jogamp.newt.NewtFactory; diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java index 57948cfc3..eb92e0d13 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java @@ -119,7 +119,7 @@ public class ScreenDriver extends ScreenImpl { props[i++] = 0; // rotated viewport y window-units props[i++] = currentMode.getRotatedWidth(); // rotated viewport width window-units props[i++] = currentMode.getRotatedHeight(); // rotated viewport height window-units - MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); + MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null); } @Override diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java index 06dcb8ff5..9f776ef22 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java @@ -40,10 +40,10 @@ import java.awt.Dimension; import java.awt.Frame; import java.awt.Insets; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.util.Point; import jogamp.nativewindow.awt.AWTMisc; import jogamp.newt.WindowImpl; @@ -100,12 +100,12 @@ public class WindowDriver extends WindowImpl { private final AWTCanvas.UpstreamScalable upstreamScalable = new AWTCanvas.UpstreamScalable() { @Override - public int[] getReqPixelScale() { + public float[] getReqPixelScale() { return WindowDriver.this.reqPixelScale; } @Override - public void setHasPixelScale(final int[] pixelScale) { + public void setHasPixelScale(final float[] pixelScale) { System.arraycopy(pixelScale, 0, WindowDriver.this.hasPixelScale, 0, 2); } }; @@ -192,7 +192,7 @@ public class WindowDriver extends WindowImpl { } @Override - protected void updateInsetsImpl(final javax.media.nativewindow.util.Insets insets) { + protected void updateInsetsImpl(final com.jogamp.nativewindow.util.Insets insets) { final Insets contInsets = awtContainer.getInsets(); insets.set(contInsets.left, contInsets.right, contInsets.top, contInsets.bottom); } diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java index ceb337150..cd801e59a 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java @@ -34,13 +34,13 @@ package jogamp.newt.driver.bcm.egl; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; import jogamp.newt.NEWTJNILibLoader; -import jogamp.opengl.egl.EGL; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; public class DisplayDriver extends jogamp.newt.DisplayImpl { diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java index 2cd47313a..e65d79e2a 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java @@ -34,8 +34,8 @@ package jogamp.newt.driver.bcm.egl; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.util.Rectangle; import jogamp.newt.MonitorModeProps; import jogamp.newt.ScreenImpl; @@ -94,7 +94,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = 0; // rotated viewport y window-units props[i++] = fixedWidth; // FIXME rotated viewport width window-units props[i++] = fixedHeight; // FIXME rotated viewport height window-units - MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); + MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null); } @Override diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java index aec85f875..d737dbf75 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java @@ -34,13 +34,13 @@ package jogamp.newt.driver.bcm.egl; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.Point; -import javax.media.opengl.GLCapabilitiesImmutable; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.opengl.GLCapabilitiesImmutable; import jogamp.opengl.egl.EGLGraphicsConfiguration; diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java index 1b67fa755..3d3fde4d7 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java @@ -32,19 +32,19 @@ import java.net.URLConnection; import java.nio.Buffer; import java.nio.ByteBuffer; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.util.PixelFormat; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; +import com.jogamp.opengl.egl.EGL; import com.jogamp.opengl.util.PNGPixelRect; import jogamp.newt.DisplayImpl; import jogamp.newt.NEWTJNILibLoader; import jogamp.newt.PointerIconImpl; import jogamp.newt.driver.linux.LinuxMouseTracker; -import jogamp.opengl.egl.EGL; import jogamp.opengl.egl.EGLDisplayUtil; public class DisplayDriver extends DisplayImpl { diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java index 64cae75f6..42a63f91e 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java @@ -28,8 +28,8 @@ package jogamp.newt.driver.bcm.vc.iv; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.util.Rectangle; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.MonitorMode; @@ -87,7 +87,7 @@ public class ScreenDriver extends ScreenImpl { props[i++] = 0; // rotated viewport y window-units props[i++] = cachedWidth; // rotated viewport width window-units props[i++] = cachedWidth; // rotated viewport height window-units - MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); + MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null); } @Override diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java index ad6d0b688..29c7f9898 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java @@ -28,15 +28,15 @@ package jogamp.newt.driver.bcm.vc.iv; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsScreen; -import javax.media.nativewindow.Capabilities; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.AbstractGraphicsScreen; +import com.jogamp.nativewindow.Capabilities; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.Point; import com.jogamp.common.util.IntBitfield; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java index 1d43017c3..33712e35d 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java @@ -35,7 +35,7 @@ package jogamp.newt.driver.intel.gdl; import jogamp.newt.*; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; public class DisplayDriver extends jogamp.newt.DisplayImpl { static int initCounter = 0; diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java index 2ce835c52..bd99fd18c 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java @@ -34,9 +34,9 @@ package jogamp.newt.driver.intel.gdl; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.util.Rectangle; import jogamp.newt.MonitorModeProps; import jogamp.newt.ScreenImpl; @@ -96,7 +96,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = 0; // rotated viewport y window-units props[i++] = cachedWidth; // rotated viewport width window-units props[i++] = cachedWidth; // rotated viewport height window-units - MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); + MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null); } @Override diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java index d7bd17e42..69a8ccd37 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java @@ -34,9 +34,9 @@ package jogamp.newt.driver.intel.gdl; -import javax.media.nativewindow.*; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.*; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.Point; public class WindowDriver extends jogamp.newt.WindowImpl { static { diff --git a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java index e72ddbc11..6b28e94df 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java @@ -34,12 +34,13 @@ package jogamp.newt.driver.kd; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; + +import com.jogamp.opengl.egl.EGL; import jogamp.newt.DisplayImpl; import jogamp.newt.NEWTJNILibLoader; -import jogamp.opengl.egl.EGL; import jogamp.opengl.egl.EGLDisplayUtil; public class DisplayDriver extends DisplayImpl { diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java index d4113561a..975e0f96e 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java @@ -34,8 +34,8 @@ package jogamp.newt.driver.kd; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.util.Rectangle; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.MonitorMode; @@ -92,7 +92,7 @@ public class ScreenDriver extends ScreenImpl { props[i++] = 0; // rotated viewport y window-units props[i++] = cachedWidth; // rotated viewport width window-units props[i++] = cachedWidth; // rotated viewport height window-units - MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0); + MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null); } @Override diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java index d53ef00cd..01173007c 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java @@ -34,14 +34,14 @@ package jogamp.newt.driver.kd; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.VisualIDHolder.VIDType; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.Point; -import javax.media.opengl.GLCapabilitiesImmutable; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.VisualIDHolder.VIDType; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.opengl.GLCapabilitiesImmutable; import jogamp.newt.WindowImpl; import jogamp.opengl.egl.EGLGraphicsConfiguration; diff --git a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java index 051294dce..c8146b85d 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java @@ -38,9 +38,9 @@ import java.net.URLConnection; import java.nio.Buffer; import java.nio.ByteBuffer; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.util.PixelFormat; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; diff --git a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java index 5f458e2c9..f493bdc95 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java @@ -34,8 +34,8 @@ package jogamp.newt.driver.macosx; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.util.Rectangle; import jogamp.nativewindow.macosx.OSXUtil; import jogamp.newt.MonitorModeProps; @@ -77,7 +77,7 @@ public class ScreenDriver extends ScreenImpl { private class CrtProps { CrtProps() { count = getMonitorCount0(); - pixelScaleArray = new int[count]; + pixelScaleArray = new float[count]; propsOrigArray = new int[count][]; propsFixedArray = new int[count][]; @@ -85,8 +85,8 @@ public class ScreenDriver extends ScreenImpl { // Gather whole topology of monitors (NSScreens) // for(int crtIdx=0; crtIdx<count; crtIdx++) { - final float pixelScaleRaw = (float) OSXUtil.GetPixelScale(crtIdx); - pixelScaleArray[crtIdx] = FloatUtil.isZero(pixelScaleRaw, FloatUtil.EPSILON) ? 1 : (int)pixelScaleRaw; + final float pixelScaleRaw = (float)OSXUtil.GetPixelScaleByScreenIdx(crtIdx); + pixelScaleArray[crtIdx] = FloatUtil.isZero(pixelScaleRaw, FloatUtil.EPSILON) ? 1.0f : pixelScaleRaw; propsOrigArray[crtIdx] = getMonitorProps0(crtIdx); if ( null == propsOrigArray[crtIdx] ) { throw new InternalError("Could not gather device props "+crtIdx+"/"+count); @@ -105,7 +105,7 @@ public class ScreenDriver extends ScreenImpl { final int[] thisMonitorProps = propsFixedArray[crtIdx]; final int x = thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+0]; final int y = thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+1]; - final int thisPixelScale = pixelScaleArray[crtIdx]; + final float thisPixelScale = pixelScaleArray[crtIdx]; thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+2] *= thisPixelScale; // fix width thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+3] *= thisPixelScale; // fix height if( 0 != x ) { @@ -129,7 +129,7 @@ public class ScreenDriver extends ScreenImpl { } } final int count; - final int[] pixelScaleArray; + final float[] pixelScaleArray; final int[][] propsOrigArray; final int[][] propsFixedArray; } @@ -167,12 +167,15 @@ public class ScreenDriver extends ScreenImpl { throw new InternalError("Could not gather current mode of device "+crtIdx+"/"+crtProps.count+", but gathered "+modeIdx+" modes"); } // merge monitor-props + supported modes - MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, crtProps.propsFixedArray[crtIdx], 0); + final float pixelScale = crtProps.pixelScaleArray[crtIdx]; + MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, + new float[] { pixelScale, pixelScale }, + supportedModes, crtProps.propsFixedArray[crtIdx], 0, null); } } @Override - protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final Rectangle viewportPU, final Rectangle viewportWU) { + protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU) { final CrtProps crtProps = new CrtProps(); final int crtIdx = monitor.getId(); if( 0 > crtIdx || crtIdx >= crtProps.count ) { @@ -182,6 +185,9 @@ public class ScreenDriver extends ScreenImpl { int offset = MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT; viewportPU.set(fixedMonitorProps[offset++], fixedMonitorProps[offset++], fixedMonitorProps[offset++], fixedMonitorProps[offset++]); viewportWU.set(fixedMonitorProps[offset++], fixedMonitorProps[offset++], fixedMonitorProps[offset++], fixedMonitorProps[offset++]); + final float _pixelScale = crtProps.pixelScaleArray[crtIdx]; + pixelScale[0] = _pixelScale; + pixelScale[1] = _pixelScale; return true; } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java index c0f7d3859..7f3a53626 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java @@ -34,16 +34,16 @@ package jogamp.newt.driver.macosx; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.MutableSurface; -import javax.media.nativewindow.ScalableSurface; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.MutableSurface; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; import jogamp.nativewindow.SurfaceScaleUtils; import jogamp.nativewindow.macosx.OSXUtil; @@ -67,20 +67,26 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl public WindowDriver() { } - private boolean updatePixelScale(final boolean sendEvent, final boolean defer, final float newPixelScaleRaw, final float nativePixelScaleRaw) { - final int[] newPixelScale = new int[2]; + private boolean updatePixelScale(final boolean sendEvent, final boolean defer, final boolean deferOffThread, + final float newPixelScaleRaw, final float maxPixelScaleRaw) { + final float[] newPixelScale = new float[2]; { - final int _newPixelScale = FloatUtil.isZero(newPixelScaleRaw, FloatUtil.EPSILON) ? ScalableSurface.IDENTITY_PIXELSCALE : (int) newPixelScaleRaw; + final float _newPixelScale = FloatUtil.isZero(newPixelScaleRaw, FloatUtil.EPSILON) ? ScalableSurface.IDENTITY_PIXELSCALE : newPixelScaleRaw; newPixelScale[0]= _newPixelScale; newPixelScale[1]= _newPixelScale; - final int _nativePixelScale = FloatUtil.isZero(nativePixelScaleRaw, FloatUtil.EPSILON) ? ScalableSurface.IDENTITY_PIXELSCALE : (int) nativePixelScaleRaw; - nativePixelScale[0]= _nativePixelScale; - nativePixelScale[1]= _nativePixelScale; + final float _maxPixelScale = FloatUtil.isZero(maxPixelScaleRaw, FloatUtil.EPSILON) ? ScalableSurface.IDENTITY_PIXELSCALE : maxPixelScaleRaw; + maxPixelScale[0]= _maxPixelScale; + maxPixelScale[1]= _maxPixelScale; } + // We keep minPixelScale at [1f, 1f]! - if( SurfaceScaleUtils.computePixelScale(hasPixelScale, hasPixelScale, reqPixelScale, newPixelScale, DEBUG_IMPLEMENTATION ? getClass().getName() : null) ) { + if( SurfaceScaleUtils.setNewPixelScale(hasPixelScale, hasPixelScale, newPixelScale, minPixelScale, maxPixelScale, DEBUG_IMPLEMENTATION ? getClass().getName() : null) ) { if( sendEvent ) { - super.sizeChanged(defer, getWidth(), getHeight(), true); + if( deferOffThread ) { + superSizeChangedOffThread(defer, getWidth(), getHeight(), true); + } else { + super.sizeChanged(defer, getWidth(), getHeight(), true); + } } else { defineSize(getWidth(), getHeight()); } @@ -91,34 +97,34 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } private boolean updatePixelScaleByScreenIdx(final boolean sendEvent) { - final float nativePixelScaleRaw = (float) OSXUtil.GetPixelScale(getScreen().getIndex()); + final float maxPixelScaleRaw = (float) OSXUtil.GetPixelScaleByScreenIdx(getScreen().getIndex()); if( DEBUG_IMPLEMENTATION ) { - System.err.println("WindowDriver.updatePixelScale.1: "+hasPixelScale[0]+", "+nativePixelScaleRaw+" (native)"); + System.err.println("WindowDriver.updatePixelScale.1: "+hasPixelScale[0]+", "+maxPixelScaleRaw+" (max)"); } - return updatePixelScale(sendEvent, true /* defer */, nativePixelScaleRaw, nativePixelScaleRaw); + return updatePixelScale(sendEvent, true /* defer */, false /*offthread */, maxPixelScaleRaw, maxPixelScaleRaw); } private boolean updatePixelScaleByWindowHandle(final boolean sendEvent) { final long handle = getWindowHandle(); if( 0 != handle ) { - final float nativePixelScaleRaw = (float)OSXUtil.GetPixelScale(handle); + final float maxPixelScaleRaw = (float)OSXUtil.GetPixelScale(handle); if( DEBUG_IMPLEMENTATION ) { - System.err.println("WindowDriver.updatePixelScale.2: "+hasPixelScale[0]+", "+nativePixelScaleRaw+" (native)"); + System.err.println("WindowDriver.updatePixelScale.2: "+hasPixelScale[0]+", "+maxPixelScaleRaw+" (max)"); } - return updatePixelScale(sendEvent, true /* defer */, nativePixelScaleRaw, nativePixelScaleRaw); + return updatePixelScale(sendEvent, true /* defer */, false /*offthread */, maxPixelScaleRaw, maxPixelScaleRaw); } else { return false; } } /** Called from native code */ - protected void updatePixelScale(final boolean defer, final float newPixelScaleRaw, final float nativePixelScaleRaw) { + protected void updatePixelScale(final boolean defer, final float newPixelScaleRaw, final float maxPixelScaleRaw) { final long handle = getWindowHandle(); if( DEBUG_IMPLEMENTATION ) { - System.err.println("WindowDriver.updatePixelScale.3: "+hasPixelScale[0]+" (has) -> "+newPixelScaleRaw+" (raw), "+nativePixelScaleRaw+" (native), drop "+(0==handle)); + System.err.println("WindowDriver.updatePixelScale.3: "+hasPixelScale[0]+" (has) -> "+newPixelScaleRaw+" (new), "+maxPixelScaleRaw+" (max), drop "+(0==handle)); } if( 0 != handle ) { - updatePixelScale(true /* sendEvent*/, defer, newPixelScaleRaw, nativePixelScaleRaw); + updatePixelScale(true /* sendEvent*/, defer, true /*offthread */, newPixelScaleRaw, maxPixelScaleRaw); } } @@ -139,44 +145,47 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - public final void setSurfaceScale(final int[] pixelScale) { - SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG_IMPLEMENTATION ? getClass().getName() : null); + public final boolean setSurfaceScale(final float[] pixelScale) { + super.setSurfaceScale(pixelScale); - final int[] resPixelScale; + boolean changed = false; if( isNativeValid() ) { if( isOffscreenInstance ) { final NativeWindow pWin = getParent(); if( pWin instanceof ScalableSurface ) { final ScalableSurface sSurf = (ScalableSurface)pWin; sSurf.setSurfaceScale(reqPixelScale); - final int[] pPixelScale = sSurf.getCurrentSurfaceScale(new int[2]); - sSurf.getNativeSurfaceScale(nativePixelScale); - updatePixelScale(true /* sendEvent */, true /* defer */, pPixelScale[0], nativePixelScale[0]); // HiDPI: uniformPixelScale + sSurf.getMaximumSurfaceScale(maxPixelScale); + sSurf.getMinimumSurfaceScale(minPixelScale); + final float[] pPixelScale = sSurf.getCurrentSurfaceScale(new float[2]); + changed = updatePixelScale(true /* sendEvent */, true /* defer */, true /*offthread */, pPixelScale[0], maxPixelScale[0]); // HiDPI: uniformPixelScale } else { // just notify updated pixelScale if offscreen - SurfaceScaleUtils.replaceAutoMaxWithPlatformMax(reqPixelScale); - updatePixelScale(true /* sendEvent */, true /* defer */, reqPixelScale[0], nativePixelScale[0]); // HiDPI: uniformPixelScale + changed = updatePixelScale(true /* sendEvent */, true /* defer */, true /*offthread */, reqPixelScale[0], maxPixelScale[0]); // HiDPI: uniformPixelScale } } else { - // set pixelScale in native code, will issue an update PixelScale - OSXUtil.RunOnMainThread(true, false, new Runnable() { - @Override - public void run() { - setPixelScale0(getWindowHandle(), surfaceHandle, reqPixelScale[0]); // HiDPI: uniformPixelScale - } - } ); + // set pixelScale in native code, will issue an update updatePixelScale(..) + // hence we pre-query whether pixel-scale will change, without affecting current state 'hasPixelScale'! + final float[] _hasPixelScale = new float[2]; + System.arraycopy(hasPixelScale, 0, _hasPixelScale, 0, 2); + if( SurfaceScaleUtils.setNewPixelScale(_hasPixelScale, _hasPixelScale, reqPixelScale, minPixelScale, maxPixelScale, DEBUG_IMPLEMENTATION ? getClass().getName() : null) ) { + OSXUtil.RunOnMainThread(true, false, new Runnable() { + @Override + public void run() { + setPixelScale0(getWindowHandle(), surfaceHandle, _hasPixelScale[0]); // HiDPI: uniformPixelScale + } + } ); + changed = true; + } } - resPixelScale = hasPixelScale; - } else { - hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; - hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; - resPixelScale = reqPixelScale; } if( DEBUG_IMPLEMENTATION ) { - System.err.println("WindowDriver.setPixelScale: "+pixelScale[0]+"x"+pixelScale[1]+" (req) -> "+ - reqPixelScale[0]+"x"+reqPixelScale[1]+" (validated) -> "+ - resPixelScale[0]+"x"+resPixelScale[1]+" (result) - realized "+isNativeValid()); + System.err.println("WindowDriver.setPixelScale: min["+minPixelScale[0]+", "+minPixelScale[1]+"], max["+ + maxPixelScale[0]+", "+maxPixelScale[1]+"], req["+ + reqPixelScale[0]+", "+reqPixelScale[1]+"] -> result["+ + hasPixelScale[0]+", "+hasPixelScale[1]+"] - changed "+changed+", realized "+isNativeValid()); } + return changed; } @Override @@ -360,13 +369,23 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl System.err.println("MacWindow: sizeChanged() parent["+useParent+" "+x+"/"+y+"] "+getX()+"/"+getY()+" "+newWidth+"x"+newHeight+" -> "+p0S+" screen-client-pos"); } OSXUtil.RunOnMainThread(false, false, new Runnable() { - @Override - public void run() { - setWindowClientTopLeftPoint0(getWindowHandle(), p0S.getX(), p0S.getY(), isVisible()); - } } ); + @Override + public void run() { + setWindowClientTopLeftPoint0(getWindowHandle(), p0S.getX(), p0S.getY(), isVisible()); + } } ); } } - super.sizeChanged(defer, newWidth, newHeight, force); + superSizeChangedOffThread(defer, newWidth, newHeight, force); + } + private void superSizeChangedOffThread(final boolean defer, final int newWidth, final int newHeight, final boolean force) { + if( defer ) { + new Thread() { + public void run() { + WindowDriver.super.sizeChanged(false /* defer */, newWidth, newHeight, force); + } }.start(); + } else { + WindowDriver.super.sizeChanged(false /* defer */, newWidth, newHeight, force); + } } @Override @@ -556,14 +575,18 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl @Override protected void warpPointerImpl(final int x, final int y) { if( !isOffscreenInstance ) { - warpPointer0(getWindowHandle(), x / getPixelScaleX(), y / getPixelScaleY()); + warpPointer0(getWindowHandle(), + SurfaceScaleUtils.scaleInv(x, getPixelScaleX()), + SurfaceScaleUtils.scaleInv(y, getPixelScaleY())); } // else may need offscreen solution ? FIXME } @Override protected final void doMouseEvent(final boolean enqueue, final boolean wait, final short eventType, final int modifiers, final int x, final int y, final short button, final float[] rotationXYZ, final float rotationScale) { - super.doMouseEvent(enqueue, wait, eventType, modifiers, x * getPixelScaleX(), y * getPixelScaleY(), button, rotationXYZ, rotationScale); + super.doMouseEvent(enqueue, wait, eventType, modifiers, + SurfaceScaleUtils.scale(x, getPixelScaleX()), + SurfaceScaleUtils.scale(y, getPixelScaleY()), button, rotationXYZ, rotationScale); } @Override diff --git a/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java b/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java index 5e703f690..f9f1f13ad 100644 --- a/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java +++ b/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java @@ -32,7 +32,7 @@ import java.net.MalformedURLException; import java.net.URLConnection; import java.nio.ByteBuffer; -import javax.media.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.PixelFormat; import com.jogamp.common.nio.Buffers; import com.jogamp.common.os.Platform; diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java index 8973ae7ed..c44aa39f4 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java @@ -43,9 +43,9 @@ import jogamp.nativewindow.windows.RegisteredClassFactory; import jogamp.newt.DisplayImpl; import jogamp.newt.NEWTJNILibLoader; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.util.PixelFormat; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; diff --git a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java index 38acd03ae..b476ee38a 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java @@ -33,8 +33,8 @@ */ package jogamp.newt.driver.windows; -import javax.media.nativewindow.DefaultGraphicsScreen; -import javax.media.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.DefaultGraphicsScreen; +import com.jogamp.nativewindow.util.Rectangle; import jogamp.newt.MonitorModeProps; import jogamp.newt.ScreenImpl; @@ -106,7 +106,7 @@ public class ScreenDriver extends ScreenImpl { if ( null != currentMode ) { // enabled final int[] monitorProps = getMonitorDevice0(adapterName, crtIdx); // merge monitor-props + supported modes - MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, monitorProps, 0); + MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, supportedModes, monitorProps, 0, null); // next monitor, 1st mode supportedModes= new ArrayHashSet<MonitorMode>(); @@ -118,7 +118,7 @@ public class ScreenDriver extends ScreenImpl { } @Override - protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final Rectangle viewportPU, final Rectangle viewportWU) { + protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU) { final String adapterName = getAdapterName(monitor.getId()); if( null != adapterName ) { final String activeMonitorName = getActiveMonitorName(adapterName, 0); diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java index 1c5c34457..cf286e54b 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java @@ -41,13 +41,13 @@ import jogamp.nativewindow.windows.GDIUtil; import jogamp.newt.PointerIconImpl; import jogamp.newt.WindowImpl; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.util.Point; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionNumber; diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java index e2b9a65d1..3276f3ed1 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java @@ -37,9 +37,9 @@ package jogamp.newt.driver.x11; import java.nio.Buffer; import java.nio.ByteBuffer; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.util.PixelFormat; import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.x11.X11GraphicsDevice; diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR.java b/src/newt/classes/jogamp/newt/driver/x11/RandR.java index 8b065d1f0..14c9c0856 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR.java @@ -29,7 +29,7 @@ package jogamp.newt.driver.x11; import java.util.List; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.RectangleImmutable; import jogamp.newt.MonitorModeProps; diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java index 4803852f9..d11703e47 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java @@ -27,7 +27,7 @@ */ package jogamp.newt.driver.x11; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.RectangleImmutable; import jogamp.newt.MonitorModeProps; import jogamp.newt.ScreenImpl; diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java index 7a409bba1..b6d8f13a1 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java @@ -29,7 +29,7 @@ package jogamp.newt.driver.x11; import java.util.Iterator; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.RectangleImmutable; import jogamp.newt.MonitorModeProps; diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java index f7361740e..993ff58f9 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java @@ -36,9 +36,9 @@ package jogamp.newt.driver.x11; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; import jogamp.nativewindow.x11.X11Util; import jogamp.newt.Debug; @@ -152,7 +152,7 @@ public class ScreenDriver extends ScreenImpl { if( null != monitorProps && MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps[0] && // Enabled ? I.e. contains active modes ? MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps.length ) { - MonitorModeProps.streamInMonitorDevice(null, cache, this, monitorProps, 0); + MonitorModeProps.streamInMonitorDevice(cache, this, null, monitorProps, 0, null); } } } @@ -166,7 +166,7 @@ public class ScreenDriver extends ScreenImpl { } @Override - protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final Rectangle viewportPU, final Rectangle viewportWU) { + protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU) { final AbstractGraphicsDevice device = getDisplay().getGraphicsDevice(); device.lock(); try { diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java index afa9786e2..cdeb7d6d0 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java @@ -44,12 +44,13 @@ import jogamp.newt.PointerIconImpl; import jogamp.newt.WindowImpl; import jogamp.newt.driver.PNGIcon; -import javax.media.nativewindow.*; -import javax.media.nativewindow.VisualIDHolder.VIDType; -import javax.media.nativewindow.util.Insets; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.nativewindow.util.Point; +import com.jogamp.nativewindow.*; +import com.jogamp.nativewindow.VisualIDHolder.VIDType; +import com.jogamp.nativewindow.util.Insets; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.x11.X11GraphicsDevice; import com.jogamp.nativewindow.x11.X11GraphicsScreen; @@ -424,7 +425,7 @@ public class WindowDriver extends WindowImpl { // Internals only // private static final String getCurrentThreadName() { return Thread.currentThread().getName(); } // Callback for JNI - private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI + private static final void dumpStack() { ExceptionUtils.dumpStack(System.err); } // Callback for JNI private final <T> T runWithLockedDisplayDevice(final DisplayRunnable<T> action) { return ((DisplayDriver) getScreen().getDisplay()).runWithLockedDisplayDevice(action); diff --git a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java index 794e989a6..9039b6083 100644 --- a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java +++ b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java @@ -27,10 +27,11 @@ */ package jogamp.newt.swt; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowException; import jogamp.newt.Debug; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.RunnableTask; import com.jogamp.newt.util.EDTUtil; @@ -170,7 +171,7 @@ public class SWTEDTUtil implements EDTUtil { // drop task .. if(DEBUG) { System.err.println(Thread.currentThread()+": Warning: SWT-EDT about (1) to stop, won't enqueue new task: "+nedt+", isRunning "+nedt.isRunning+", shouldStop "+nedt.shouldStop); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } @@ -195,7 +196,7 @@ public class SWTEDTUtil implements EDTUtil { System.err.println(Thread.currentThread()+": Warning: SWT-EDT is not running, dropping task. NEDT "+nedt); } if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return false; @@ -212,7 +213,7 @@ public class SWTEDTUtil implements EDTUtil { if( swtDisplay.isDisposed() ) { System.err.println(Thread.currentThread()+": Warning: SWT-EDT is about (3) to stop and stopped already, dropping task. "+nedt); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java index a989345dd..bb0b8c1aa 100644 --- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java @@ -28,8 +28,8 @@ package jogamp.newt.swt.event; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.NativeSurfaceHolder; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.NativeSurfaceHolder; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Event; diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m index 2bd11da3c..e0f8be856 100644 --- a/src/newt/native/MacWindow.m +++ b/src/newt/native/MacWindow.m @@ -48,7 +48,7 @@ #include "timespec.h" #endif -static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point"; +static const char * const ClazzNamePoint = "com/jogamp/nativewindow/util/Point"; static const char * const ClazzAnyCstrName = "<init>"; static const char * const ClazzNamePointCstrSignature = "(II)V"; static jclass pointClz = NULL; @@ -420,7 +420,7 @@ NS_ENDHANDLER CGDirectDisplayID NewtScreen_getCGDirectDisplayIDByNSScreen(NSScreen *screen) { - // Mind: typedef uint32_t CGDirectDisplayID; - however, we assume it's 64bit on 64bit ?! + // Mind: typedef uint32_t CGDirectDisplayID; NSDictionary * dict = [screen deviceDescription]; NSNumber * val = (NSNumber *) [dict objectForKey: @"NSScreenNumber"]; // [NSNumber integerValue] returns NSInteger which is 32 or 64 bit native size @@ -1401,7 +1401,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_setAlwaysOnTo /* * Class: jogamp_newt_driver_macosx_WindowDriver * Method: getLocationOnScreen0 - * Signature: (JII)Ljavax/media/nativewindow/util/Point; + * Signature: (JII)Lcom/jogamp/nativewindow/util/Point; */ JNIEXPORT jobject JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_getLocationOnScreen0 (JNIEnv *env, jclass unused, jlong win, jint src_x, jint src_y) diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m index caf9e54e0..7b3df391d 100644 --- a/src/newt/native/NewtMacWindow.m +++ b/src/newt/native/NewtMacWindow.m @@ -784,11 +784,21 @@ static jmethodID windowRepaintID = NULL; [super viewDidChangeBackingProperties]; // HiDPI scaling - BOOL useHiDPI = [self wantsBestResolutionOpenGLSurface]; - CGFloat pixelScaleNative = [[self window] backingScaleFactor]; - CGFloat pixelScaleUse = useHiDPI ? pixelScaleNative : 1.0; - DBG_PRINT("viewDidChangeBackingProperties: PixelScale: HiDPI %d, native %f -> use %f\n", useHiDPI, (float)pixelScaleNative, (float)pixelScaleUse); - [[self layer] setContentsScale: pixelScaleUse]; + BOOL useHiDPI = false; + CGFloat maxPixelScale = 1.0; + CGFloat winPixelScale = 1.0; + NSWindow* window = [self window]; + NSScreen* screen = [window screen]; +NS_DURING + maxPixelScale = [screen backingScaleFactor]; + useHiDPI = [self wantsBestResolutionOpenGLSurface]; + if( useHiDPI ) { + winPixelScale = [window backingScaleFactor]; + } +NS_HANDLER +NS_ENDHANDLER + DBG_PRINT("viewDidChangeBackingProperties: PixelScale: HiDPI %d, max %f, window %f\n", useHiDPI, (float)maxPixelScale, (float)winPixelScale); + [[self layer] setContentsScale: winPixelScale]; if (javaWindowObject == NULL) { DBG_PRINT("viewDidChangeBackingProperties: null javaWindowObject\n"); @@ -801,7 +811,7 @@ static jmethodID windowRepaintID = NULL; return; } - (*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, JNI_TRUE, (jfloat)pixelScaleUse, (jfloat)pixelScaleNative); // defer + (*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, JNI_TRUE, (jfloat)winPixelScale, (jfloat)maxPixelScale); // defer // detaching thread not required - daemon // NewtCommon_ReleaseJNIEnv(shallBeDetached); diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java index f6dc8bf9f..d0d9f5a85 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java @@ -27,11 +27,11 @@ */ package jogamp.opengl.oculusvr; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; import com.jogamp.oculusvr.OVR; import com.jogamp.oculusvr.OvrHmdContext; diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java index 39736217c..1e5656129 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java @@ -30,13 +30,13 @@ package jogamp.opengl.oculusvr; import java.nio.FloatBuffer; import java.nio.ShortBuffer; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLArrayData; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLArrayData; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; import jogamp.common.os.PlatformPropsImpl; diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java index 44ec728fc..16aeac4b1 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java @@ -27,11 +27,11 @@ */ package jogamp.opengl.oculusvr; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.RectangleImmutable; import com.jogamp.oculusvr.OVR; import com.jogamp.oculusvr.ovrEyeRenderDesc; diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java index 66959e90f..8555d4155 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java @@ -33,8 +33,8 @@ import java.net.URISyntaxException; import java.net.URLConnection; import java.util.Arrays; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java index 33dbe8fc5..841404516 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java @@ -33,8 +33,8 @@ import java.net.URISyntaxException; import java.net.URLConnection; import java.util.Arrays; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0a.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0a.java index f9703fd98..a8223a76f 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0a.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0a.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieCubeActivityLauncher0a extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0a"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0b.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0b.java index 81d8a3b04..3286f673a 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0b.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0b.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieCubeActivityLauncher0b extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0b"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java index 205fa8074..1b1743f5b 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieCubeActivityLauncher1a extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0a"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java index 2e85775cf..5135122a1 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieCubeActivityLauncher1b extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0b"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java index 5991e28ee..e6aba9455 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java @@ -32,8 +32,8 @@ import java.net.URISyntaxException; import java.net.URLConnection; import java.util.Arrays; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java index 0267db514..086532015 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java @@ -32,11 +32,11 @@ import java.net.URISyntaxException; import java.net.URLConnection; import java.util.Arrays; -import javax.media.nativewindow.util.Rectangle; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java index bcc20f770..38b7a71db 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieSimpleActivityLauncher00b extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.MovieSimpleActivity0"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java index e9636fb39..a65896339 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieSimpleActivityLauncher00c extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.MovieSimpleActivity0"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01a.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01a.java index 5fbd90751..739838347 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01a.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01a.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieSimpleActivityLauncher01a extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.MovieSimpleActivity1"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01b.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01b.java index d9f6244a6..d5918f84e 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01b.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01b.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieSimpleActivityLauncher01b extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.MovieSimpleActivity1"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher02.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher02.java index 09f4f9224..9bc85b6b0 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher02.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher02.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieSimpleActivityLauncher02 extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.MovieSimpleActivity1"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java index 9183e572c..ebce37994 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.android; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java index 95504b7a7..f2eb70bb6 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java @@ -8,7 +8,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTElektronActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTElektronActivity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java index 3ec85c108..46165e70b 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.android; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java index db4d57825..5e721f32d 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java @@ -7,7 +7,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGearsES1ActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGearsES1Activity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java index 25eb25892..e4fabbbcc 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java @@ -31,8 +31,8 @@ import java.nio.Buffer; import java.nio.ByteBuffer; import java.util.ArrayList; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java index 06316c4b0..341e6a378 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGearsES2ActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java index 2e005cb7f..7454058fa 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGearsES2ECTActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java index 94e32f1d0..7e20596cb 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGearsES2RGB565ActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java index 1080b2d89..ebf8f35d6 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.android; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java index 332b26e76..590199ff9 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java @@ -7,7 +7,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGearsES2TransActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2TransActivity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java index cd7eb4c66..f84c7672b 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.android; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java index 5dd8686b4..27b367772 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java @@ -7,7 +7,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGraphUI1pActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGraphUI1pActivity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java index 55bdbcff6..af079f1ac 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.android; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java index 09e500b36..349d2a17e 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java @@ -7,7 +7,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGraphUI2pActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGraphUI2pActivity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java index f256f98a9..a3a51ef0c 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.android; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java index 4b5a05f37..380a37b93 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java @@ -7,7 +7,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTRedSquareES1ActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTRedSquareES1Activity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; @Override diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java index 99c65d6ad..db246c91c 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.android; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java index 40cb4bfb5..22058dd34 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java @@ -11,7 +11,7 @@ public class NEWTRedSquareES2ActivityLauncher extends Activity { public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - final Uri uri = Uri.parse("launch://jogamp.org/com.jogamp.opengl.test.android.NEWTRedSquareES2Activity?sys=com.jogamp.common&sys=javax.media.opengl&pkg=com.jogamp.opengl.test"); + final Uri uri = Uri.parse("launch://jogamp.org/com.jogamp.opengl.test.android.NEWTRedSquareES2Activity?sys=com.jogamp.common&sys=com.jogamp.opengl&pkg=com.jogamp.opengl.test"); final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri); Log.d(getClass().getSimpleName(), "Launching Activity: "+intent); startActivity (intent); diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java b/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java index 9136b4e61..35f69c59e 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java +++ b/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java @@ -4,9 +4,9 @@ import javax.swing.*; import java.awt.*; -import javax.media.opengl.*; -import javax.media.opengl.awt.*; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.*; +import com.jogamp.opengl.awt.*; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; public class Bug427GLJPanelTest1 extends JFrame implements GLEventListener { diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java index c463ede2a..89d28c08d 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java +++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java @@ -16,17 +16,17 @@ import java.nio.FloatBuffer; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.glu.GLU; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java index 580f3caea..5019391ad 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java +++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java @@ -16,17 +16,17 @@ import java.nio.FloatBuffer; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.glu.GLU; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java index 1128c7680..1228f1453 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java +++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java @@ -15,11 +15,11 @@ import java.awt.event.WindowEvent; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java index 83db15cf3..fb4937014 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java +++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java @@ -11,11 +11,11 @@ import java.awt.Rectangle; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.SwingUtilities; import com.jogamp.newt.awt.NewtCanvasAWT; diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java index a3fd3fa21..a385e451a 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java +++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java @@ -9,11 +9,11 @@ import java.awt.Rectangle; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.SwingUtilities; import com.jogamp.newt.awt.NewtCanvasAWT; diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java b/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java index 802bd65d5..b21a19e96 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java @@ -9,13 +9,13 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.Random; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.glu.GLU; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.awt.TextRenderer; diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java b/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java index 032eaa23c..718144ba6 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java @@ -4,12 +4,12 @@ import java.awt.Font; import java.awt.Frame; import java.awt.event.*; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.util.awt.*; diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java index 54786bbc3..184a2ef0f 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java @@ -6,13 +6,13 @@ import java.awt.Frame; import java.awt.event.*; import java.awt.geom.*; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.glu.*; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.glu.*; import com.jogamp.opengl.util.awt.TextRenderer; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java index 8e647c3ab..b5c0d259e 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java @@ -29,12 +29,12 @@ package com.jogamp.opengl.test.junit.graph; import java.io.IOException; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.common.os.PlatformPropsImpl; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java index 2f67466a9..86b129fe1 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java @@ -31,15 +31,15 @@ import java.io.File; import java.io.IOException; import java.net.URL; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; import org.junit.Assert; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java index 26fc2e07c..ec7ffd005 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java @@ -29,13 +29,13 @@ package com.jogamp.opengl.test.junit.graph; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import jogamp.common.os.PlatformPropsImpl; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java index 78dc87489..4e66f6920 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java @@ -30,13 +30,13 @@ package com.jogamp.opengl.test.junit.graph; import java.io.File; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java index d6affd7e2..678361f24 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java @@ -30,13 +30,13 @@ package com.jogamp.opengl.test.junit.graph; import java.io.File; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java index f1a6b761b..1ee8a464d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java @@ -29,10 +29,10 @@ package com.jogamp.opengl.test.junit.graph; import java.io.IOException; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RenderState; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java index 82d129f4e..ed84414d9 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java @@ -28,10 +28,10 @@ package com.jogamp.opengl.test.junit.graph.demos; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.GLRegion; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java index 2486b5853..1660cef4d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java @@ -31,10 +31,10 @@ package com.jogamp.opengl.test.junit.graph.demos; import java.util.ArrayList; import java.util.List; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.GLRegion; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java index 77456d5e3..fd6c9a882 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java @@ -28,8 +28,8 @@ package com.jogamp.opengl.test.junit.graph.demos; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RenderState; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java index 159d4b84c..73b76debb 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java @@ -32,16 +32,16 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; -import javax.media.opengl.FPSCounter; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLPipelineFactory; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.FPSCounter; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; @@ -124,10 +124,10 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { autoDrawable = drawable; GL2ES2 gl = drawable.getGL().getGL2ES2(); if(debug) { - gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ).getGL2ES2(); + gl = gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, gl, null) ).getGL2ES2(); } if(trace) { - gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ).getGL2ES2(); + gl = gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, gl, new Object[] { System.err } ) ).getGL2ES2(); } System.err.println("*** "+gl.getContext().getGLVersion()); System.err.println("*** GLDebugMessage "+gl.getContext().isGLDebugMessageEnabled()); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java index 602879319..f7e779cd3 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java @@ -28,9 +28,9 @@ package com.jogamp.opengl.test.junit.graph.demos; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RenderState; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java index cba70c09f..fff3bc291 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.junit.graph.demos; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RenderState; @@ -47,9 +47,9 @@ public class GPUTextNewtDemo { * * If DEBUG is enabled: * - * Caused by: javax.media.opengl.GLException: Thread[main-Display-X11_:0.0-1-EDT-1,5,main] glGetError() returned the following error codes after a call to glFramebufferRenderbuffer(<int> 0x8D40, <int> 0x1902, <int> 0x8D41, <int> 0x1): GL_INVALID_ENUM ( 1280 0x500), - * at javax.media.opengl.DebugGL4bc.checkGLGetError(DebugGL4bc.java:33961) - * at javax.media.opengl.DebugGL4bc.glFramebufferRenderbuffer(DebugGL4bc.java:33077) + * Caused by: com.jogamp.opengl.GLException: Thread[main-Display-X11_:0.0-1-EDT-1,5,main] glGetError() returned the following error codes after a call to glFramebufferRenderbuffer(<int> 0x8D40, <int> 0x1902, <int> 0x8D41, <int> 0x1): GL_INVALID_ENUM ( 1280 0x500), + * at com.jogamp.opengl.DebugGL4bc.checkGLGetError(DebugGL4bc.java:33961) + * at com.jogamp.opengl.DebugGL4bc.glFramebufferRenderbuffer(DebugGL4bc.java:33077) * at jogamp.graph.curve.opengl.VBORegion2PGL3.initFBOTexture(VBORegion2PGL3.java:295) */ static final boolean DEBUG = false; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java index bb688f9b3..c648708d4 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java @@ -29,12 +29,12 @@ package com.jogamp.opengl.test.junit.graph.demos; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java index 685e3bd86..4bb72bbd2 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java @@ -7,14 +7,13 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.media.nativewindow.util.Dimension; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLPipelineFactory; -import javax.media.opengl.GLRunnable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.GLRunnable; import com.jogamp.common.net.Uri; import com.jogamp.graph.curve.Region; @@ -672,7 +671,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { dpiH = surfacePixelsPerMM[1]*25.4f; System.err.println("Monitor detected: "+mm); System.err.println("Monitor dpi: "+monitorDpiH); - System.err.println("Surface scale: native "+new Dimension(upWin.getNativeSurfaceScale(new int[2]))+", current "+new Dimension(upWin.getCurrentSurfaceScale(new int[2]))); + System.err.println("Surface scale: native "+Arrays.toString(upWin.getMaximumSurfaceScale(new float[2]))+", current "+Arrays.toString(upWin.getCurrentSurfaceScale(new float[2]))); System.err.println("Surface dpi: "+dpiH); } else { System.err.println("Using default DPI of "+dpiH); @@ -694,10 +693,10 @@ public class GPUUISceneGLListener0A implements GLEventListener { cDrawable = drawable; GL2ES2 gl = drawable.getGL().getGL2ES2(); if(debug) { - gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ).getGL2ES2(); + gl = gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, gl, null) ).getGL2ES2(); } if(trace) { - gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ).getGL2ES2(); + gl = gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, gl, new Object[] { System.err } ) ).getGL2ES2(); } try { diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java index 274fbea2a..8b5b70239 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java @@ -4,11 +4,11 @@ import java.awt.Component; import java.awt.Frame; import java.lang.reflect.InvocationTargetException; -import javax.media.nativewindow.ScalableSurface; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import javax.swing.SwingUtilities; import org.junit.Assume; @@ -30,7 +30,7 @@ public class GPUUISceneNewtCanvasAWTDemo { static boolean GraphMSAAMode = false; static float GraphAutoMode = GPUUISceneGLListener0A.DefaultNoAADPIThreshold; - static int[] reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + static float[] reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; static void setComponentSize(final Component comp, final DimensionImmutable new_sz) { try { @@ -91,7 +91,7 @@ public class GPUUISceneNewtCanvasAWTDemo { y = MiscUtils.atoi(args[i], y); } else if(args[i].equals("-pixelScale")) { i++; - final int pS = MiscUtils.atoi(args[i], reqSurfacePixelScale[0]); + final float pS = MiscUtils.atof(args[i], reqSurfacePixelScale[0]); reqSurfacePixelScale[0] = pS; reqSurfacePixelScale[1] = pS; } else if(args[i].equals("-es2")) { @@ -151,10 +151,10 @@ public class GPUUISceneNewtCanvasAWTDemo { window.setSize(width, height); window.setTitle("GraphUI Newt/AWT Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples); window.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = window.getRequestedSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = window.getRequestedSurfaceScale(new float[2]); final GPUUISceneGLListener0A sceneGLListener = 0 < GraphAutoMode ? new GPUUISceneGLListener0A(GraphAutoMode, DEBUG, TRACE) : - new GPUUISceneGLListener0A(rmode, DEBUG, TRACE); + new GPUUISceneGLListener0A(rmode, DEBUG, TRACE); window.addGLEventListener(sceneGLListener); sceneGLListener.attachInputListenerTo(window); @@ -180,7 +180,7 @@ public class GPUUISceneNewtCanvasAWTDemo { frame.setVisible(true); } }); - final int[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new int[2]); + final float[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new float[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java index 16d56a041..aa6dd00cc 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java @@ -1,8 +1,8 @@ package com.jogamp.opengl.test.junit.graph.demos; -import javax.media.nativewindow.ScalableSurface; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.graph.curve.Region; import com.jogamp.newt.event.WindowAdapter; @@ -20,7 +20,7 @@ public class GPUUISceneNewtDemo { static boolean GraphMSAAMode = false; static float GraphAutoMode = GPUUISceneGLListener0A.DefaultNoAADPIThreshold; - static int[] reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + static float[] reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; public static void main(final String[] args) { int width = 800, height = 400; @@ -66,7 +66,7 @@ public class GPUUISceneNewtDemo { y = MiscUtils.atoi(args[i], y); } else if(args[i].equals("-pixelScale")) { i++; - final int pS = MiscUtils.atoi(args[i], reqSurfacePixelScale[0]); + final float pS = MiscUtils.atof(args[i], reqSurfacePixelScale[0]); reqSurfacePixelScale[0] = pS; reqSurfacePixelScale[1] = pS; } else if(args[i].equals("-es2")) { @@ -126,7 +126,7 @@ public class GPUUISceneNewtDemo { window.setSize(width, height); window.setTitle("GraphUI Newt Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples); window.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = window.getRequestedSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = window.getRequestedSurfaceScale(new float[2]); final GPUUISceneGLListener0A sceneGLListener = 0 < GraphAutoMode ? new GPUUISceneGLListener0A(GraphAutoMode, DEBUG, TRACE) : new GPUUISceneGLListener0A(rmode, DEBUG, TRACE); @@ -145,7 +145,7 @@ public class GPUUISceneNewtDemo { }); window.setVisible(true); - final int[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new int[2]); + final float[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new float[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java index d838e42e8..bd50da534 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java @@ -27,11 +27,11 @@ */ package com.jogamp.opengl.test.junit.graph.demos; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; public class MSAATool { public static boolean glIsEnabled(final GL gl, final int name) { diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java index 0086222dc..a7c0bf84b 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java @@ -27,7 +27,7 @@ */ package com.jogamp.opengl.test.junit.graph.demos.ui; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java index a8cd32035..ba47d7e4f 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java @@ -27,15 +27,15 @@ */ package com.jogamp.opengl.test.junit.graph.demos.ui; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLOffscreenAutoDrawable; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java index 5d8e9e8db..8556007d3 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java @@ -27,7 +27,7 @@ */ package com.jogamp.opengl.test.junit.graph.demos.ui; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java index 1181ef914..e0c2adf6b 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java @@ -27,7 +27,7 @@ */ package com.jogamp.opengl.test.junit.graph.demos.ui; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES2; import jogamp.graph.geom.plane.AffineTransform; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java index 4943c9418..a6b2e03bd 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.junit.graph.demos.ui; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.Region; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java index 76b70ddf8..bdde61ad9 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java @@ -27,7 +27,7 @@ */ package com.jogamp.opengl.test.junit.graph.demos.ui; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java index c455ea365..80c27218e 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java @@ -27,7 +27,7 @@ */ package com.jogamp.opengl.test.junit.graph.demos.ui; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES2; import jogamp.graph.geom.plane.AffineTransform; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java index 3d4865b5d..98ddc1db2 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java @@ -4,12 +4,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLRunnable; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.newt.event.GestureHandler; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java index 25134edf6..30b5a6b90 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java @@ -27,7 +27,7 @@ */ package com.jogamp.opengl.test.junit.graph.demos.ui; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.Region; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java index 65031d7a0..12f9793dc 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java @@ -30,10 +30,10 @@ package com.jogamp.opengl.test.junit.graph.demos.ui; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.RenderState; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java index 796ed2513..2e3d2fac3 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java @@ -32,14 +32,14 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLPipelineFactory; -import javax.media.opengl.GLRunnable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.GLRunnable; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RegionRenderer; @@ -109,10 +109,10 @@ public abstract class UIListenerBase01 implements GLEventListener { autoDrawable = drawable; GL2ES2 gl = drawable.getGL().getGL2ES2(); if(debug) { - gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ).getGL2ES2(); + gl = gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, gl, null) ).getGL2ES2(); } if(trace) { - gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ).getGL2ES2(); + gl = gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, gl, new Object[] { System.err } ) ).getGL2ES2(); } gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); getRegionRenderer().init(gl, renderModes); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java index cd74f194c..88dc1615f 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java @@ -28,8 +28,8 @@ package com.jogamp.opengl.test.junit.graph.demos.ui; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.geom.SVertex; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java index 3b8c71ed0..716712d22 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java @@ -29,8 +29,8 @@ package com.jogamp.opengl.test.junit.graph.demos.ui; import java.util.ArrayList; -import javax.media.nativewindow.NativeWindowException; -import javax.media.opengl.GL2ES2; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.Region; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java index 710f53f92..163f5736d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java @@ -30,10 +30,10 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import org.junit.BeforeClass; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java index be0d38357..7b28c6896 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java @@ -32,10 +32,10 @@ import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.util.GLDrawableUtil; import com.jogamp.opengl.util.awt.AWTGLReadBufferUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java index 6bfe73e95..3379129dd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java @@ -28,10 +28,10 @@ package com.jogamp.opengl.test.junit.jogl.acore; -import javax.media.nativewindow.Capabilities; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.Capabilities; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAWTCloseX11DisplayBug565.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAWTCloseX11DisplayBug565.java index 0913cd2a8..478d4440d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAWTCloseX11DisplayBug565.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAWTCloseX11DisplayBug565.java @@ -6,11 +6,11 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import java.awt.Frame; /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java index 87da6991a..d3f1a0fbd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java @@ -36,9 +36,9 @@ import java.awt.Dimension; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java index 7a26c0282..cd60970b7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java @@ -36,9 +36,9 @@ import java.awt.Dimension; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove03GLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove03GLWindowNEWT.java index 70aa4dff3..90b824a3c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove03GLWindowNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove03GLWindowNEWT.java @@ -31,8 +31,8 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.AfterClass; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java index 05f70689c..27524a535 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java @@ -27,11 +27,11 @@ */ package com.jogamp.opengl.test.junit.jogl.acore; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.GLContextImpl; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java index 4a8499be2..3acc07d8d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java @@ -27,10 +27,10 @@ */ package com.jogamp.opengl.test.junit.jogl.acore; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAONEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAONEWT.java index 0a9ff5a28..b23cf448b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAONEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAONEWT.java @@ -33,15 +33,15 @@ import java.nio.ShortBuffer; import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL3;
-import javax.media.opengl.GL3bc;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL3;
+import com.jogamp.opengl.GL3bc;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestCPUSourcingAPINEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestCPUSourcingAPINEWT.java index fe598db35..dc4d3b2f3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestCPUSourcingAPINEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestCPUSourcingAPINEWT.java @@ -36,16 +36,16 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.GLBuffers; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java index 929799ecd..fd012e86f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java @@ -30,11 +30,11 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.awt.EventQueue; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.DefaultGLCapabilitiesChooser; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.jawt.JAWTUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java index 327fecd25..d122a0709 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java @@ -28,15 +28,15 @@ package com.jogamp.opengl.test.junit.jogl.acore; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLFBODrawable; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLFBODrawable; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; @@ -52,7 +52,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; /** * Toolkit agnostic {@link GLOffscreenAutoDrawable.FBO} tests using the - * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. + * {@link GLDrawableFactory#createOffscreenAutoDrawable(com.jogamp.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. * <p> * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}. * </p> diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java index 977ecbf03..c19183225 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java @@ -44,15 +44,15 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import java.io.IOException; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.Test; @@ -77,7 +77,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { new GLCapabilities(GLProfile.getGL2GL3()), width/step, height/step, true); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2GL3 gl = winctx.context.getGL().getGL2GL3(); - // gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ).getGL2GL3(); + // gl = gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, gl, null) ).getGL2GL3(); System.err.println(winctx.context); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java index 5eebf9cdd..f2e8b86af 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java @@ -48,11 +48,11 @@ import com.jogamp.opengl.util.texture.TextureIO; import com.jogamp.opengl.test.junit.jogl.demos.es2.FBOMix2DemosES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.AfterClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java index 13feb2372..26d510a45 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java @@ -49,17 +49,17 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.jogl.demos.es2.Mix2TexturesES2; import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.SurfaceUpdatedListener; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.SurfaceUpdatedListener; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.AfterClass; @@ -69,7 +69,7 @@ import org.junit.runners.MethodSorters; /** * Toolkit agnostic {@link GLOffscreenAutoDrawable.FBO} tests using the - * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. + * {@link GLDrawableFactory#createOffscreenAutoDrawable(com.jogamp.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. * <p> * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}. * </p> diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java index 4ed762a4e..0586eef8e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java @@ -47,17 +47,17 @@ import com.jogamp.opengl.test.junit.jogl.demos.GLFinishOnDisplay; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.jogl.demos.es2.Mix2TexturesES2; -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.SurfaceUpdatedListener; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.nativewindow.SurfaceUpdatedListener; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.AfterClass; @@ -67,7 +67,7 @@ import org.junit.runners.MethodSorters; /** * Toolkit agnostic {@link GLOffscreenAutoDrawable.FBO} tests using the - * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. + * {@link GLDrawableFactory#createOffscreenAutoDrawable(com.jogamp.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. * <p> * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}. * </p> diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java index 85f9d9e2b..ff05b63a1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java @@ -30,13 +30,13 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; @@ -61,7 +61,7 @@ import com.jogamp.opengl.util.AnimatorBase; * Test using a NEWT {@link Window} for onscreen case. * <p> * Creates a {@link GLDrawable} using the - * {@link GLDrawableFactory#createGLDrawable(javax.media.nativewindow.NativeSurface) factory model}. + * {@link GLDrawableFactory#createGLDrawable(com.jogamp.nativewindow.NativeSurface) factory model}. * The {@link GLContext} is derived {@link GLDrawable#createContext(GLContext) from the drawable}. * </p> * <p> diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java index 94bff728e..bf870b257 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java @@ -30,14 +30,14 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.GLGraphicsConfigurationUtil; @@ -62,7 +62,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; * Tests using a NEWT {@link Window} for on- and offscreen cases. * <p> * Each test creates a {@link GLDrawable} using the - * {@link GLDrawableFactory#createGLDrawable(javax.media.nativewindow.NativeSurface) factory model}. + * {@link GLDrawableFactory#createGLDrawable(com.jogamp.nativewindow.NativeSurface) factory model}. * The {@link GLContext} is derived {@link GLDrawable#createContext(GLContext) from the drawable}. * </p> * <p> diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java index 5c90e8021..daa784fbb 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java @@ -30,14 +30,14 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.GLGraphicsConfigurationUtil; @@ -53,7 +53,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; /** * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the - * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. + * {@link GLDrawableFactory#createOffscreenAutoDrawable(com.jogamp.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. * <p> * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}. * </p> diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java index a5a340b36..dad7fb1ed 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java @@ -30,14 +30,14 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.GLGraphicsConfigurationUtil; @@ -53,7 +53,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; /** * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the - * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. + * {@link GLDrawableFactory#createOffscreenAutoDrawable(com.jogamp.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. * <p> * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}. * </p> diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java index 51c7c0772..7e53f9579 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java @@ -30,14 +30,14 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.GLGraphicsConfigurationUtil; @@ -53,7 +53,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; /** * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the - * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. + * {@link GLDrawableFactory#createOffscreenAutoDrawable(com.jogamp.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}. * <p> * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}. * </p> diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java index 8f8bb8f3e..347463eae 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java @@ -32,16 +32,16 @@ import java.awt.Dimension; import java.awt.Frame; import java.io.IOException; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import jogamp.nativewindow.jawt.JAWTUtil; import jogamp.opengl.GLGraphicsConfigurationUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java index 2e29340a1..bb5861fdc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java @@ -30,15 +30,15 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.GLGraphicsConfigurationUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java index b95fa0c8c..57d3fcb3d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java @@ -33,16 +33,16 @@ import java.awt.Dimension; import java.awt.Frame; import java.io.IOException; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.jawt.JAWTUtil; import jogamp.opengl.GLGraphicsConfigurationUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java index b64707350..1e78691c4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java @@ -31,11 +31,11 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java index 50beb8ab9..dcee114e5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java @@ -30,16 +30,16 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDebugListener; -import javax.media.opengl.GLDebugMessage; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDebugListener; +import com.jogamp.opengl.GLDebugMessage; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java index 742804092..66733209c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java @@ -30,15 +30,15 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDebugListener; -import javax.media.opengl.GLDebugMessage; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDebugListener; +import com.jogamp.opengl.GLDebugMessage; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLException01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLException01NEWT.java index cdbe3af94..989960db8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLException01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLException01NEWT.java @@ -38,12 +38,12 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java index b3a0de845..5f3bc63f6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java @@ -32,12 +32,12 @@ import java.util.Collections; import java.util.SortedSet; import java.util.TreeSet; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java index 5ef025460..81d194148 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java @@ -32,14 +32,14 @@ import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.GLExtensions; import com.jogamp.opengl.test.junit.util.UITestCase; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java index a91eae04c..623630d74 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java @@ -1,12 +1,12 @@ package com.jogamp.opengl.test.junit.jogl.acore; -import javax.media.opengl.GL; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLOffscreenAutoDrawableBug1044AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLOffscreenAutoDrawableBug1044AWT.java index 18ac7abc2..bcbd4505e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLOffscreenAutoDrawableBug1044AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLOffscreenAutoDrawableBug1044AWT.java @@ -32,14 +32,14 @@ import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; import org.junit.FixMethodOrder; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLPointsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLPointsNEWT.java index fb6a50f7b..6e21e5e57 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLPointsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLPointsNEWT.java @@ -35,8 +35,8 @@ import com.jogamp.opengl.test.junit.jogl.demos.PointsDemo; import com.jogamp.opengl.test.junit.jogl.demos.es1.PointsDemoES1; import com.jogamp.opengl.test.junit.jogl.demos.es2.PointsDemoES2; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java index 69ddb7771..edb681d01 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java @@ -35,7 +35,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.common.os.Platform; import com.jogamp.opengl.JoglVersion; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java index 3262ff996..6da1ff90b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java @@ -30,14 +30,14 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java index 37f1c7555..0953c9b47 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java @@ -31,12 +31,12 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Frame; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.SwingUtilities; import org.junit.Assume; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java index 599392d0c..95568704d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java @@ -30,12 +30,12 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.awt.BorderLayout; import java.awt.Dimension; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java index 4da73dbca..3add9685d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java @@ -29,13 +29,13 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.File; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assume; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java index aabd4821d..f63340930 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java @@ -35,13 +35,13 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import java.io.IOException; import java.nio.ByteBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent01NEWT.java index a3c5d44cd..90b5a6b0e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent01NEWT.java @@ -30,7 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent02NEWT.java index 5cbf15b57..32ffec999 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent02NEWT.java @@ -30,7 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java index 6395c1446..7d55b9d85 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java @@ -30,7 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java index 5ba0c7794..1a9260219 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java @@ -35,12 +35,12 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLBufferStorage; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLBufferStorage; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java index a0e846d7d..83a5f07a5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java @@ -9,14 +9,14 @@ import org.junit.runners.MethodSorters; import com.jogamp.newt.opengl.GLWindow; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.DefaultGLCapabilitiesChooser; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; /** * Tests the closing the device of GLWindow and off-screen GLAutoDrawable using FBO and PBuffer in JOGL diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java index b0c6bd670..2ac493dbc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java @@ -30,12 +30,12 @@ package com.jogamp.opengl.test.junit.jogl.acore; import com.jogamp.newt.opengl.GLWindow; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.UITestCase; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java index f96886712..b11b16812 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java @@ -36,11 +36,11 @@ import java.awt.Frame; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import jogamp.nativewindow.jawt.JAWTUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java index d48d490b2..65925c6b5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java @@ -36,10 +36,10 @@ import java.awt.Frame; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.jawt.JAWTUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java index e8b21e935..aef64e4e9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java @@ -30,10 +30,10 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.awt.EventQueue; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.jawt.JAWTUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java index c899a310f..7e39b890c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java @@ -28,11 +28,11 @@ package com.jogamp.opengl.test.junit.jogl.acore; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java index 38b3f92ff..37aaa33b4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java @@ -32,11 +32,11 @@ import java.io.IOException; import com.jogamp.newt.opengl.GLWindow; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java index 7f5d50323..e84ae4997 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java @@ -32,9 +32,9 @@ import java.io.IOException; import com.jogamp.newt.opengl.GLWindow; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java index d3cdf5e95..2a83912b9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java @@ -42,19 +42,19 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.fixedfunc.GLPointerFunc; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.glu.GLU; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JFrame; @@ -72,6 +72,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; @@ -476,7 +477,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { final String errStr = "GL-Error: "+prefix + " on obj 0x"+Integer.toHexString(obj.hashCode())+", OpenGL error: 0x" + Integer.toHexString(glError); if( errorSet.add(errStr) ) { System.err.println(errStr); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } final int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); @@ -484,7 +485,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { final String errStr = "GL-Error: "+prefix + " on obj 0x"+Integer.toHexString(obj.hashCode())+", glCheckFramebufferStatus: 0x" + Integer.toHexString(status); if( errorSet.add(errStr) ) { System.err.println(errStr); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java index 855dc9cc6..ba7176ad0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java @@ -30,13 +30,13 @@ package com.jogamp.opengl.test.junit.jogl.acore; import com.jogamp.newt.opengl.GLWindow; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.GLAutoDrawableDelegate; import com.jogamp.opengl.util.Animator; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java index fcbfcb19b..bee121126 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java @@ -32,10 +32,10 @@ import java.awt.Frame; import java.lang.reflect.InvocationTargetException; import java.util.List; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java index bac84d4fb..94238503e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java @@ -32,10 +32,10 @@ import java.awt.Frame; import java.lang.reflect.InvocationTargetException; import java.util.List; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLJPanel; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java index 54f60f576..fcca1884d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java @@ -32,11 +32,11 @@ import java.util.List; import com.jogamp.newt.opengl.GLWindow; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java index 2c547ec06..962d10bf4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java @@ -30,12 +30,12 @@ package com.jogamp.opengl.test.junit.jogl.acore; import com.jogamp.newt.opengl.GLWindow; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java index 8d040222a..83138c44b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java @@ -32,10 +32,10 @@ import java.util.List; import com.jogamp.newt.opengl.GLWindow; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java index a0d111c4d..6fd11c033 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java @@ -32,10 +32,10 @@ import java.util.List; import com.jogamp.newt.opengl.GLWindow; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java index 804badbc3..61d109ba1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java @@ -33,12 +33,12 @@ import java.util.concurrent.atomic.AtomicBoolean; import com.jogamp.newt.opengl.GLWindow; -import javax.media.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.InsetsImmutable; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java index 09f4408f1..84ccfa8b5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java @@ -30,9 +30,9 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.util.List; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLProfile; import com.jogamp.nativewindow.swt.SWTAccessor; import com.jogamp.opengl.util.Animator; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextWithJTabbedPaneAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextWithJTabbedPaneAWT.java index e62bbc63e..b45b94e41 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextWithJTabbedPaneAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextWithJTabbedPaneAWT.java @@ -35,17 +35,17 @@ import java.awt.BorderLayout; import java.lang.reflect.InvocationTargetException; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTabbedPane; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java index d8ae8bcc5..d136f3edf 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java @@ -32,9 +32,9 @@ import java.awt.Frame; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.AfterClass; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java index 10f334244..13c4f077a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.AfterClass; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java index 9ac190bc7..801d3fca6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java @@ -28,10 +28,10 @@ package com.jogamp.opengl.test.junit.jogl.acore; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java index 764973f06..b30bb1192 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java @@ -30,11 +30,11 @@ package com.jogamp.opengl.test.junit.jogl.acore.anim; import java.awt.BorderLayout; import java.awt.Dimension; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.SwingUtilities; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java index 97f8b3f48..722167c33 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java @@ -10,10 +10,10 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java index d39abba41..8e52ea329 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java @@ -31,8 +31,8 @@ package com.jogamp.opengl.test.junit.jogl.acore.anim; import java.awt.Frame; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.awt.GLJPanel; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java index 03892518b..58af4bf2d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java @@ -30,7 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.acore.anim; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilities; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java index 6e10d65da..b2608303a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java @@ -38,13 +38,13 @@ import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import javax.media.nativewindow.Capabilities; -import javax.media.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.Capabilities; +import com.jogamp.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00AWT.java index 414841ab0..69ee6fbe9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00AWT.java @@ -35,9 +35,9 @@ import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Frame; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00NEWT.java index 9fe8bd03f..e983da4a5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00NEWT.java @@ -33,8 +33,8 @@ import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Screen; import com.jogamp.newt.opengl.GLWindow; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java index 02f6efdeb..1908d1ec2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java @@ -38,13 +38,13 @@ import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import javax.media.nativewindow.Capabilities; -import javax.media.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.Capabilities; +import com.jogamp.nativewindow.util.InsetsImmutable; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10AWT.java index 8f4715056..6ff7b6dd9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10AWT.java @@ -35,9 +35,9 @@ import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Frame; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10NEWT.java index 84e6ed7f3..b56b4849a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10NEWT.java @@ -33,8 +33,8 @@ import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Screen; import com.jogamp.newt.opengl.GLWindow; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase0.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase0.java index 08614f9fb..8c4cd91d9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase0.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase0.java @@ -30,11 +30,11 @@ package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.Threading; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.Threading; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.GLDrawableUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase1.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase1.java index 0e7ea3e83..712679982 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase1.java @@ -31,14 +31,14 @@ package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.awt.Dimension; import java.awt.Frame; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import jogamp.nativewindow.jawt.JAWTUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestBug722GLContextDrawableSwitchNewt2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestBug722GLContextDrawableSwitchNewt2AWT.java index e961fe32d..d7158f2ab 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestBug722GLContextDrawableSwitchNewt2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestBug722GLContextDrawableSwitchNewt2AWT.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.newt.Display; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java index 603c858c9..a872d692d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java @@ -38,12 +38,12 @@ import com.jogamp.newt.event.WindowListener; import com.jogamp.newt.event.WindowUpdateEvent; import com.jogamp.newt.opengl.GLWindow; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.GLAutoDrawableDelegate; import com.jogamp.opengl.util.Animator; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java index d9f2d0e18..33886d85f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java @@ -38,10 +38,10 @@ import java.lang.reflect.InvocationTargetException; import com.jogamp.newt.event.TraceWindowAdapter; import com.jogamp.newt.event.awt.AWTWindowAdapter; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.awt.GLCanvas; import jogamp.nativewindow.awt.AWTMisc; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02NEWT.java index c8a78d05f..9d28bb856 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02NEWT.java @@ -33,9 +33,9 @@ import java.lang.reflect.InvocationTargetException; import com.jogamp.newt.opengl.GLWindow; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; import com.jogamp.opengl.test.junit.util.QuitAdapter; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java index 822898e0b..2fe56dbfe 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java @@ -37,12 +37,12 @@ import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.event.WindowListener; import com.jogamp.newt.event.WindowUpdateEvent; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.GLAutoDrawableDelegate; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch11NewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch11NewtAWT.java index f1c08c889..cbdb39774 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch11NewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch11NewtAWT.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.GLEventListenerState; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch12AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch12AWT.java index 795e53768..73822099e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch12AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch12AWT.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.nativewindow.jawt.JAWTUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch13Newt2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch13Newt2AWT.java index 27d5ff80a..a4bcef7ff 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch13Newt2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch13Newt2AWT.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.newt.Display; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT01GLn.java index 1bfe313ff..803cbc244 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT01GLn.java @@ -28,9 +28,9 @@ package com.jogamp.opengl.test.junit.jogl.awt; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.UITestCase; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLCanvasRecreate01.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLCanvasRecreate01.java index b074297e2..7dbfd45da 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLCanvasRecreate01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLCanvasRecreate01.java @@ -28,8 +28,8 @@ package com.jogamp.opengl.test.junit.jogl.awt; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.UITestCase; @@ -40,6 +40,8 @@ import java.awt.Dimension; import java.awt.Frame; import java.awt.Label; +import jogamp.nativewindow.SurfaceScaleUtils; + import org.junit.Assert; import org.junit.Assume; import org.junit.Before; @@ -178,8 +180,8 @@ public class TestAWT03GLCanvasRecreate01 extends UITestCase { } private void assertSize(final Dimension expSize) { - final int[] scale = { 1, 1 }; - glComp.getNativeSurfaceScale(scale); + final float[] scale = { 1f, 1f }; + glComp.getMaximumSurfaceScale(scale); final Dimension hasSize = glComp.getSize(null); @@ -188,8 +190,8 @@ public class TestAWT03GLCanvasRecreate01 extends UITestCase { Assert.assertTrue("AWT Size.height mismatch: expected "+expSize+", has "+hasSize, Math.abs(expSize.height-hasSize.height) <= sizeEps); - final int expSurfWidth = expSize.width * scale[0]; - final int expSurfHeight = expSize.height * scale[0]; + final int expSurfWidth = SurfaceScaleUtils.scale(expSize.width, scale[0]); + final int expSurfHeight = SurfaceScaleUtils.scale(expSize.height, scale[0]); final int hasSurfWidth = glComp.getSurfaceWidth(); final int hasSurfHeight = glComp.getSurfaceHeight(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLJPanelRecreate01.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLJPanelRecreate01.java index b2d487784..78fd55ba6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLJPanelRecreate01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLJPanelRecreate01.java @@ -28,8 +28,8 @@ package com.jogamp.opengl.test.junit.jogl.awt; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.JFrame; import javax.swing.JLabel; @@ -41,6 +41,8 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import java.awt.BorderLayout; import java.awt.Dimension; +import jogamp.nativewindow.SurfaceScaleUtils; + import org.junit.Assert; import org.junit.Assume; import org.junit.Before; @@ -179,8 +181,8 @@ public class TestAWT03GLJPanelRecreate01 extends UITestCase { } private void assertSize(final Dimension expSize) { - final int[] scale = { 1, 1 }; - glComp.getNativeSurfaceScale(scale); + final float[] scale = { 1f, 1f }; + glComp.getMaximumSurfaceScale(scale); final Dimension hasSize = glComp.getSize(null); @@ -189,8 +191,8 @@ public class TestAWT03GLJPanelRecreate01 extends UITestCase { Assert.assertTrue("AWT Size.height mismatch: expected "+expSize+", has "+hasSize, Math.abs(expSize.height-hasSize.height) <= sizeEps); - final int expSurfWidth = expSize.width * scale[0]; - final int expSurfHeight = expSize.height * scale[0]; + final int expSurfWidth = SurfaceScaleUtils.scale(expSize.width, scale[0]); + final int expSurfHeight = SurfaceScaleUtils.scale(expSize.height, scale[0]); final int hasSurfWidth = glComp.getSurfaceWidth(); final int hasSurfHeight = glComp.getSurfaceHeight(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug460GLCanvasNPEAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug460GLCanvasNPEAWT.java index 8fbe680df..c17da1e76 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug460GLCanvasNPEAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug460GLCanvasNPEAWT.java @@ -28,10 +28,10 @@ package com.jogamp.opengl.test.junit.jogl.awt; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461FBOSupersamplingSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461FBOSupersamplingSwingAWT.java index c85c7467f..d56b4a8c3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461FBOSupersamplingSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461FBOSupersamplingSwingAWT.java @@ -35,14 +35,14 @@ import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461PBufferSupersamplingSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461PBufferSupersamplingSwingAWT.java index 85bf2ceb3..fcbc41a3a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461PBufferSupersamplingSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461PBufferSupersamplingSwingAWT.java @@ -33,14 +33,14 @@ import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLProfile; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java index 8b9934310..1cb6d5bb4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java @@ -29,9 +29,9 @@ package com.jogamp.opengl.test.junit.jogl.awt; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.UITestCase; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java index 5fb4433c9..1250ab6f2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java @@ -32,9 +32,9 @@ import java.awt.Dimension; import java.awt.Window; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.SwingUtilities; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug611AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug611AWT.java index e64df6687..798a3d7d8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug611AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug611AWT.java @@ -4,7 +4,7 @@ package com.jogamp.opengl.test.junit.jogl.awt; import java.awt.Desktop; import java.io.File; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug642JSplitPaneMixHwLw01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug642JSplitPaneMixHwLw01AWT.java index fffffcb96..07acb6f03 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug642JSplitPaneMixHwLw01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug642JSplitPaneMixHwLw01AWT.java @@ -10,12 +10,12 @@ import java.awt.Rectangle; import java.awt.Shape; import java.io.IOException; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java index 36c1e11b2..2b6d8233f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java @@ -36,11 +36,11 @@ import java.awt.Dimension; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug675BeansInDesignTimeAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug675BeansInDesignTimeAWT.java index 12ebe88d3..3e9bfe374 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug675BeansInDesignTimeAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug675BeansInDesignTimeAWT.java @@ -34,9 +34,9 @@ import java.awt.Window; import java.beans.Beans; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.SwingUtilities; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java index f169a27a9..7758a525e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java @@ -32,9 +32,9 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java index efb7119e4..1aeaccb81 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java @@ -30,9 +30,9 @@ package com.jogamp.opengl.test.junit.jogl.awt; import java.awt.BorderLayout; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java index 83cde8f2a..c33b2e5ba 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java @@ -28,11 +28,11 @@ package com.jogamp.opengl.test.junit.jogl.awt; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.BoundedRangeModel; import javax.swing.BoxLayout; import javax.swing.JFrame; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java index fa9ea7198..5e20bb3f7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java @@ -28,11 +28,11 @@ package com.jogamp.opengl.test.junit.jogl.awt; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.JRootPane; import javax.swing.JScrollPane; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java index 74d18ce9b..ac3903ec6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java @@ -35,9 +35,9 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Assert; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java index 9a9a7fce7..62526420f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java @@ -37,9 +37,9 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Assert; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java index afdf6fbcb..3d46b5315 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java @@ -35,9 +35,9 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JPanel; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java index 78fcbfed3..74046e8a1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java @@ -33,9 +33,9 @@ import java.awt.Dialog; import java.awt.Frame; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Assert; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java index 8f1917e3a..704b589f3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java @@ -31,9 +31,9 @@ package com.jogamp.opengl.test.junit.jogl.awt; import java.awt.BorderLayout; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JDialog; import javax.swing.JFrame; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock00AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock00AWT.java index edb489a4a..0a838516d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock00AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock00AWT.java @@ -28,9 +28,9 @@ package com.jogamp.opengl.test.junit.jogl.awt; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.util.FPSAnimator; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock01AWT.java index 5b605ff33..e865755be 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock01AWT.java @@ -28,11 +28,11 @@ package com.jogamp.opengl.test.junit.jogl.awt; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionNumber; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java index 596ada665..58a7a72c1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java @@ -47,8 +47,8 @@ import java.lang.reflect.InvocationTargetException; import java.util.Timer; import java.util.TimerTask; -import javax.media.opengl.*; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.*; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Assume; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java index cc2c9ef57..00960d4dd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java @@ -30,10 +30,10 @@ package com.jogamp.opengl.test.junit.jogl.awt; import java.awt.Dimension; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java index 8cf4b6899..46ae20765 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java @@ -37,13 +37,13 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.test.junit.util.UITestCase; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.JFrame; import com.jogamp.opengl.util.texture.TextureIO; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestIsRealizedConcurrency01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestIsRealizedConcurrency01AWT.java index d75ff6659..ad2aec4cf 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestIsRealizedConcurrency01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestIsRealizedConcurrency01AWT.java @@ -28,7 +28,7 @@ package com.jogamp.opengl.test.junit.jogl.awt; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.UITestCase; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestJScrollPaneMixHwLw01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestJScrollPaneMixHwLw01AWT.java index ec9cece53..644e65abd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestJScrollPaneMixHwLw01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestJScrollPaneMixHwLw01AWT.java @@ -9,9 +9,9 @@ import java.awt.ScrollPane; import java.awt.Shape; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestSwingAWT01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestSwingAWT01GLn.java index d24101270..4f83a1a34 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestSwingAWT01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestSwingAWT01GLn.java @@ -29,9 +29,9 @@ package com.jogamp.opengl.test.junit.jogl.awt; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.UITestCase; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java index 4b1da1e2e..ff5eb6484 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java @@ -28,9 +28,9 @@ package com.jogamp.opengl.test.junit.jogl.awt.text; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.UITestCase; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java index 44089ff67..93bd32add 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java @@ -34,12 +34,12 @@ import java.io.PrintStream; import com.jogamp.opengl.util.awt.TextRenderer; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.glu.GLU; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java index 3adcf9823..8f6d979ab 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java @@ -33,8 +33,8 @@ import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; -import javax.media.opengl.GL2; -import javax.media.opengl.TraceGL2; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.TraceGL2; import com.jogamp.common.nio.Buffers; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java index 02265ad0b..a3f174b70 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java @@ -41,9 +41,9 @@ package com.jogamp.opengl.test.junit.jogl.caps; import java.util.List; -import javax.media.nativewindow.CapabilitiesImmutable; -import javax.media.opengl.DefaultGLCapabilitiesChooser; -import javax.media.opengl.GLCapabilitiesImmutable; +import com.jogamp.nativewindow.CapabilitiesImmutable; +import com.jogamp.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.opengl.GLCapabilitiesImmutable; class MultisampleChooser01 extends DefaultGLCapabilitiesChooser { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java index c1b29b371..0bc222b73 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java @@ -29,16 +29,16 @@ package com.jogamp.opengl.test.junit.jogl.caps; import java.io.File; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.util.awt.AWTGLReadBufferUtil; import com.jogamp.opengl.util.texture.TextureIO; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java index 2d879a6be..3e68d5a55 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java @@ -29,15 +29,15 @@ package com.jogamp.opengl.test.junit.jogl.caps; import java.nio.ByteBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java index 7ae9e859a..f8e4a0c4f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java @@ -44,12 +44,12 @@ import java.lang.reflect.InvocationTargetException; import java.awt.BorderLayout; import java.awt.Frame; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.test.junit.jogl.demos.es1.MultisampleDemoES1; import com.jogamp.opengl.test.junit.util.MiscUtils; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java index 4996f786d..e6bf44c65 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java @@ -40,11 +40,11 @@ package com.jogamp.opengl.test.junit.jogl.caps; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES2NEWT.java index 148e107e3..c24c77664 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES2NEWT.java @@ -40,11 +40,11 @@ package com.jogamp.opengl.test.junit.jogl.caps; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesChooser; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java index 521d9c2fe..77e4723d2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java @@ -42,10 +42,10 @@ import java.awt.image.ColorModel; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java index 10ac9417a..f3c2734b5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java @@ -37,8 +37,8 @@ import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/GLFinishOnDisplay.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GLFinishOnDisplay.java index b59cddc71..d5583ba8e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/GLFinishOnDisplay.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GLFinishOnDisplay.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.junit.jogl.demos; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; public class GLFinishOnDisplay implements GLEventListener { @Override diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java index 01cc4b7f2..0f0cb6f91 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java @@ -22,7 +22,7 @@ package com.jogamp.opengl.test.junit.jogl.demos; import java.nio.FloatBuffer; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.GLArrayDataServer; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/PointsDemo.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/PointsDemo.java index f394ab31e..1a03cf8b2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/PointsDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/PointsDemo.java @@ -27,7 +27,7 @@ */ package com.jogamp.opengl.test.junit.jogl.demos; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLEventListener; public abstract class PointsDemo implements GLEventListener { int swapInterval = 0; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java index 9d20495a0..34b4c3430 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java @@ -23,16 +23,16 @@ package com.jogamp.opengl.test.junit.jogl.demos.es1; import java.nio.FloatBuffer; -import javax.media.nativewindow.NativeWindow; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLPipelineFactory; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.newt.Window; import com.jogamp.newt.event.KeyAdapter; @@ -139,12 +139,12 @@ public class GearsES1 implements GLEventListener { if(debugFFPEmu) { // Debug .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, _gl, null) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES2.class, _gl, null) ); debug = false; } if(traceFFPEmu) { // Trace .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); trace = false; } GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); @@ -152,13 +152,13 @@ public class GearsES1 implements GLEventListener { if(debug) { try { // Debug .. - gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) ); + gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES1.class, gl, null) ); } catch (final Exception e) {e.printStackTrace();} } if(trace) { try { // Trace .. - gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); + gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); } catch (final Exception e) {e.printStackTrace();} } @@ -290,9 +290,9 @@ public class GearsES1 implements GLEventListener { // Special handling for the case where the GLJPanel is translucent // and wants to be composited with other Java 2D content if (GLProfile.isAWTAvailable() && - (drawable instanceof javax.media.opengl.awt.GLJPanel) && - !((javax.media.opengl.awt.GLJPanel) drawable).isOpaque() && - ((javax.media.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) { + (drawable instanceof com.jogamp.opengl.awt.GLJPanel) && + !((com.jogamp.opengl.awt.GLJPanel) drawable).isOpaque() && + ((com.jogamp.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) { gl.glClear(GL.GL_DEPTH_BUFFER_BIT); } else { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java index 1355a44c8..d6ea7cfe5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java @@ -22,12 +22,12 @@ package com.jogamp.opengl.test.junit.jogl.demos.es1; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLBufferStorage; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GLBufferStorage; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; import com.jogamp.opengl.test.junit.jogl.demos.GearsObject; import com.jogamp.opengl.util.GLArrayDataServer; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/MultisampleDemoES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/MultisampleDemoES1.java index 681628a69..6e836fc20 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/MultisampleDemoES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/MultisampleDemoES1.java @@ -40,11 +40,11 @@ package com.jogamp.opengl.test.junit.jogl.demos.es1; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.util.ImmModeSink; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java index 9f5940b53..8d411f698 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java @@ -4,16 +4,16 @@ package com.jogamp.opengl.test.junit.jogl.demos.es1; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLPipelineFactory; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.glu.GLU; -import javax.media.opengl.glu.gl2es1.GLUgl2es1; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.glu.GLU; +import com.jogamp.opengl.glu.gl2es1.GLUgl2es1; import com.jogamp.opengl.util.ImmModeSink; import com.jogamp.opengl.util.glsl.fixedfunc.FixedFuncUtil; @@ -97,12 +97,12 @@ public class OlympicES1 implements GLEventListener if(debugFFPEmu) { // Debug .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, _gl, null) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES2.class, _gl, null) ); debug = false; } if(traceFFPEmu) { // Trace .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); trace = false; } GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); @@ -110,13 +110,13 @@ public class OlympicES1 implements GLEventListener if(debug) { try { // Debug .. - gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) ); + gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES1.class, gl, null) ); } catch (final Exception e) {e.printStackTrace();} } if(trace) { try { // Trace .. - gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); + gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); } catch (final Exception e) {e.printStackTrace();} } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OneTriangle.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OneTriangle.java index aaa7da3fe..36baab050 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OneTriangle.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OneTriangle.java @@ -28,11 +28,11 @@ package com.jogamp.opengl.test.junit.jogl.demos.es1; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.glu.GLU; -import javax.media.opengl.glu.gl2es1.GLUgl2es1; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.glu.GLU; +import com.jogamp.opengl.glu.gl2es1.GLUgl2es1; import com.jogamp.opengl.util.ImmModeSink; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java index 3aced12ed..7189db1f3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java @@ -36,15 +36,15 @@ import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.fixedfunc.FixedFuncUtil; import com.jogamp.opengl.util.glsl.fixedfunc.ShaderSelectionMode; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLPipelineFactory; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.fixedfunc.GLPointerFunc; -import javax.media.opengl.glu.GLU; -import javax.media.opengl.glu.gl2es1.GLUgl2es1; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.glu.GLU; +import com.jogamp.opengl.glu.gl2es1.GLUgl2es1; public class PointsDemoES1 extends PointsDemo { final static GLU glu = new GLUgl2es1(); @@ -82,12 +82,12 @@ public class PointsDemoES1 extends PointsDemo { if(debugFFPEmu) { // Debug .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, _gl, null) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES2.class, _gl, null) ); debug = false; } if(traceFFPEmu) { // Trace .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); trace = false; } GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); @@ -95,13 +95,13 @@ public class PointsDemoES1 extends PointsDemo { if(debug) { try { // Debug .. - gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) ); + gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES1.class, gl, null) ); } catch (final Exception e) {e.printStackTrace();} } if(trace) { try { // Trace .. - gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); + gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); } catch (final Exception e) {e.printStackTrace();} } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java index 1f81261b8..60ac6b233 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java @@ -4,9 +4,9 @@ import com.jogamp.common.nio.Buffers; import java.nio.*; -import javax.media.opengl.*; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.*; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.util.TileRendererBase; @@ -86,12 +86,12 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende if(debugFFPEmu) { // Debug .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, _gl, null) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES2.class, _gl, null) ); debug = false; } if(traceFFPEmu) { // Trace .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); trace = false; } GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); @@ -99,13 +99,13 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende if(debug) { try { // Debug .. - gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) ); + gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES1.class, gl, null) ); } catch (final Exception e) {e.printStackTrace();} } if(trace) { try { // Trace .. - gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); + gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); } catch (final Exception e) {e.printStackTrace();} } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java index a093cc07f..771748a33 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java @@ -39,8 +39,8 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java index a29e9a3a6..a49c22f64 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java @@ -36,8 +36,8 @@ import com.jogamp.opengl.test.junit.jogl.demos.es1.OlympicES1; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.AnimatorBase; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java index c164990a4..9bf04a75f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java @@ -38,8 +38,8 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.es1.RedSquareES1; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java index c54dad458..1956e6fb7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java @@ -28,19 +28,19 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2; -import static javax.media.opengl.GL.*; +import static com.jogamp.opengl.GL.*; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.common.nio.Buffers; import com.jogamp.newt.event.KeyAdapter; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java index 42f4c5f6e..ff88af50a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java @@ -29,12 +29,12 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.FBObject; import com.jogamp.opengl.FBObject.TextureAttachment; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java index a548d4ccf..e95c2a9da 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java @@ -48,14 +48,14 @@ import com.jogamp.opengl.util.stereo.StereoGLEventListener; import java.nio.FloatBuffer; -import javax.media.nativewindow.NativeWindow; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; /** * GearsES2.java <BR> @@ -530,9 +530,9 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen // Special handling for the case where the GLJPanel is translucent // and wants to be composited with other Java 2D content if (GLProfile.isAWTAvailable() && - (drawable instanceof javax.media.opengl.awt.GLJPanel) && - !((javax.media.opengl.awt.GLJPanel) drawable).isOpaque() && - ((javax.media.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) { + (drawable instanceof com.jogamp.opengl.awt.GLJPanel) && + !((com.jogamp.opengl.awt.GLJPanel) drawable).isOpaque() && + ((com.jogamp.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) { gl.glClear(GL.GL_DEPTH_BUFFER_BIT); } else { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java index 7088eb757..4fddd6f0e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java @@ -22,11 +22,11 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLBufferStorage; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLBufferStorage; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; import com.jogamp.opengl.test.junit.jogl.demos.GearsObject; import com.jogamp.opengl.util.GLArrayDataServer; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java index 72524aa67..a504ec1ed 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java @@ -33,11 +33,11 @@ import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.glsl.ShaderState; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLUniformData; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLUniformData; /** * LandscapeES2 diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java index 58161f50a..6d202707e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java @@ -29,12 +29,12 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.util.GLArrayDataServer; import com.jogamp.opengl.util.PMVMatrix; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java index 8e4dbfefe..3808a4f84 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java @@ -40,12 +40,12 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.util.ImmModeSink; import com.jogamp.opengl.util.PMVMatrix; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java index 8a99a4d55..673552c5f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java @@ -37,13 +37,13 @@ import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.glsl.ShaderState; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; public class PointsDemoES2 extends PointsDemo { ShaderState st; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java index 8058d1b7d..a0afef87a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java @@ -35,12 +35,12 @@ import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.glsl.ShaderState; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRendererListener { private ShaderState st; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java index 35449b3bf..9dab97d16 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java @@ -37,13 +37,13 @@ import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.glsl.ShaderState; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLBufferStorage; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLBufferStorage; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.TileRendererListener { private ShaderState st; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java index c87c04f7e..e29981bb5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java @@ -40,13 +40,13 @@ import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01Accessor { TextureData textureData; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java index 27395ea45..2d6745594 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java @@ -29,12 +29,12 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.FBObject; import com.jogamp.opengl.FBObject.TextureAttachment; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java index 99b943c65..eb9412366 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java @@ -29,15 +29,15 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLES2; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLES2; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.common.os.Platform; import com.jogamp.newt.Window; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java index 428eea42c..b938adb53 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java @@ -32,14 +32,14 @@ import java.io.File; import java.io.IOException; import java.net.URISyntaxException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import com.jogamp.common.net.Uri; import com.jogamp.graph.curve.Region; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java index 7a3a1ffc7..57aa76c82 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java @@ -31,14 +31,14 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.av; import java.net.URISyntaxException; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLES2; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLES2; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.common.net.Uri; import com.jogamp.common.os.Platform; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java index d963294b4..22dfa923e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java @@ -33,17 +33,17 @@ import java.io.IOException; import java.net.URISyntaxException; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLES2; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLES2; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.common.net.Uri; import com.jogamp.common.os.Platform; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas01.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas01.java index 9866e769c..e545dc4e2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas01.java @@ -32,13 +32,13 @@ import java.awt.Color; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.JPanel; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02a.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02a.java index 6218edd50..39ac3216f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02a.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02a.java @@ -29,8 +29,8 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.awt; import java.applet.Applet; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.BoxLayout; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02b.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02b.java index 62eb8ea18..fa8aed3e6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02b.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02b.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.awt; import java.applet.Applet; import java.awt.GridLayout; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.util.Animator; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03a.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03a.java index 32122937e..e9b36d6ad 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03a.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03a.java @@ -30,10 +30,10 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.awt; import java.applet.Applet; import java.awt.BorderLayout; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JRootPane; import javax.swing.JScrollPane; import javax.swing.JSplitPane; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03b.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03b.java index 491bc5fbc..691219951 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03b.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03b.java @@ -27,10 +27,10 @@ */ package com.jogamp.opengl.test.junit.jogl.demos.es2.awt; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.JApplet; import javax.swing.JRootPane; import javax.swing.JScrollPane; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java index e85e84cf3..941271ea2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java @@ -31,8 +31,8 @@ import java.applet.Applet; import java.util.ArrayList; import java.util.List; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.BoxLayout; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java index d8c4341a8..2e805d8fd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java @@ -28,12 +28,12 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.awt; -import javax.media.nativewindow.ScalableSurface; -import javax.media.opengl.*; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.common.os.Platform; import com.jogamp.newt.event.awt.AWTKeyAdapter; @@ -55,8 +55,6 @@ import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Frame; import java.awt.TextArea; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -80,7 +78,7 @@ public class TestGearsES2AWT extends UITestCase { static int xpos = 10, ypos = 10; static FrameLayout frameLayout = FrameLayout.None; static ResizeBy resizeBy = ResizeBy.Component; - static int[] reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + static float[] reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; static boolean forceES2 = false; static boolean forceGL3 = false; @@ -171,7 +169,7 @@ public class TestGearsES2AWT extends UITestCase { Assert.assertNotNull(glCanvas); setSize(resizeBy, frame, false, glCanvas, new Dimension(width, height)); glCanvas.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = glCanvas.getRequestedSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = glCanvas.getRequestedSurfaceScale(new float[2]); frame.setLocation(xpos, ypos); switch( frameLayout) { @@ -215,29 +213,23 @@ public class TestGearsES2AWT extends UITestCase { } setTitle(frame, glCanvas, caps); - frame.addComponentListener(new ComponentListener() { - @Override - public void componentResized(final ComponentEvent e) { - setTitle(frame, glCanvas, caps); - } - - @Override - public void componentMoved(final ComponentEvent e) { - setTitle(frame, glCanvas, caps); - } - - @Override - public void componentShown(final ComponentEvent e) { } - - @Override - public void componentHidden(final ComponentEvent e) { } - }); - final GearsES2 demo = new GearsES2(swapInterval); glCanvas.addGLEventListener(demo); final SnapshotGLEventListener snap = new SnapshotGLEventListener(); glCanvas.addGLEventListener(snap); + glCanvas.addGLEventListener(new GLEventListener() { + @Override + public void init(final GLAutoDrawable drawable) { } + @Override + public void dispose(final GLAutoDrawable drawable) { } + @Override + public void display(final GLAutoDrawable drawable) { } + @Override + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + setTitle(frame, glCanvas, caps); + } + }); final Animator animator = useAnimator ? new Animator(glCanvas) : null; if( useAnimator && exclusiveContext ) { @@ -254,24 +246,22 @@ public class TestGearsES2AWT extends UITestCase { return; } if(e.getKeyChar()=='x') { - final int[] hadSurfacePixelScale = glCanvas.getCurrentSurfaceScale(new int[2]); - final int[] reqSurfacePixelScale; + final float[] hadSurfacePixelScale = glCanvas.getCurrentSurfaceScale(new float[2]); + final float[] reqSurfacePixelScale; if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) { - reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; } else { - reqSurfacePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + reqSurfacePixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; } System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]); glCanvas.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = glCanvas.getRequestedSurfaceScale(new int[2]); - final int[] hasSurfacePixelScale0 = glCanvas.getNativeSurface().convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glCanvas.getCurrentSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = glCanvas.getRequestedSurfaceScale(new float[2]); + final float[] hasSurfacePixelScale1 = glCanvas.getCurrentSurfaceScale(new float[2]); System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); setTitle(frame, glCanvas, caps); - Assert.assertArrayEquals(hasSurfacePixelScale0, hasSurfacePixelScale1); } } }; new AWTKeyAdapter(kl, glCanvas).addTo(glCanvas); @@ -288,13 +278,11 @@ public class TestGearsES2AWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true)); - final int[] hasSurfacePixelScale0 = glCanvas.getNativeSurface().convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glCanvas.getCurrentSurfaceScale(new int[2]); + final float[] hasSurfacePixelScale1 = glCanvas.getCurrentSurfaceScale(new float[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); setTitle(frame, glCanvas, caps); - Assert.assertArrayEquals(hasSurfacePixelScale0, hasSurfacePixelScale1); if( useAnimator ) { animator.start(); @@ -446,7 +434,7 @@ public class TestGearsES2AWT extends UITestCase { rh = MiscUtils.atoi(args[i], rh); } else if(args[i].equals("-pixelScale")) { i++; - final int pS = MiscUtils.atoi(args[i], reqSurfacePixelScale[0]); + final float pS = MiscUtils.atof(args[i], reqSurfacePixelScale[0]); reqSurfacePixelScale[0] = pS; reqSurfacePixelScale[1] = pS; } else if(args[i].equals("-layout")) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java index ae11c9d54..4b17f3011 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java @@ -31,17 +31,19 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.awt; import java.awt.AWTException; import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; +import java.awt.DisplayMode; +import java.awt.GraphicsDevice; import java.lang.reflect.InvocationTargetException; -import javax.media.nativewindow.ScalableSurface; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.JFrame; import javax.swing.SwingUtilities; @@ -53,7 +55,13 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; +import com.jogamp.newt.Display; +import com.jogamp.newt.MonitorDevice; +import com.jogamp.newt.NewtFactory; +import com.jogamp.newt.Screen; import com.jogamp.newt.event.KeyEvent; +import com.jogamp.newt.event.MonitorEvent; +import com.jogamp.newt.event.MonitorModeListener; import com.jogamp.newt.event.TraceKeyAdapter; import com.jogamp.newt.event.TraceWindowAdapter; import com.jogamp.newt.event.awt.AWTKeyAdapter; @@ -70,17 +78,19 @@ import com.jogamp.opengl.util.FPSAnimator; public class TestGearsES2GLJPanelAWT extends UITestCase { static Dimension wsize, rwsize=null; static boolean forceES2 = false; + static boolean forceES3 = false; static boolean forceGL3 = false; static boolean forceGLFFP = false; static boolean shallUsePBuffer = false; static boolean shallUseBitmap = false; static boolean useMSAA = false; + static int msaaNumSamples = 4; static int swapInterval = 0; static boolean useAnimator = true; static boolean manualTest = false; static boolean skipGLOrientationVerticalFlip = false; static int xpos = 10, ypos = 10; - static int[] reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + static float[] reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; @BeforeClass public static void initClass() { @@ -117,6 +127,8 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { protected void runTestGL(final GLCapabilities caps) throws AWTException, InterruptedException, InvocationTargetException { + System.err.println("Requesting: "+caps); + final JFrame frame = new JFrame("Swing GLJPanel"); Assert.assertNotNull(frame); @@ -127,7 +139,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { glJPanel.setPreferredSize(wsize); glJPanel.setSize(wsize); glJPanel.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = glJPanel.getRequestedSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = glJPanel.getRequestedSurfaceScale(new float[2]); if( caps.isBitmap() || caps.getGLProfile().isGL2() ) { final Gears gears = new Gears(swapInterval); gears.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip); @@ -150,29 +162,10 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { setTitle(frame, glJPanel, caps); } - }); setTitle(frame, glJPanel, caps); frame.setLocation(xpos, ypos); - frame.addComponentListener(new ComponentListener() { - @Override - public void componentResized(final ComponentEvent e) { - setTitle(frame, glJPanel, caps); - } - - @Override - public void componentMoved(final ComponentEvent e) { - setTitle(frame, glJPanel, caps); - } - - @Override - public void componentShown(final ComponentEvent e) { } - - @Override - public void componentHidden(final ComponentEvent e) { } - }); - final FPSAnimator animator = useAnimator ? new FPSAnimator(glJPanel, 60) : null; SwingUtilities.invokeAndWait(new Runnable() { @@ -185,13 +178,11 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel, true)); - final int[] hasSurfacePixelScale0 = glJPanel.getNativeSurface().convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glJPanel.getCurrentSurfaceScale(new int[2]); + final float[] hasSurfacePixelScale1 = glJPanel.getCurrentSurfaceScale(new float[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); setTitle(frame, glJPanel, caps); - Assert.assertArrayEquals(hasSurfacePixelScale0, hasSurfacePixelScale1); if( useAnimator ) { animator.setUpdateFPSFrames(60, System.err); @@ -209,25 +200,54 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { if( e.isAutoRepeat() ) { return; } - if(e.getKeyChar()=='x') { - final int[] hadSurfacePixelScale = glJPanel.getCurrentSurfaceScale(new int[2]); - final int[] reqSurfacePixelScale; + if(e.getKeyChar()=='p') { + System.err.println(); + final java.awt.Point los = glJPanel.getLocationOnScreen(); + final RectangleImmutable r = new Rectangle(los.x, los.y, glJPanel.getWidth(), glJPanel.getHeight()); + final GraphicsDevice gd = glJPanel.getGraphicsConfiguration().getDevice(); + final DisplayMode dm = gd.getDisplayMode(); + System.err.printf("GetPixelScale: AWT DisplayMode %d x %d pixel-units%n", dm.getWidth(), dm.getHeight()); + System.err.printf("GetPixelScale: NW Screen: %s%n", glJPanel.getNativeSurface().getGraphicsConfiguration().getScreen()); + System.err.printf("GetPixelScale: Panel Bounds: %s window-units%n", r.toString()); + System.err.printf("GetPixelScale: Panel Resolution: %d x %d pixel-units%n", glJPanel.getSurfaceWidth(), glJPanel.getSurfaceHeight()); + { + final Display dpy = NewtFactory.createDisplay(null); + final Screen screen = NewtFactory.createScreen(dpy, 0); + screen.addReference(); + final MonitorModeListener sml = new MonitorModeListener() { + @Override + public void monitorModeChangeNotify(final MonitorEvent me) { + } + @Override + public void monitorModeChanged(final MonitorEvent me, final boolean success) { + } + }; + screen.addMonitorModeListener(sml); + try { + final MonitorDevice md = screen.getMainMonitor(r); + System.err.printf("GetPixelScale: %s%n", md.toString()); + } finally { + screen.removeReference(); + } + } + System.err.println(); + } else if(e.getKeyChar()=='x') { + final float[] hadSurfacePixelScale = glJPanel.getCurrentSurfaceScale(new float[2]); + final float[] reqSurfacePixelScale; if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) { - reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; } else { - reqSurfacePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + reqSurfacePixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; } System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]); glJPanel.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = glJPanel.getRequestedSurfaceScale(new int[2]); - final int[] hasSurfacePixelScale0 = glJPanel.getNativeSurface().convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glJPanel.getCurrentSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = glJPanel.getRequestedSurfaceScale(new float[2]); + final float[] hasSurfacePixelScale1 = glJPanel.getCurrentSurfaceScale(new float[2]); System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); setTitle(frame, glJPanel, caps); - Assert.assertArrayEquals(hasSurfacePixelScale0, hasSurfacePixelScale1); } else if(e.getKeyChar()=='m') { final GLCapabilitiesImmutable capsPre = glJPanel.getChosenGLCapabilities(); final GLCapabilities capsNew = new GLCapabilities(capsPre.getGLProfile()); @@ -302,16 +322,18 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { final GLProfile glp; if(forceGL3) { glp = GLProfile.get(GLProfile.GL3); + } else if(forceES3) { + glp = GLProfile.get(GLProfile.GLES3); } else if(forceES2) { glp = GLProfile.get(GLProfile.GLES2); } else if(forceGLFFP) { glp = GLProfile.getMaxFixedFunc(true); } else { - glp = GLProfile.getGL2ES2(); + glp = GLProfile.getDefault(); } final GLCapabilities caps = new GLCapabilities( glp ); if(useMSAA) { - caps.setNumSamples(4); + caps.setNumSamples(msaaNumSamples); caps.setSampleBuffers(true); } if(shallUsePBuffer) { @@ -406,7 +428,24 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { } @Test - public void test30_GL3() + public void test30_GLES3() + throws AWTException, InterruptedException, InvocationTargetException + { + if( manualTest ) { + return; + } + + if( !GLProfile.isAvailable(GLProfile.GLES3) ) { + System.err.println("GLES3 n/a"); + return; + } + final GLProfile glp = GLProfile.get(GLProfile.GLES3); + final GLCapabilities caps = new GLCapabilities( glp ); + runTestGL(caps); + } + + @Test + public void test40_GL3() throws AWTException, InterruptedException, InvocationTargetException { if( manualTest ) { @@ -447,6 +486,8 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { duration = MiscUtils.atol(args[i], duration); } else if(args[i].equals("-es2")) { forceES2 = true; + } else if(args[i].equals("-es3")) { + forceES3 = true; } else if(args[i].equals("-gl3")) { forceGL3 = true; } else if(args[i].equals("-glFFP")) { @@ -471,7 +512,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { rh = MiscUtils.atoi(args[i], rh); } else if(args[i].equals("-pixelScale")) { i++; - final int pS = MiscUtils.atoi(args[i], reqSurfacePixelScale[0]); + final float pS = MiscUtils.atof(args[i], reqSurfacePixelScale[0]); reqSurfacePixelScale[0] = pS; reqSurfacePixelScale[1] = pS; } else if(args[i].equals("-userVFlip")) { @@ -480,7 +521,9 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { i++; swapInterval = MiscUtils.atoi(args[i], swapInterval); } else if(args[i].equals("-msaa")) { + i++; useMSAA = true; + msaaNumSamples = MiscUtils.atoi(args[i], msaaNumSamples); } else if(args[i].equals("-noanim")) { useAnimator = false; } else if(args[i].equals("-pbuffer")) { @@ -503,7 +546,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { System.err.println("forceES2 "+forceES2); System.err.println("forceGL3 "+forceGL3); System.err.println("forceGLFFP "+forceGLFFP); - System.err.println("useMSAA "+useMSAA); + System.err.println("useMSAA "+useMSAA+", msaaNumSamples "+msaaNumSamples); System.err.println("useAnimator "+useAnimator); System.err.println("shallUsePBuffer "+shallUsePBuffer); System.err.println("shallUseBitmap "+shallUseBitmap); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java index 11d9da780..d5eeb2fac 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java @@ -37,12 +37,12 @@ import java.awt.event.ComponentEvent; import java.lang.reflect.InvocationTargetException; import java.nio.FloatBuffer; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; @@ -99,7 +99,7 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { if( initSingleBuffer ) { singleAWTGLPixelBufferProvider = new SingleAWTGLPixelBufferProvider( glp.isGL2ES3() /* allowRowStride */); - singleAWTGLPixelBufferProvider.initSingleton(4, 600, 600, 1, true); + singleAWTGLPixelBufferProvider.initSingleton(null, 4, true, 600, 600, 1); } else { singleAWTGLPixelBufferProvider = null; } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java index 2d334e837..5ecda9e20 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java @@ -39,8 +39,8 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.es2.ElektronenMultiplizierer; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java index eb2536639..90164d349 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java @@ -57,18 +57,18 @@ import com.jogamp.opengl.util.Gamma; import com.jogamp.opengl.util.PNGPixelRect; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.ScalableSurface; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import jogamp.newt.DefaultEDTUtil; import jogamp.newt.driver.PNGIcon; @@ -85,7 +85,7 @@ public class TestGearsES2NEWT extends UITestCase { static int screenIdx = 0; static PointImmutable wpos; static DimensionImmutable wsize, rwsize=null; - static int[] reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + static float[] reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; static long duration = 500; // ms static boolean opaque = true; @@ -137,7 +137,7 @@ public class TestGearsES2NEWT extends UITestCase { final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); glWindow.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]); glWindow.setSize(wsize.getWidth(), wsize.getHeight()); if(null != wpos) { glWindow.setPosition(wpos.getX(), wpos.getY()); @@ -392,24 +392,22 @@ public class TestGearsES2NEWT extends UITestCase { glWindow.setExclusiveContextThread(t); } }.start(); } else if(e.getKeyChar()=='x') { - final int[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new int[2]); - final int[] reqSurfacePixelScale; + final float[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new float[2]); + final float[] reqSurfacePixelScale; if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) { - reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; } else { - reqSurfacePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + reqSurfacePixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; } System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]); glWindow.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]); - final int[] hasSurfacePixelScale0 = glWindow.convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]); + final float[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new float[2]); System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+ - reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ - valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ - hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); + reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ + valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ + hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); setTitle(glWindow, caps); - Assert.assertArrayEquals(hasSurfacePixelScale0, hasSurfacePixelScale1); } } }); @@ -482,13 +480,11 @@ public class TestGearsES2NEWT extends UITestCase { System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); - final int[] hasSurfacePixelScale0 = glWindow.convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]); + final float[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new float[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); setTitle(glWindow, caps); - Assert.assertArrayEquals(hasSurfacePixelScale0, hasSurfacePixelScale1); snap.setMakeSnapshot(); @@ -669,7 +665,7 @@ public class TestGearsES2NEWT extends UITestCase { usePos = true; } else if(args[i].equals("-pixelScale")) { i++; - final int pS = MiscUtils.atoi(args[i], reqSurfacePixelScale[0]); + final float pS = MiscUtils.atof(args[i], reqSurfacePixelScale[0]); reqSurfacePixelScale[0] = pS; reqSurfacePixelScale[1] = pS; } else if(args[i].equals("-rwidth")) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java index 2dca3ad5e..f43635e81 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java @@ -58,14 +58,14 @@ import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter; -import javax.media.nativewindow.ScalableSurface; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import javax.swing.SwingUtilities; import org.junit.Assert; @@ -86,7 +86,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { static DimensionImmutable wsize, rwsize = null; static FrameLayout frameLayout = FrameLayout.None; static ResizeBy resizeBy = ResizeBy.Component; - static int[] reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + static float[] reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; static long duration = 500; // ms static boolean opaque = true; @@ -195,7 +195,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); glWindow.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]); final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow); if ( shallUseOffscreenFBOLayer ) { @@ -309,24 +309,22 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { return; } if(e.getKeyChar()=='x') { - final int[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new int[2]); - final int[] reqSurfacePixelScale; + final float[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new float[2]); + final float[] reqSurfacePixelScale; if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) { - reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; } else { - reqSurfacePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + reqSurfacePixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; } System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]); glWindow.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]); - final int[] hasSurfacePixelScale0 = glWindow.convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]); + final float[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new float[2]); System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); setTitle(frame, newtCanvasAWT, glWindow, caps); - Assert.assertArrayEquals(hasSurfacePixelScale0, hasSurfacePixelScale1); } } } ); @@ -359,13 +357,11 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); - final int[] hasSurfacePixelScale0 = glWindow.convertToPixelUnits(new int[] { 1, 1 }); - final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]); + final float[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new float[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); setTitle(frame, newtCanvasAWT, glWindow, caps); - Assert.assertArrayEquals(hasSurfacePixelScale0, hasSurfacePixelScale1); if( null != rwsize ) { Thread.sleep(500); // 500ms delay @@ -503,7 +499,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { usePos = true; } else if(args[i].equals("-pixelScale")) { i++; - final int pS = MiscUtils.atoi(args[i], reqSurfacePixelScale[0]); + final float pS = MiscUtils.atof(args[i], reqSurfacePixelScale[0]); reqSurfacePixelScale[0] = pS; reqSurfacePixelScale[1] = pS; } else if(args[i].equals("-screen")) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java index c3c7d68b3..8dcffc662 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java @@ -47,13 +47,13 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java index 7f2bf7881..79c8cb39a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java @@ -38,8 +38,8 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java index 5b64ce3f3..12ea6dbb3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java @@ -47,11 +47,11 @@ import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2; import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import javax.swing.SwingUtilities; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java index 52f4473c3..e8e3741aa 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java @@ -39,10 +39,10 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2; import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareMappedES2; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java index 7ecb63938..c05444b02 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java @@ -39,13 +39,13 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java index 28328fcd2..c2761f694 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java @@ -1,14 +1,14 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.newt.Window; import com.jogamp.newt.event.InputEvent; @@ -330,9 +330,9 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList // Special handling for the case where the GLJPanel is translucent // and wants to be composited with other Java 2D content if (GLProfile.isAWTAvailable() && - (drawable instanceof javax.media.opengl.awt.GLJPanel) && - !((javax.media.opengl.awt.GLJPanel) drawable).isOpaque() && - ((javax.media.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) { + (drawable instanceof com.jogamp.opengl.awt.GLJPanel) && + !((com.jogamp.opengl.awt.GLJPanel) drawable).isOpaque() && + ((com.jogamp.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) { gl.glClear(GL.GL_DEPTH_BUFFER_BIT); } else { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java index 96d6fdba0..22d24b67b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java @@ -2,12 +2,12 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2; import java.net.URLConnection; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.fixedfunc.GLLightingFunc; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.fixedfunc.GLLightingFunc; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.common.util.IOUtil; import com.jogamp.opengl.test.junit.jogl.util.texture.PNGTstFiles; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java index 786229360..5548bb6d4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java @@ -34,14 +34,14 @@ import com.jogamp.opengl.util.texture.TextureCoords; import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.glu.GLU; public class TextureDraw01GL2Listener implements GLEventListener, TextureDraw01Accessor { private final GLU glu = new GLU(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelAndGLCanvasApplet.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelAndGLCanvasApplet.java index a153fc7ae..4a27ea4d2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelAndGLCanvasApplet.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelAndGLCanvasApplet.java @@ -37,17 +37,17 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder;
import java.nio.FloatBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES1;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.awt.GLCanvas;
-import javax.media.opengl.awt.GLJPanel;
-import javax.media.opengl.fixedfunc.GLLightingFunc;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
-import javax.media.opengl.fixedfunc.GLPointerFunc;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2ES1;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.awt.GLCanvas;
+import com.jogamp.opengl.awt.GLJPanel;
+import com.jogamp.opengl.fixedfunc.GLLightingFunc;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.fixedfunc.GLPointerFunc;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JPanel;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/GLJPanelsAndGLCanvasDemoGL2Applet.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/GLJPanelsAndGLCanvasDemoGL2Applet.java index fcff9e56b..84365c56f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/GLJPanelsAndGLCanvasDemoGL2Applet.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/GLJPanelsAndGLCanvasDemoGL2Applet.java @@ -33,8 +33,8 @@ import java.awt.GridLayout; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
-import javax.media.opengl.awt.GLCanvas;
-import javax.media.opengl.awt.GLJPanel;
+import com.jogamp.opengl.awt.GLCanvas;
+import com.jogamp.opengl.awt.GLJPanel;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JPanel;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGLJPanelAWTBug450.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGLJPanelAWTBug450.java index ee5149b1c..19453f7d4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGLJPanelAWTBug450.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGLJPanelAWTBug450.java @@ -27,14 +27,14 @@ */ package com.jogamp.opengl.test.junit.jogl.demos.gl2.awt; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.FPSAnimator; import com.jogamp.opengl.util.GLReadBufferUtil; import com.jogamp.opengl.util.texture.TextureIO; -import javax.media.opengl.awt.GLJPanel; -import javax.media.opengl.glu.gl2.GLUgl2; +import com.jogamp.opengl.awt.GLJPanel; +import com.jogamp.opengl.glu.gl2.GLUgl2; import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2; import com.jogamp.opengl.test.junit.util.UITestCase; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java index 8e2b02fb2..c23512005 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java @@ -28,11 +28,11 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2.awt; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.newt.event.awt.AWTKeyAdapter; import com.jogamp.newt.event.awt.AWTWindowAdapter; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java index 751bd4488..b396e0213 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java @@ -28,11 +28,11 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2.awt; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.newt.event.awt.AWTKeyAdapter; import com.jogamp.newt.event.awt.AWTWindowAdapter; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java index f47a9b794..b6c27cbd2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java @@ -28,7 +28,7 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2.awt; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.TraceKeyAdapter; @@ -37,7 +37,7 @@ import com.jogamp.newt.event.awt.AWTKeyAdapter; import com.jogamp.newt.event.awt.AWTWindowAdapter; import com.jogamp.opengl.util.FPSAnimator; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.awt.GLJPanel; import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; import com.jogamp.opengl.test.junit.util.MiscUtils; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java index 4cefd95c0..0f3011c3d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java @@ -38,8 +38,8 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java index beee5ffde..b769e312c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java @@ -28,8 +28,8 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2.newt; -import javax.media.nativewindow.*; -import javax.media.opengl.*; +import com.jogamp.nativewindow.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestTeapotNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestTeapotNEWT.java index 975d35ad2..8d6ad14bc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestTeapotNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestTeapotNEWT.java @@ -36,8 +36,8 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.gl2.Teapot; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java index 30840c1b7..a4a665e5b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java @@ -32,14 +32,14 @@ import java.io.InputStream; import java.net.URLConnection; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.common.util.IOUtil; import com.jogamp.opengl.util.GLArrayDataServer; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/newt/TestGeomShader01TextureGL3NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/newt/TestGeomShader01TextureGL3NEWT.java index 583334e1f..8e690adb0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/newt/TestGeomShader01TextureGL3NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/newt/TestGeomShader01TextureGL3NEWT.java @@ -29,8 +29,8 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl3.newt; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TessellationShader01aGLSL440CoreHardcoded.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TessellationShader01aGLSL440CoreHardcoded.java index 223eb1a14..610ec7e98 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TessellationShader01aGLSL440CoreHardcoded.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TessellationShader01aGLSL440CoreHardcoded.java @@ -29,13 +29,13 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl4; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GL4; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GL4; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TessellationShader01bGL4.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TessellationShader01bGL4.java index bcf4fa6ca..dcb76dd45 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TessellationShader01bGL4.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TessellationShader01bGL4.java @@ -29,14 +29,14 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl4; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GL4; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GL4; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TriangleInstancedRendererWithShaderState.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TriangleInstancedRendererWithShaderState.java index 9ba0c8d59..560e8aa23 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TriangleInstancedRendererWithShaderState.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TriangleInstancedRendererWithShaderState.java @@ -7,16 +7,16 @@ import java.io.PrintStream; import java.nio.FloatBuffer; import java.util.Random; -import javax.media.opengl.DebugGL4; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL4; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.TraceGL4; +import com.jogamp.opengl.DebugGL4; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL4; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.TraceGL4; import com.jogamp.opengl.math.Matrix4; import com.jogamp.opengl.util.GLArrayDataClient; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TrianglesInstancedRendererHardcoded.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TrianglesInstancedRendererHardcoded.java index 739670053..fb0a78832 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TrianglesInstancedRendererHardcoded.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TrianglesInstancedRendererHardcoded.java @@ -7,12 +7,12 @@ import java.io.PrintStream; import java.nio.FloatBuffer; import java.util.Random; -import javax.media.opengl.DebugGL4; -import javax.media.opengl.GL2; -import javax.media.opengl.GL4; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.TraceGL4; +import com.jogamp.opengl.DebugGL4; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GL4; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.TraceGL4; import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.math.Matrix4; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/awt/TestInstancedReneringGL4AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/awt/TestInstancedReneringGL4AWT.java index c602ffd7b..9cac1368c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/awt/TestInstancedReneringGL4AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/awt/TestInstancedReneringGL4AWT.java @@ -32,10 +32,10 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.JFrame; import javax.swing.SwingUtilities; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/newt/TestInstancedReneringGL4NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/newt/TestInstancedReneringGL4NEWT.java index aeaaf0846..2e4360ad3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/newt/TestInstancedReneringGL4NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/newt/TestInstancedReneringGL4NEWT.java @@ -29,9 +29,9 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl4.newt; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/newt/TestTessellationShader01GL4NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/newt/TestTessellationShader01GL4NEWT.java index ca2638581..842f348a9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/newt/TestTessellationShader01GL4NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/newt/TestTessellationShader01GL4NEWT.java @@ -29,9 +29,9 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl4.newt; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java index 96db8e564..c77745ddb 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java @@ -30,10 +30,10 @@ package com.jogamp.opengl.test.junit.jogl.glsl; import com.jogamp.opengl.util.GLArrayDataServer; import com.jogamp.opengl.util.glsl.ShaderState; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLBufferStorage; -import javax.media.opengl.GLDrawable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLBufferStorage; +import com.jogamp.opengl.GLDrawable; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java index 57d6caa85..321494afa 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java @@ -39,13 +39,13 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java index 501850c4f..0f67472ab 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java @@ -39,13 +39,13 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java index b478fcdb6..e957c4b11 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java @@ -33,9 +33,9 @@ import com.jogamp.opengl.test.junit.util.GLSLSimpleProgram; import com.jogamp.opengl.test.junit.util.UITestCase; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; @@ -48,7 +48,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.shader.RedSquareShader; import com.jogamp.opengl.test.junit.util.MiscUtils; import java.io.IOException; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES2; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestGLSLSimple01NEWT extends UITestCase { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java index e20bbef2d..88146b2b8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java @@ -45,15 +45,15 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.nio.FloatBuffer; -import javax.media.nativewindow.ScalableSurface; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.nativewindow.ScalableSurface; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.Test; @@ -63,7 +63,7 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestRulerNEWT01 extends UITestCase { static long durationPerTest = 500; // ms - static int[] reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + static float[] reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; static boolean manualTest = false; private void setTitle(final Window win) { @@ -77,7 +77,7 @@ public class TestRulerNEWT01 extends UITestCase { final GLWindow glWindow = GLWindow.create(new GLCapabilities(GLProfile.getGL2ES2())); Assert.assertNotNull(glWindow); glWindow.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]); glWindow.setSize(640, 480); glWindow.addGLEventListener(new GLEventListener() { @@ -183,19 +183,19 @@ public class TestRulerNEWT01 extends UITestCase { return; } if(e.getKeyChar()=='x') { - final int[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new int[2]); - final int[] reqSurfacePixelScale; + final float[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new float[2]); + final float[] reqSurfacePixelScale; if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) { - reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; + reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; } else { - reqSurfacePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; + reqSurfacePixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE }; } System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]); snap.setMakeSnapshot(); glWindow.setSurfaceScale(reqSurfacePixelScale); - final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]); - final int[] hasSurfacePixelScale = glWindow.getCurrentSurfaceScale(new int[2]); - final int[] nativeSurfacePixelScale = glWindow.getNativeSurfaceScale(new int[2]); + final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]); + final float[] hasSurfacePixelScale = glWindow.getCurrentSurfaceScale(new float[2]); + final float[] nativeSurfacePixelScale = glWindow.getMaximumSurfaceScale(new float[2]); System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ @@ -208,7 +208,7 @@ public class TestRulerNEWT01 extends UITestCase { glWindow.setVisible(true); - final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]); + final float[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new float[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); @@ -243,7 +243,7 @@ public class TestRulerNEWT01 extends UITestCase { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); } else if(args[i].equals("-pixelScale")) { i++; - final int pS = MiscUtils.atoi(args[i], reqSurfacePixelScale[0]); + final float pS = MiscUtils.atof(args[i], reqSurfacePixelScale[0]); reqSurfacePixelScale[0] = pS; reqSurfacePixelScale[1] = pS; } else if(args[i].equals("-manual")) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java index e5b2dd2da..8b282e76e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java @@ -30,15 +30,15 @@ package com.jogamp.opengl.test.junit.jogl.glsl; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2GL3; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2GL3; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import java.awt.Frame; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java index e267d93b1..529e3e70a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java @@ -6,13 +6,13 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import java.io.ByteArrayOutputStream; import java.io.PrintStream; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; -import javax.media.opengl.GL3; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GL2ES3; +import com.jogamp.opengl.GL3; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug365TextureGenerateMipMaps.java b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug365TextureGenerateMipMaps.java index dfa26a049..5154e15d8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug365TextureGenerateMipMaps.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug365TextureGenerateMipMaps.java @@ -2,14 +2,14 @@ package com.jogamp.opengl.test.junit.jogl.glu; import java.nio.ByteBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLOffscreenAutoDrawable;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLOffscreenAutoDrawable;
+import com.jogamp.opengl.GLProfile;
import org.junit.AfterClass;
import org.junit.Assert;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug463ScaleImageMemoryAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug463ScaleImageMemoryAWT.java index 5c63b2e1d..873e05eba 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug463ScaleImageMemoryAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug463ScaleImageMemoryAWT.java @@ -31,13 +31,13 @@ package com.jogamp.opengl.test.junit.jogl.glu; import java.awt.Frame; import java.nio.ByteBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.glu.gl2es1.GLUgl2es1; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.glu.gl2es1.GLUgl2es1; import org.junit.Assume; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java index 184dea8ba..4556a6806 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java @@ -31,13 +31,13 @@ package com.jogamp.opengl.test.junit.jogl.glu; import java.awt.Frame; import java.nio.ByteBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.glu.GLU; import org.junit.Assume; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java index d10a04845..00a474b05 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java @@ -28,7 +28,7 @@ package com.jogamp.opengl.test.junit.jogl.math; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.glu.GLU; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java index 278c2450a..d0557ccc4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java @@ -28,7 +28,7 @@ package com.jogamp.opengl.test.junit.jogl.math; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.glu.GLU; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java index 8c2216f7a..1e65b15bc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java @@ -30,13 +30,13 @@ package com.jogamp.opengl.test.junit.jogl.math; import java.nio.FloatBuffer; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import jogamp.common.os.PlatformPropsImpl; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java index 7250e438d..78c66d927 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java @@ -35,7 +35,7 @@ import org.junit.runners.MethodSorters; import com.jogamp.opengl.util.PMVMatrix;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import java.nio.FloatBuffer;
import static org.junit.Assert.assertArrayEquals;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java index 87e759919..f356a3678 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java @@ -2,7 +2,7 @@ package com.jogamp.opengl.test.junit.jogl.math; import java.util.Arrays; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import jogamp.opengl.ProjectFloat; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java index 883bf4362..b899c426c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java @@ -33,12 +33,12 @@ import com.jogamp.opengl.test.junit.util.*; import java.lang.reflect.InvocationTargetException; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; import com.jogamp.newt.Screen; @@ -58,7 +58,7 @@ import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLEventListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2File.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2File.java index 989bd5e3a..4af7add7b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2File.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2File.java @@ -29,7 +29,7 @@ package com.jogamp.opengl.test.junit.jogl.offscreen; import java.io.IOException; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import java.io.File; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java index 3f9a64f5b..4b75a3ca4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java @@ -30,12 +30,12 @@ package com.jogamp.opengl.test.junit.jogl.offscreen; import java.nio.*; -import javax.media.opengl.*; -import javax.media.opengl.fixedfunc.*; +import com.jogamp.opengl.*; +import com.jogamp.opengl.fixedfunc.*; import com.jogamp.opengl.util.*; -import javax.media.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; import com.jogamp.opengl.util.texture.TextureCoords; import com.jogamp.opengl.util.GLArrayDataClient; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBufferBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBufferBase.java index e834775fc..da0b11c93 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBufferBase.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBufferBase.java @@ -28,7 +28,7 @@ package com.jogamp.opengl.test.junit.jogl.offscreen; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.GLReadBufferUtil; @@ -52,7 +52,7 @@ public class ReadBufferBase implements GLEventListener { if(glDebug) { try { - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, _gl, null) ); } catch (final Exception e) { throw new RuntimeException("can not set debug pipeline", e); } @@ -60,7 +60,7 @@ public class ReadBufferBase implements GLEventListener { if(glTrace) { try { - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, _gl, new Object[] { System.err } ) ); } catch (final Exception e) { throw new RuntimeException("can not set trace pipeline", e); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/Surface2File.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/Surface2File.java index 5c2e80170..02611e4f2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/Surface2File.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/Surface2File.java @@ -28,7 +28,7 @@ package com.jogamp.opengl.test.junit.jogl.offscreen; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.GLReadBufferUtil; @@ -37,7 +37,7 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; public class Surface2File implements SurfaceUpdatedListener { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java index 78224de49..dd1812419 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java @@ -41,7 +41,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java index 2202b754c..ca39a122a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java @@ -39,7 +39,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es1.RedSquareES1; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java index 9e66a614e..3853d9583 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java @@ -32,8 +32,8 @@ import com.jogamp.opengl.test.junit.util.*; import org.junit.Assert; -import javax.media.opengl.*; -import javax.media.nativewindow.*; +import com.jogamp.opengl.*; +import com.jogamp.nativewindow.*; import com.jogamp.newt.*; import com.jogamp.newt.event.*; import com.jogamp.newt.opengl.*; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java index 0db2afc32..1550bb531 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java @@ -35,14 +35,14 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java index 9f2e25fd7..632855c43 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java @@ -36,14 +36,14 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java index 60e31aa6a..ee1056b19 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java @@ -30,11 +30,11 @@ package com.jogamp.opengl.test.junit.jogl.perf; import java.lang.reflect.InvocationTargetException; import java.util.concurrent.atomic.AtomicInteger; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.BeforeClass; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java index f8b15a843..35c692429 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java @@ -29,15 +29,15 @@ package com.jogamp.opengl.test.junit.jogl.perf; import java.lang.reflect.InvocationTargetException; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.GraphicsConfigurationFactory; -import javax.media.nativewindow.VisualIDHolder; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsConfiguration; +import com.jogamp.nativewindow.GraphicsConfigurationFactory; +import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; import org.junit.BeforeClass; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java b/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java index 58aa8cd23..4f8fb3bd2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java @@ -31,11 +31,11 @@ import java.io.File; import java.net.URISyntaxException; import java.util.Arrays; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.opengl.GL; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import jogamp.opengl.util.stereo.GenericStereoDevice; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java index e6cb48764..aec728cad 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java @@ -47,13 +47,13 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java index 944fa1071..0578492e2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java @@ -47,13 +47,13 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.PointImmutable; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.PointImmutable; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java index fb563f955..9a422f411 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java @@ -43,13 +43,13 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.GL ; -import javax.media.opengl.GL2 ; -import javax.media.opengl.GLAutoDrawable ; -import javax.media.opengl.GLCapabilities ; -import javax.media.opengl.GLEventListener ; -import javax.media.opengl.GLProfile; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL ; +import com.jogamp.opengl.GL2 ; +import com.jogamp.opengl.GLAutoDrawable ; +import com.jogamp.opengl.GLCapabilities ; +import com.jogamp.opengl.GLEventListener ; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.nativewindow.swt.SWTAccessor; import com.jogamp.newt.NewtFactory; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java index 380bd3f7d..0d9effb30 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java @@ -28,11 +28,11 @@ package com.jogamp.opengl.test.junit.jogl.swt; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java index f18e10bb1..d3c4de885 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java @@ -31,12 +31,12 @@ package com.jogamp.opengl.test.junit.jogl.swt; import java.awt.Frame; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import org.eclipse.swt.SWT; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java index 7b64838cc..7072ed9ea 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java @@ -44,9 +44,9 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities ; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities ; +import com.jogamp.opengl.GLProfile; import jogamp.newt.swt.SWTEDTUtil; import jogamp.newt.swt.event.SWTNewtEventFactory; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java index 69911c599..7c91a04af 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java @@ -28,10 +28,10 @@ package com.jogamp.opengl.test.junit.jogl.swt; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLProfile; import org.eclipse.swt.SWT; import org.eclipse.swt.events.PaintEvent; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java index 04ffdcb1c..4cb273630 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java @@ -28,11 +28,11 @@ package com.jogamp.opengl.test.junit.jogl.swt; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java index 546420057..4a2096373 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java @@ -40,13 +40,14 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLOffscreenAutoDrawable; -import javax.media.opengl.GLRunnable; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLOffscreenAutoDrawable; +import com.jogamp.opengl.GLRunnable; import org.junit.FixMethodOrder; import org.junit.Test; @@ -117,8 +118,9 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { @Override public void init(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); - final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); - final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); + final PixelFormat.Composition hostPixelComp = pixelBufferProvider.getHostPixelComp(gl.getGLProfile(), 3); + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3, true); + final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, hostPixelComp, pixelAttribs, true, imageWidth, imageHeight, 1, 0); renderer.setImageBuffer(pixelBuffer); if( drawable.isGLOriented() ) { flipVertically[0] = false; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java index b128f8691..7c04370f5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java @@ -48,11 +48,12 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Assert; import org.junit.FixMethodOrder; @@ -136,8 +137,9 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { @Override public void init(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); - final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); - final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); + final PixelFormat.Composition hostPixelComp = pixelBufferProvider.getHostPixelComp(gl.getGLProfile(), 3); + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3, true); + final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, hostPixelComp, pixelAttribs, true, imageWidth, imageHeight, 1, 0); renderer.setImageBuffer(pixelBuffer); if( drawable.isGLOriented() ) { flipVertically[0] = false; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java index 87f1f3e7d..c880b1f13 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java @@ -43,9 +43,9 @@ import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.AfterClass; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java index 274b1eef3..48f1dbdb1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java @@ -43,8 +43,8 @@ import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.AfterClass; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java index 7c8d65c19..41d438f5d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java @@ -43,9 +43,9 @@ import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComponent; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java index 060b85a34..b069e8dba 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java @@ -42,9 +42,9 @@ import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComponent; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java index 85edcda6c..3b48ccf6b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java @@ -45,9 +45,9 @@ import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; import javax.imageio.ImageIO; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLJPanel; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLJPanel; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComponent; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java index 9dee67e5e..77889c1b0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java @@ -39,14 +39,15 @@ import com.jogamp.opengl.util.texture.TextureIO; import java.io.File; import java.io.IOException; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.FixMethodOrder; @@ -121,8 +122,9 @@ public class TestTiledRendering1GL2NEWT extends UITestCase { final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride; final boolean[] flipVertically = { false }; - final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); - final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); + final PixelFormat.Composition hostPixelComp = pixelBufferProvider.getHostPixelComp(gl.getGLProfile(), 3); + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3, true); + final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, hostPixelComp, pixelAttribs, true, imageWidth, imageHeight, 1, 0); renderer.setImageBuffer(pixelBuffer); flipVertically[0] = false; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java index e979ac966..1fadb72f4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java @@ -40,13 +40,15 @@ import com.jogamp.opengl.util.texture.TextureIO; import java.io.File; import java.io.IOException; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLRunnable; + +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; import org.junit.FixMethodOrder; import org.junit.Test; @@ -197,8 +199,9 @@ public class TestTiledRendering2NEWT extends UITestCase { @Override public void init(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); - final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); - final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); + final PixelFormat.Composition hostPixelComp = pixelBufferProvider.getHostPixelComp(gl.getGLProfile(), 3); + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3, true); + final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, hostPixelComp, pixelAttribs, true, imageWidth, imageHeight, 1, 0); renderer.setImageBuffer(pixelBuffer); if( drawable.isGLOriented() ) { flipVertically[0] = false; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java index e84bb4d74..be662fd1f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java @@ -40,7 +40,7 @@ import java.awt.print.PrinterJob; import java.io.FileNotFoundException; import java.io.FileOutputStream; -import javax.media.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLAutoDrawable; import javax.print.StreamPrintService; import javax.print.StreamPrintServiceFactory; import javax.print.attribute.HashPrintRequestAttributeSet; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java index b3f85e879..1ca45a6d1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java @@ -27,15 +27,15 @@ */ package com.jogamp.opengl.test.junit.jogl.util; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLPipelineFactory; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.glu.GLU; -import javax.media.opengl.glu.gl2es1.GLUgl2es1; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.glu.GLU; +import com.jogamp.opengl.glu.gl2es1.GLUgl2es1; import com.jogamp.opengl.util.ImmModeSink; import com.jogamp.opengl.util.glsl.fixedfunc.FixedFuncUtil; @@ -71,11 +71,11 @@ class DemoGL2ES1ImmModeSink implements GLEventListener { GL _gl = drawable.getGL(); if(debugFFPEmu) { // Debug .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, _gl, null) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES2.class, _gl, null) ); } if(traceFFPEmu) { // Trace .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); } final GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1Plain.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1Plain.java index c1dd7fb58..2da2643c7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1Plain.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1Plain.java @@ -30,15 +30,15 @@ package com.jogamp.opengl.test.junit.jogl.util; import java.nio.ByteBuffer; import java.nio.FloatBuffer; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.fixedfunc.GLPointerFunc; -import javax.media.opengl.glu.GLU; -import javax.media.opengl.glu.gl2es1.GLUgl2es1; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.fixedfunc.GLPointerFunc; +import com.jogamp.opengl.glu.GLU; +import com.jogamp.opengl.glu.gl2es1.GLUgl2es1; import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.GLArrayDataWrapper; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java index d186643b7..f90b32009 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java @@ -42,14 +42,14 @@ import com.jogamp.opengl.util.texture.TextureCoords; import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLPipelineFactory; -import javax.media.opengl.fixedfunc.GLMatrixFunc; -import javax.media.opengl.glu.GLU; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES1; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.glu.GLU; public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDraw01Accessor { private boolean debugFFPEmu = false; @@ -89,11 +89,11 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra GL _gl = drawable.getGL(); if(debugFFPEmu) { // Debug .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, _gl, null) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES2.class, _gl, null) ); } if(traceFFPEmu) { // Trace .. - _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); + _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); } final GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java index 3dc29381a..d079ca56c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java @@ -28,13 +28,13 @@ package com.jogamp.opengl.test.junit.jogl.util; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLUniformData; -import javax.media.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLUniformData; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.util.ImmModeSink; import com.jogamp.opengl.util.PMVMatrix; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestES1FixedFunctionPipelineNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestES1FixedFunctionPipelineNEWT.java index 979c4873e..4be29ce1e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestES1FixedFunctionPipelineNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestES1FixedFunctionPipelineNEWT.java @@ -37,9 +37,9 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1; import com.jogamp.opengl.test.junit.jogl.demos.es1.RedSquareES1; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES1NEWT.java index 790f965b6..ea5f8c8b4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES1NEWT.java @@ -30,10 +30,10 @@ package com.jogamp.opengl.test.junit.jogl.util; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java index 9cf39a040..ff7adab3f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java @@ -30,10 +30,10 @@ package com.jogamp.opengl.test.junit.jogl.util; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java index 2eb8b45c3..a4895fb0e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java @@ -28,10 +28,10 @@ package com.jogamp.opengl.test.junit.jogl.util.texture; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Test; import org.junit.FixMethodOrder; @@ -112,7 +112,7 @@ public class TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT extends UITestC public void dispose(final GLAutoDrawable drawable) {} public void display(final GLAutoDrawable drawable) { final GLPixelBufferProvider pixelBufferProvider = screenshot.getPixelBufferProvider(); - final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(drawable.getGL(), readAlpha ? 4 : 3); + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(drawable.getGL(), readAlpha ? 4 : 3, true); System.err.println("GLPixelAttributes: "+pixelAttribs); snapshot(displayCount++, null, drawable.getGL(), screenshot, TextureIO.PNG, null); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java index e3be8ce33..201d60a78 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java @@ -31,11 +31,11 @@ package com.jogamp.opengl.test.junit.jogl.util.texture; import java.awt.Dimension; import java.awt.Frame; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import jogamp.nativewindow.jawt.JAWTUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01NEWT.java index a10870635..efea9a7b3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01NEWT.java @@ -30,10 +30,10 @@ package com.jogamp.opengl.test.junit.jogl.util.texture; import com.jogamp.newt.opengl.GLWindow; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.GLReadBufferUtil; import com.jogamp.opengl.util.texture.TextureIO; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java index 8be3fb24b..a7196150c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java @@ -31,12 +31,12 @@ package com.jogamp.opengl.test.junit.jogl.util.texture; import java.awt.Dimension; import java.awt.Frame; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.Threading; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.Threading; +import com.jogamp.opengl.awt.GLCanvas; import jogamp.nativewindow.jawt.JAWTUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java index cfae6f0df..8339831a0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java @@ -30,10 +30,10 @@ package com.jogamp.opengl.test.junit.jogl.util.texture; import com.jogamp.newt.opengl.GLWindow; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.GLReadBufferUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java index 156ca20a1..925382901 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java @@ -32,10 +32,10 @@ import java.io.InputStream; import java.net.MalformedURLException; import java.net.URLConnection; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; @@ -55,7 +55,7 @@ import com.jogamp.opengl.util.GLReadBufferUtil; import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; import com.jogamp.opengl.util.texture.spi.JPEGImage; -import javax.media.opengl.GL; +import com.jogamp.opengl.GL; /** * Test reading and displaying a JPG image. diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java index 7c11d7275..4fc774463 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java @@ -33,8 +33,8 @@ import com.jogamp.common.util.IOUtil; import com.jogamp.opengl.test.junit.util.UITestCase; import javax.imageio.ImageIO; -import javax.media.opengl.GL; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; import com.jogamp.opengl.util.texture.TextureData; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java index 067ee9d67..d5c80553d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java @@ -38,11 +38,11 @@ import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.test.junit.util.UITestCase; import javax.imageio.ImageIO; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java index 565434e2e..114561666 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java @@ -38,10 +38,10 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.test.junit.util.UITestCase; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java index 8f63a4f4c..3918b6cb7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java @@ -34,8 +34,8 @@ import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URLConnection; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.nativewindow.util.PixelFormatUtil; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.PixelFormatUtil; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java index 4a324f594..e299932b3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java @@ -32,12 +32,12 @@ import java.io.InputStream; import java.net.MalformedURLException; import java.net.URLConnection; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; @@ -73,9 +73,10 @@ public class TestPNGPixelRect01NEWT extends UITestCase { final GLProfile glp = GLProfile.getGL2ES2(); final PNGPixelRect image = PNGPixelRect.read(istream, destFmt, true /* directBuffer */, 0 /* destMinStrideInBytes */, true /* destIsGLOriented */); Assert.assertNotNull(image); - final GLPixelAttributes glpa = GLPixelAttributes.convert(image.getPixelformat(), glp); - final boolean hasAlpha = 4 == glpa.bytesPerPixel; - System.err.println("PNGPixelRect: "+basename+", "+image+", glpa "+glpa); + System.err.println("PNGPixelRect: "+basename+", "+image); + final GLPixelAttributes glpa = new GLPixelAttributes(glp, image.getPixelformat(), false /* pack */); + final boolean hasAlpha = 4 == glpa.pfmt.comp.bytesPerPixel(); + System.err.println("GLPixelAttributes: "+glpa); final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); final GLCapabilities caps = new GLCapabilities(glp); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java index bbcd04454..2d6b6da71 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java @@ -37,11 +37,11 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.test.junit.util.UITestCase; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java index bbfc2907f..a82767f9a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java @@ -38,10 +38,10 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.test.junit.util.UITestCase; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormat00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormat00NEWT.java new file mode 100644 index 000000000..789d8dc5a --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormat00NEWT.java @@ -0,0 +1,61 @@ +/** + * Copyright 2014 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.opengl.test.junit.jogl.util.texture; + +import java.io.IOException; +import java.net.MalformedURLException; + +import com.jogamp.nativewindow.util.PixelFormat; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; + +import com.jogamp.opengl.test.junit.util.UITestCase; + +/** + * Testing PixelFormat integrity + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestPixelFormat00NEWT extends UITestCase { + @Test + public void test00() throws InterruptedException, IOException, MalformedURLException { + final PixelFormat[] formats = PixelFormat.values(); + + for(int i=0; i<formats.length; i++) { + final PixelFormat pf = formats[i]; + System.err.printf("%02d: %s, %s%n", i, pf, pf.comp); + final PixelFormat pf2 = PixelFormat.valueOf(pf.comp); + Assert.assertEquals(pf, pf2); + } + } + public static void main(final String args[]) { + org.junit.runner.JUnitCore.main(TestPixelFormat00NEWT.class.getName()); + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil00NEWT.java index 1b549fa96..16158a0f0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil00NEWT.java @@ -32,16 +32,18 @@ import java.net.MalformedURLException; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.nativewindow.util.PixelFormatUtil; -import javax.media.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.PixelFormatUtil; +import com.jogamp.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.PixelFormat.CType; import org.junit.Assert; import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; +import com.jogamp.common.util.Bitstream; import com.jogamp.opengl.test.junit.util.UITestCase; /** @@ -50,142 +52,401 @@ import com.jogamp.opengl.test.junit.util.UITestCase; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestPixelFormatUtil00NEWT extends UITestCase { + static final byte undef_val = (byte)0xFF; + static final PixelFormat.Composition comp_val = PixelFormat.RGBA8888.comp; + static final float red___valF; + static final float green_valF; + static final float blue__valF; + static final float alpha_valF; + static final float lum___valF; + static { + // Using am equal stepping of 0x30 = 48 between each RGBA and undefined values, + // dividing 0xff equally by 5 excluding zero. + final byte red___val = (byte)0x30; + final byte green_val = (byte)0x60; + final byte blue__val = (byte)0x90; + final byte alpha_val = (byte)0xC0; + red___valF = comp_val.toFloat(red___val, 0, false); + green_valF = comp_val.toFloat(green_val, 1, false); + blue__valF = comp_val.toFloat(blue__val, 2, false); + alpha_valF = comp_val.toFloat(alpha_val, 3, false); + lum___valF = ( red___valF + green_valF + blue__valF ) / 3f; + } + + @Test + public void testConversion00() throws InterruptedException, IOException, MalformedURLException { + { + final PixelFormat fmt = PixelFormat.RGBA5551; + final PixelFormat.Composition comp = fmt.comp; + System.err.printf("%s, %s:%n", fmt, comp); + final int u16_alpha = comp.encode4CompI8((byte)comp.fromFloat(red___valF, 0, false), + (byte)comp.fromFloat(green_valF, 0, false), + (byte)comp.fromFloat(blue__valF, 0, false), + (byte)comp.fromFloat(alpha_valF, 0, false)); + final int u16_undef = comp.encode4CompI8((byte)comp.fromFloat(red___valF, 0, false), + (byte)comp.fromFloat(green_valF, 0, false), + (byte)comp.fromFloat(blue__valF, 0, false), + undef_val); + System.err.printf(" u16_alpha %s%n", Bitstream.toHexBinString(true, u16_alpha, comp.bitsPerPixel())); + System.err.printf(" u16_undef %s%n", Bitstream.toHexBinString(true, u16_undef, comp.bitsPerPixel())); + { + final byte c4NormI8_alpha = (byte)comp.fromFloat(alpha_valF, 0, false); + final byte c4NormI8_undef = undef_val; + final int compBitShift = 15; + final int compMask = 0x1; + final int v_alpha = ( c4NormI8_alpha & compMask ) << compBitShift ; + final int v_undef = ( c4NormI8_undef & compMask ) << compBitShift ; + System.err.printf(" xx_alpha %s%n", Bitstream.toHexBinString(true, v_alpha, comp.bitsPerPixel())); + System.err.printf(" xx_undef %s%n", Bitstream.toHexBinString(true, v_undef, comp.bitsPerPixel())); + } + } + { + final int r8 = 0x30; + final int g8 = 0x60; + final int b8 = 0x90; + final int a8 = 0xC0; + + final int l1 = 0x1; + final int r5 = 0x6; + final int g6 = 0xC; + final int b5 = 0x6; + + final PixelFormat rgba8888Fmt = PixelFormat.RGBA8888; + final PixelFormat.Composition rgba8888Comp = rgba8888Fmt.comp; + final PixelFormat rgb565Fmt = PixelFormat.RGB565; + final PixelFormat.Composition rgb565Comp = rgb565Fmt.comp; + final PixelFormat lumFmt = PixelFormat.LUMINANCE; + final PixelFormat.Composition lumComp = lumFmt.comp; + System.err.printf("%s, %s -> %s %s%n", rgb565Fmt, rgb565Comp, lumFmt, lumComp); + + { + final float r8f = rgba8888Comp.toFloat(r8, 0, false); + final int r8fi = rgba8888Comp.fromFloat(r8f, 0, false); + final float g8f = rgba8888Comp.toFloat(g8, 1, false); + final int g8fi = rgba8888Comp.fromFloat(g8f, 1, false); + final float b8f = rgba8888Comp.toFloat(b8, 2, false); + final int b8fi = rgba8888Comp.fromFloat(b8f, 2, false); + final float a8f = rgba8888Comp.toFloat(a8, 3, false); + final int a8fi = rgba8888Comp.fromFloat(a8f, 3, false); + + System.err.printf("res00.0.r %s -> %f -> %s%n", Bitstream.toHexBinString(true, r8, 8), r8f, Bitstream.toHexBinString(true, r8fi, 8)); + System.err.printf("res00.0.g %s -> %f -> %s%n", Bitstream.toHexBinString(true, g8, 8), g8f, Bitstream.toHexBinString(true, g8fi, 8)); + System.err.printf("res00.0.b %s -> %f -> %s%n", Bitstream.toHexBinString(true, b8, 8), b8f, Bitstream.toHexBinString(true, b8fi, 8)); + System.err.printf("res00.0.a %s -> %f -> %s%n", Bitstream.toHexBinString(true, a8, 8), a8f, Bitstream.toHexBinString(true, a8fi, 8)); + } + { + final float res00_0 = ( red___valF + green_valF + blue__valF ) / 3f; + final int res00 = rgba8888Comp.fromFloat(res00_0, 0, false); + System.err.printf("res01.0 ( %f + %f + %f ) / 3f = %f -> %s%n", + red___valF, green_valF, blue__valF, res00_0, Bitstream.toHexBinString(true, res00, 8)); + } + { + final float res00_0 = ( red___valF + green_valF + blue__valF ) / 3f; + final int res00 = lumComp.fromFloat(res00_0, 0, false); + System.err.printf("res02.1 ( %f + %f + %f ) / 3f = %f -> %s%n", + red___valF, green_valF, blue__valF, res00_0, Bitstream.toHexBinString(true, res00, 8)); + } + { + // sourceNorm static -> lum + final int rl1 = lumComp.fromFloat(red___valF, 0, false); + final int gl1 = lumComp.fromFloat(green_valF, 0, false); + final int bl1 = lumComp.fromFloat(blue__valF, 0, false); + final float rl2 = lumComp.toFloat(rl1, 0, false); + final float gl2 = lumComp.toFloat(gl1, 0, false); + final float bl2 = lumComp.toFloat(bl1, 0, false); + System.err.printf("res20.l1 ( %s + %s + %s )%n", + Bitstream.toHexBinString(true, rl1, 8), + Bitstream.toHexBinString(true, gl1, 8), + Bitstream.toHexBinString(true, bl1, 8)); + System.err.printf("res20.l2 ( %f + %f + %f )%n", rl2, gl2, bl2); + final float res02_l2_0 = ( rl2 + gl2 + bl2 ) / 3f; + final int res02_l2_x = lumComp.fromFloat(res02_l2_0, 0, false); + System.err.printf("res20.l3 ( %f + %f + %f ) / 3f = %f -> %s%n", + rl2, gl2, bl2, res02_l2_0, Bitstream.toHexBinString(true, res02_l2_x, 8)); + + // rescale lum -> rgb565 + final int r_1 = rgb565Comp.fromFloat(rl2, 0, false); + final int g_1 = rgb565Comp.fromFloat(gl2, 1, false); + final int b_1 = rgb565Comp.fromFloat(bl2, 2, false); + final float r_2 = rgb565Comp.toFloat(r_1, 0, false); + final float g_2 = rgb565Comp.toFloat(g_1, 1, false); + final float b_2 = rgb565Comp.toFloat(b_1, 2, false); + System.err.printf("res20._1 ( %s + %s + %s )%n", + Bitstream.toHexBinString(true, r_1, 8), + Bitstream.toHexBinString(true, g_1, 8), + Bitstream.toHexBinString(true, b_1, 8)); + System.err.printf("res20._2 ( %f + %f + %f )%n", r_2, g_2, b_2); + final float res02__3_0 = ( r_2 + g_2 + b_2 ) / 3f; + final int res02__3_x = lumComp.fromFloat(res02__3_0, 0, false); + System.err.printf("res20._3 ( %f + %f + %f ) / 3f = %f -> %s%n", + r_2, g_2, b_2, res02__3_0, Bitstream.toHexBinString(true, res02__3_x, 8)); + } + { + // sourceNorm static -> lum + // rescale lum -> rgb565 + final float rF = rgb565Comp.toFloat(rescaleComp(lumComp, 0, rgb565Comp, 0, red___valF), 0, false); + final float gF = rgb565Comp.toFloat(rescaleComp(lumComp, 0, rgb565Comp, 1, green_valF), 1, false); + final float bF = rgb565Comp.toFloat(rescaleComp(lumComp, 0, rgb565Comp, 2, blue__valF), 2, false); + final float res01_0 = ( rF + gF + bF ) / 3f; + final int res01 = lumComp.fromFloat(res01_0, 0, false); + System.err.printf("res30.xx ( %f + %f + %f ) / 3f = %f -> %s%n", + rF, gF, bF, res01_0, Bitstream.toHexBinString(true, res01, 8)); + } + { + final float rF = rgb565Comp.toFloat(r5, 0, false); + final float gF = rgb565Comp.toFloat(g6, 1, false); + final float bF = rgb565Comp.toFloat(b5, 2, false); + + final float lF = ( rF + gF + bF ) / 3f; + final int res00 = lumComp.fromFloat(lF, 0, false); + + System.err.printf("res40 ( %f + %f + %f ) / 3f = %s%n", + rF, gF, bF, Bitstream.toHexBinString(true, res00, 8)); + } + } + + } + @Test public void testConversion01_srcS000_BE_TL_destS000_TL() throws InterruptedException, IOException, MalformedURLException { - testPNG00Impl(0 /* srcMinStrideInBytes */, ByteOrder.BIG_ENDIAN, false /* srcIsGLOriented */, - 0 /* destMinStrideInBytes */, false /* destIsGLOriented */); + testConversionImpl(0 /* srcMinStrideInBytes */, ByteOrder.BIG_ENDIAN, false /* srcIsGLOriented */, + 0 /* destMinStrideInBytes */, false /* destIsGLOriented */); } @Test public void testConversion02_srcS000_LE_TL_destS000_TL() throws InterruptedException, IOException, MalformedURLException { - testPNG00Impl(0 /* srcMinStrideInBytes */, ByteOrder.LITTLE_ENDIAN, false /* srcIsGLOriented */, - 0 /* destMinStrideInBytes */, false /* destIsGLOriented */); + testConversionImpl(0 /* srcMinStrideInBytes */, ByteOrder.LITTLE_ENDIAN, false /* srcIsGLOriented */, + 0 /* destMinStrideInBytes */, false /* destIsGLOriented */); } @Test public void testConversion03_srcS000_BE_TL_destS259_TL() throws InterruptedException, IOException, MalformedURLException { - testPNG00Impl(0 /* srcMinStrideInBytes */, ByteOrder.BIG_ENDIAN, false /* srcIsGLOriented */, - 259 /* destMinStrideInBytes */, false /* destIsGLOriented */); + testConversionImpl(0 /* srcMinStrideInBytes */, ByteOrder.BIG_ENDIAN, false /* srcIsGLOriented */, + 259 /* destMinStrideInBytes */, false /* destIsGLOriented */); } @Test public void testConversion04_srcS259_BE_TL_destS259_TL() throws InterruptedException, IOException, MalformedURLException { - testPNG00Impl(259 /* srcMinStrideInBytes */, ByteOrder.BIG_ENDIAN, false /* srcIsGLOriented */, - 259 /* destMinStrideInBytes */, false /* destIsGLOriented */); + testConversionImpl(259 /* srcMinStrideInBytes */, ByteOrder.BIG_ENDIAN, false /* srcIsGLOriented */, + 259 /* destMinStrideInBytes */, false /* destIsGLOriented */); } @Test public void testConversion05_srcS301_BE_TL_destS259_TL() throws InterruptedException, IOException, MalformedURLException { - testPNG00Impl(301 /* srcMinStrideInBytes */, ByteOrder.BIG_ENDIAN, false /* srcIsGLOriented */, - 259 /* destMinStrideInBytes */, false /* destIsGLOriented */); + testConversionImpl(301 /* srcMinStrideInBytes */, ByteOrder.BIG_ENDIAN, false /* srcIsGLOriented */, + 259 /* destMinStrideInBytes */, false /* destIsGLOriented */); } - static final byte red___val = (byte)0x01; - static final byte green_val = (byte)0x02; - static final byte blue__val = (byte)0x03; - static final byte alpha_val = (byte)0x04; - static final byte undef_val = (byte)0xff; - - static final void getComponents(final int srcComps, final PixelFormat fmt, final byte[] components) { + /** + * Note: Fixes bit-rounding errors, i.e. RGBA5551: A 0.6f -> 0x01 -> 1f ... -> RGBA8888: A 0xff + */ + static final float sourceNorm(final PixelFormat.Composition srcComp, final int sIdx, final float f) { + if( sIdx >= 0 && sIdx < srcComp.componenCount() ) { + return srcComp.toFloat(srcComp.fromFloat(f, sIdx, false), sIdx, false); + } else { + return 0f; + } + } + static final byte rescaleComp(final PixelFormat.Composition srcComp, final int sIdx, + final PixelFormat.Composition dstComp, final int dIdx, final float f) { + if( dIdx >= 0 && dIdx < dstComp.componenCount() ) { + return (byte)dstComp.fromFloat(sourceNorm(srcComp, sIdx, f), dIdx, false); + } else { + return (byte)0; + } + } + static final void getComponentData(final PixelFormat srcFmt, final PixelFormat dstFmt, final byte[] components) { + final PixelFormat.Composition srcComp = srcFmt.comp; + final PixelFormat.Composition dstComp = dstFmt.comp; final byte b1, b2, b3, b4; - if( 1 == srcComps ) { + int u16; + if( PixelFormat.LUMINANCE == srcFmt ) { // LUM -> Fmt Conversion - switch(fmt) { + switch(dstFmt) { case LUMINANCE: - b1 = red___val; + b1 = rescaleComp(srcComp, 0, dstComp, 0, lum___valF); b2 = undef_val; b3 = undef_val; b4 = undef_val; break; - case RGB888: - b1 = red___val; - b2 = red___val; - b3 = red___val; + case RGB565: + case BGR565: + u16 = dstComp.encode3CompI8( + rescaleComp(srcComp, 0, dstComp, 0, lum___valF), + rescaleComp(srcComp, 0, dstComp, 1, lum___valF), + rescaleComp(srcComp, 0, dstComp, 2, lum___valF)); + b1 = (byte)( u16 & 0xff ); + b2 = (byte)( ( u16 >>> 8 ) & 0xff ); + b3 = undef_val; b4 = undef_val; break; - case BGR888: - b1 = red___val; - b2 = red___val; - b3 = red___val; + case RGBA5551: + u16 = dstComp.encode4CompI8( + rescaleComp(srcComp, 0, dstComp, 0, lum___valF), + rescaleComp(srcComp, 0, dstComp, 1, lum___valF), + rescaleComp(srcComp, 0, dstComp, 2, lum___valF), + undef_val); + b1 = (byte)( u16 & 0xff ); + b2 = (byte)( ( u16 >>> 8 ) & 0xff ); + b3 = undef_val; b4 = undef_val; break; + case ABGR1555: + u16 = dstComp.encode4CompI8( + undef_val, + rescaleComp(srcComp, 0, dstComp, 0, lum___valF), + rescaleComp(srcComp, 0, dstComp, 1, lum___valF), + rescaleComp(srcComp, 0, dstComp, 2, lum___valF) ); + b1 = (byte)( u16 & 0xff ); + b2 = (byte)( ( u16 >>> 8 ) & 0xff ); + b3 = undef_val; + b4 = undef_val; + break; + case BGRx8888: + case RGBx8888: + case RGB888: + case BGR888: case RGBA8888: - b1 = red___val; - b2 = red___val; - b3 = red___val; + b1 = rescaleComp(srcComp, 0, dstComp, 0, lum___valF); + b2 = rescaleComp(srcComp, 0, dstComp, 1, lum___valF); + b3 = rescaleComp(srcComp, 0, dstComp, 2, lum___valF); b4 = undef_val; break; case ABGR8888: + case ARGB8888: b1 = undef_val; - b2 = red___val; - b3 = red___val; - b4 = red___val; + b2 = rescaleComp(srcComp, 0, dstComp, 1, lum___valF); + b3 = rescaleComp(srcComp, 0, dstComp, 2, lum___valF); + b4 = rescaleComp(srcComp, 0, dstComp, 3, lum___valF); break; case BGRA8888: - b1 = red___val; - b2 = red___val; - b3 = red___val; + b1 = rescaleComp(srcComp, 0, dstComp, 0, lum___valF); + b2 = rescaleComp(srcComp, 0, dstComp, 1, lum___valF); + b3 = rescaleComp(srcComp, 0, dstComp, 2, lum___valF); b4 = undef_val; break; - case ARGB8888: - b1 = undef_val; - b2 = red___val; - b3 = red___val; - b4 = red___val; - break; default: - throw new InternalError("Unhandled format "+fmt); + throw new InternalError("Unhandled format "+dstFmt); } } else { + final int srcIdxR = srcComp.find(CType.R); + final int srcIdxG = srcComp.find(CType.G); + final int srcIdxB = srcComp.find(CType.B); + final int srcIdxA = srcComp.find(CType.A); + final boolean srcHasAlpha = 0 <= srcIdxA; + final boolean srcHasRGB = 0 <= srcIdxR && 0 <= srcIdxG && 0 <= srcIdxB; // 1:1 values - switch(fmt) { + switch(dstFmt) { case LUMINANCE: - if( srcComps > 1 ) { - b1 = ( red___val + green_val+ blue__val ) / 3; + if( srcHasRGB ) { + final float rF = sourceNorm(srcComp, srcIdxR, red___valF); + final float gF = sourceNorm(srcComp, srcIdxG, green_valF); + final float bF = sourceNorm(srcComp, srcIdxB, blue__valF); + b1 = (byte)dstComp.fromFloat( ( rF + gF + bF ) / 3f, 0, false); b2 = undef_val; b3 = undef_val; b4 = undef_val; } else { - b1 = red___val; + b1 = rescaleComp(srcComp, 0, dstComp, 0, red___valF); b2 = undef_val; b3 = undef_val; b4 = undef_val; } break; + case RGB565: + u16 = dstComp.encode3CompI8( + rescaleComp(srcComp, srcIdxR, dstComp, 0, red___valF), + rescaleComp(srcComp, srcIdxG, dstComp, 1, green_valF), + rescaleComp(srcComp, srcIdxB, dstComp, 2, blue__valF)); + b1 = (byte)( u16 & 0xff ); + b2 = (byte)( ( u16 >>> 8 ) & 0xff ); + b3 = undef_val; + b4 = undef_val; + break; + case BGR565: + u16 = dstComp.encode3CompI8( + rescaleComp(srcComp, srcIdxB, dstComp, 0, blue__valF), + rescaleComp(srcComp, srcIdxG, dstComp, 1, green_valF), + rescaleComp(srcComp, srcIdxR, dstComp, 2, red___valF)); + b1 = (byte)( u16 & 0xff ); + b2 = (byte)( ( u16 >>> 8 ) & 0xff ); + b3 = undef_val; + b4 = undef_val; + break; + case RGBA5551: + u16 = dstComp.encode4CompI8( + rescaleComp(srcComp, srcIdxR, dstComp, 0, red___valF), + rescaleComp(srcComp, srcIdxG, dstComp, 1, green_valF), + rescaleComp(srcComp, srcIdxB, dstComp, 2, blue__valF), + srcHasAlpha ? rescaleComp(srcComp, srcIdxA, dstComp, 3, alpha_valF) : undef_val); + b1 = (byte)( u16 & 0xff ); + b2 = (byte)( ( u16 >>> 8 ) & 0xff ); + b3 = undef_val; + b4 = undef_val; + break; + case ABGR1555: + u16 = dstComp.encode4CompI8( + srcHasAlpha ? rescaleComp(srcComp, srcIdxA, dstComp, 0, alpha_valF) : undef_val, + rescaleComp(srcComp, srcIdxB, dstComp, 1, blue__valF), + rescaleComp(srcComp, srcIdxG, dstComp, 2, green_valF), + rescaleComp(srcComp, srcIdxR, dstComp, 3, red___valF) ); + b1 = (byte)( u16 & 0xff ); + b2 = (byte)( ( u16 >>> 8 ) & 0xff ); + b3 = undef_val; + b4 = undef_val; + break; + case RGBx8888: case RGB888: - b1 = red___val; - b2 = green_val; - b3 = blue__val; + b1 = rescaleComp(srcComp, srcIdxR, dstComp, 0, red___valF); + b2 = rescaleComp(srcComp, srcIdxG, dstComp, 1, green_valF); + b3 = rescaleComp(srcComp, srcIdxB, dstComp, 2, blue__valF); b4 = undef_val; break; + case BGRx8888: case BGR888: - b1 = blue__val; - b2 = green_val; - b3 = red___val; + b1 = rescaleComp(srcComp, srcIdxB, dstComp, 0, blue__valF); + b2 = rescaleComp(srcComp, srcIdxG, dstComp, 1, green_valF); + b3 = rescaleComp(srcComp, srcIdxR, dstComp, 2, red___valF); b4 = undef_val; break; case RGBA8888: - b1 = red___val; - b2 = green_val; - b3 = blue__val; - b4 = srcComps > 3 ? alpha_val : undef_val; + b1 = rescaleComp(srcComp, srcIdxR, dstComp, 0, red___valF); + b2 = rescaleComp(srcComp, srcIdxG, dstComp, 1, green_valF); + b3 = rescaleComp(srcComp, srcIdxB, dstComp, 2, blue__valF); + if( srcHasAlpha ) { + b4 = rescaleComp(srcComp, srcIdxA, dstComp, 3, alpha_valF); + } else { + b4 = undef_val; + } break; case ABGR8888: - b1 = srcComps > 3 ? alpha_val : undef_val; - b2 = blue__val; - b3 = green_val; - b4 = red___val; + if( srcHasAlpha ) { + b1 = rescaleComp(srcComp, srcIdxA, dstComp, 0, alpha_valF); + } else { + b1 = undef_val; + } + b2 = rescaleComp(srcComp, srcIdxB, dstComp, 1, blue__valF); + b3 = rescaleComp(srcComp, srcIdxG, dstComp, 2, green_valF); + b4 = rescaleComp(srcComp, srcIdxR, dstComp, 3, red___valF); break; case BGRA8888: - b1 = blue__val; - b2 = green_val; - b3 = red___val; - b4 = srcComps > 3 ? alpha_val : undef_val; + b1 = rescaleComp(srcComp, srcIdxB, dstComp, 0, blue__valF); + b2 = rescaleComp(srcComp, srcIdxG, dstComp, 1, green_valF); + b3 = rescaleComp(srcComp, srcIdxR, dstComp, 2, red___valF); + if( srcHasAlpha ) { + b4 = rescaleComp(srcComp, srcIdxA, dstComp, 3, alpha_valF); + } else { + b4 = undef_val; + } break; case ARGB8888: - b1 = srcComps > 3 ? alpha_val : undef_val; - b2 = red___val; - b3 = green_val; - b4 = blue__val; + if( srcHasAlpha ) { + b1 = rescaleComp(srcComp, srcIdxA, dstComp, 0, alpha_valF); + } else { + b1 = undef_val; + } + b2 = rescaleComp(srcComp, srcIdxR, dstComp, 1, red___valF); + b3 = rescaleComp(srcComp, srcIdxG, dstComp, 2, green_valF); + b4 = rescaleComp(srcComp, srcIdxB, dstComp, 3, blue__valF); break; default: - throw new InternalError("Unhandled format "+fmt); + throw new InternalError("Unhandled format "+dstFmt); } } components[0] = b1; @@ -193,85 +454,120 @@ public class TestPixelFormatUtil00NEWT extends UITestCase { components[2] = b3; components[3] = b4; } - private void testPNG00Impl(final int srcMinStrideInBytes, final ByteOrder srcByteOrder, final boolean srcIsGLOriented, + private void testConversionImpl(final int srcMinStrideInBytes, final ByteOrder srcByteOrder, final boolean srcIsGLOriented, final int destMinStrideInBytes, final boolean destIsGLOriented) throws InterruptedException, IOException, MalformedURLException { System.err.println("Test00: srcMinStrideInBytes "+srcMinStrideInBytes+", srcByteOrder "+srcByteOrder+", srcIsGLOriented "+srcIsGLOriented+ ", destMinStrideInBytes "+destMinStrideInBytes+", destIsGLOriented "+destIsGLOriented); - final PixelFormat[] formats = PixelFormat.values(); + // final PixelFormat[] srcFormats = { PixelFormat.LUMINANCE }; + // final PixelFormat[] dstFormats = { PixelFormat.RGBx8888 }; + // final PixelFormat[] dstFormats = { PixelFormat.RGB5551 }; + // final PixelFormat[] dstFormats = { PixelFormat.RGB888 }; + // final PixelFormat[] srcFormats = { PixelFormat.RGB888 }; + // final PixelFormat[] dstFormats = { PixelFormat.RGB565 }; + final PixelFormat[] srcFormats = PixelFormat.values(); + final PixelFormat[] dstFormats = PixelFormat.values(); final int width = 64, height = 64; - for(int i=0; i<formats.length; i++) { - final PixelFormat srcFmt = formats[i]; - final int srcBpp = srcFmt.bytesPerPixel(); + for(int i=0; i<srcFormats.length; i++) { + final PixelFormat srcFmt = srcFormats[i]; + final int srcBpp = srcFmt.comp.bytesPerPixel(); final int srcStrideBytes = Math.max(srcMinStrideInBytes, width*srcBpp); final ByteBuffer srcPixels = ByteBuffer.allocate(height*srcStrideBytes).order(srcByteOrder); - final byte[] srcComponents = new byte[4]; - getComponents(srcFmt.componentCount, srcFmt, srcComponents); + final byte[] srcData = new byte[4]; + getComponentData(srcFmt, srcFmt, srcData); for(int y=0; y<height; y++) { int o = y*srcStrideBytes; for(int x=0; x<width; x++) { switch(srcFmt) { case LUMINANCE: - srcPixels.put(o++, srcComponents[0]); + srcPixels.put(o++, srcData[0]); + break; + case BGR565: + case RGB565: + case ABGR1555: + case RGBA5551: + srcPixels.put(o++, srcData[0]); + srcPixels.put(o++, srcData[1]); break; case RGB888: case BGR888: - srcPixels.put(o++, srcComponents[0]); - srcPixels.put(o++, srcComponents[1]); - srcPixels.put(o++, srcComponents[2]); + srcPixels.put(o++, srcData[0]); + srcPixels.put(o++, srcData[1]); + srcPixels.put(o++, srcData[2]); break; + case RGBx8888: + case BGRx8888: case RGBA8888: case ABGR8888: case BGRA8888: case ARGB8888: - srcPixels.put(o++, srcComponents[0]); - srcPixels.put(o++, srcComponents[1]); - srcPixels.put(o++, srcComponents[2]); - srcPixels.put(o++, srcComponents[3]); + srcPixels.put(o++, srcData[0]); + srcPixels.put(o++, srcData[1]); + srcPixels.put(o++, srcData[2]); + srcPixels.put(o++, srcData[3]); break; default: throw new InternalError("Unhandled format "+srcFmt); } } } - final PixelRectangle imageSrc = new PixelRectangle.GenericPixelRect(srcFmt, new Dimension(width, height), srcStrideBytes, srcIsGLOriented, srcPixels); + final PixelRectangle imageSrc = new PixelRectangle.GenericPixelRect(srcFmt, new Dimension(width, height), + srcStrideBytes, srcIsGLOriented, srcPixels); + System.err.println("CONVERT["+i+"][*]: Image0 - Orig: "+imageSrc); - testComponents(imageSrc, 0, 0, srcComponents); - testComponents(imageSrc, width-1, height-1, srcComponents); + System.err.printf("Source %s, %s%n", srcFmt, srcFmt.comp); + System.err.printf("Source Data: %s%n", Bitstream.toHexBinString(true, srcData, 0, srcFmt.comp.bytesPerPixel())); + testComponents(imageSrc, 0, 0, srcData, 0); + testComponents(imageSrc, width-1, height-1, srcData, 0); - for(int j=0; j<formats.length; j++) { - final PixelFormat destFmt = formats[j]; - System.err.println("CONVERT["+i+"]["+j+"]: "+srcFmt+" -> "+destFmt); + final int maxDelta = 12; - final int destStrideBytes = Math.max(destMinStrideInBytes, width*destFmt.bytesPerPixel()); + for(int j=0; j<dstFormats.length; j++) { + final PixelFormat destFmt = dstFormats[j]; + System.err.println("CONVERT["+i+"]["+j+"]: "+srcFmt+" -> "+destFmt); + final int destStrideBytes = Math.max(destMinStrideInBytes, width*destFmt.comp.bytesPerPixel()); final byte[] destComponents = new byte[4]; - getComponents(srcFmt.componentCount, destFmt, destComponents); - final PixelRectangle imageConv1 = PixelFormatUtil.convert32(imageSrc, destFmt, destStrideBytes, destIsGLOriented, false /* nio */); - System.err.println("CONVERT["+i+"]["+j+"]: Conv1: "+imageConv1); - testComponents(imageConv1, 0, 0, destComponents); - testComponents(imageConv1, width-1, height-1, destComponents); + getComponentData(srcFmt, destFmt, destComponents); + System.err.printf("Source %s, %s%n", srcFmt, srcFmt.comp); + System.err.printf("Source Data: %s%n", Bitstream.toHexBinString(true, srcData, 0, srcFmt.comp.bytesPerPixel())); + System.err.printf("Dest %s, %s%n", destFmt, destFmt.comp); + System.err.printf("Dest Data: %s%n", Bitstream.toHexBinString(true, destComponents, 0, destFmt.comp.bytesPerPixel())); + final PixelRectangle imageConv1 = PixelFormatUtil.convert(imageSrc, destFmt, destStrideBytes, destIsGLOriented, false /* nio */); + System.err.println("CONVERT["+i+"]["+j+"]: Conv1: "+imageConv1+", maxDelta "+maxDelta); + System.err.printf("Conv1 Data: %s%n", Bitstream.toHexBinString(true, imageConv1.getPixels(), 0, destFmt.comp.bytesPerPixel())); + testComponents(imageConv1, 0, 0, destComponents, maxDelta); + testComponents(imageConv1, width-1, height-1, destComponents, maxDelta); if( PixelFormat.LUMINANCE != srcFmt && PixelFormat.LUMINANCE == destFmt ) { // Cannot convert: RGB* -> LUM -> RGB* System.err.println("CONVERT["+i+"]["+j+"]: Conv2: Dropped due to RGB* -> LUM"); - } else if( srcFmt.componentCount > destFmt.componentCount ) { + } else if( srcFmt.comp.componenCount() > destFmt.comp.componenCount() ) { // Cannot convert back if: src.componentCount > dest.componentCount System.err.println("CONVERT["+i+"]["+j+"]: Conv2: Dropped due to src.componentCount > dest.componentCount"); } else { - final PixelRectangle imageConv2 = PixelFormatUtil.convert32(imageConv1, imageSrc.getPixelformat(), imageSrc.getStride(), imageSrc.isGLOriented(), false /* nio */); - System.err.println("CONVERT["+i+"]["+j+"]: Conv2: "+imageConv2); - testComponents(imageConv2, 0, 0, srcComponents); - testComponents(imageConv2, width-1, height-1, srcComponents); + final PixelRectangle imageConv2 = PixelFormatUtil.convert(imageConv1, imageSrc.getPixelformat(), imageSrc.getStride(), imageSrc.isGLOriented(), false /* nio */); + System.err.println("CONVERT["+i+"]["+j+"]: Conv2: "+imageConv2+", maxDelta "+maxDelta); + System.err.printf("Conv2 Data: %s%n", Bitstream.toHexBinString(true, imageConv2.getPixels(), 0, srcFmt.comp.bytesPerPixel())); + final byte[] destReComponents = new byte[4]; + getComponentData(destFmt, srcFmt, destReComponents); + System.err.printf("DestRe Data: %s%n", Bitstream.toHexBinString(true, destReComponents, 0, srcFmt.comp.bytesPerPixel())); + testComponents(imageConv2, 0, 0, destReComponents, maxDelta); + testComponents(imageConv2, width-1, height-1, destReComponents, maxDelta); + /** + * Due to 'dead' components or value range re-scale, + * identity comparison on byte level is not correct. + * if( imageSrc.getStride() == imageConv1.getStride() ) { Assert.assertEquals(imageSrc.getPixels(), imageConv2.getPixels()); } + */ } } } } - private void dumpComponents(final PixelRectangle image, int x1, int y1, final int w, final int h) { + static void dumpComponents(final PixelRectangle image, int x1, int y1, final int w, final int h) { if( x1 + w >= image.getSize().getWidth() ) { x1 = image.getSize().getWidth() - w; } @@ -280,7 +576,7 @@ public class TestPixelFormatUtil00NEWT extends UITestCase { } System.err.print("PixelsBytes "+x1+"/"+y1+" "+w+"x"+h+":"); final ByteBuffer bb = image.getPixels(); - final int bpp = image.getPixelformat().bytesPerPixel(); + final int bpp = image.getPixelformat().comp.bytesPerPixel(); for(int y = y1; y< y1+h; y++) { System.err.printf("%n[%3d][%3d] ", x1, y); int o = y * image.getStride()+x1*bpp; @@ -311,51 +607,58 @@ public class TestPixelFormatUtil00NEWT extends UITestCase { } System.err.println(); } - private void testComponents(final PixelRectangle image, final int x, final int y, final byte[] components) { + + static final void assertEquals(final int a, final int b, final int maxDelta) { + final int d = Math.abs( a - b ); + Assert.assertTrue(String.format("Not equal: abs(%s - %s) = %d, > %d maxDelta", + Bitstream.toHexBinString(true, a, 8), Bitstream.toHexBinString(true, b, 8), d, maxDelta), + d <= maxDelta); + } + static final boolean equals(final int a, final int b, final int maxDelta) { + final int d = Math.abs( a - b ); + return d <= maxDelta; + } + + /** + * + * @param image actual data + * @param x position in actual data + * @param y position in actual data + * @param expData expected data + * @param maxDelta the maximum delta between expected {@code components} and actual {@code image} data + */ + static void testComponents(final PixelRectangle image, final int x, final int y, final byte[] expData, final int maxDelta) { dumpComponents(image, x, y, 3, 3); + final PixelFormat.Composition imgComp = image.getPixelformat().comp; final ByteBuffer bb = image.getPixels(); - final int bpp = image.getPixelformat().bytesPerPixel(); - int o = y * image.getStride()+x*bpp; - switch(bpp) { - case 1: { - final byte c1 = bb.get(o++); - final boolean equal = c1==components[0]; - System.err.printf("Test [%3d][%3d] exp 0x%02X == has 0x%02X : %b%n", - x, y, components[0], c1, equal ); - Assert.assertEquals(components[0], c1); - } - break; - case 2: { - final byte c1 = bb.get(o++), c2 = bb.get(o++); - final boolean equal = c1==components[0] && c2==components[1]; - System.err.printf("Test [%3d][%3d] exp 0x%02X%02X == has 0x%02X%02X : %b%n", - x, y, components[1], components[0], c2, c1, equal ); - Assert.assertEquals(components[0], c1); - Assert.assertEquals(components[1], c2); - } - break; - case 3: { - final byte c1 = bb.get(o++), c2 = bb.get(o++), c3 = bb.get(o++); - final boolean equal = c1==components[0] && c2==components[1] && c3==components[2]; - System.err.printf("Test [%3d][%3d] exp 0x%02X%02X%02X == has 0x%02X%02X%02X : %b%n", - x, y, components[2], components[1], components[0], c3, c2, c1, equal ); - Assert.assertEquals(components[0], c1); - Assert.assertEquals(components[1], c2); - Assert.assertEquals(components[2], c3); - } - break; - case 4: { - final byte c1 = bb.get(o++), c2 = bb.get(o++), c3 = bb.get(o++), c4 = bb.get(o++); - final boolean equal = c1==components[0] && c2==components[1] && c3==components[2] && c4==components[3]; - System.err.printf("Test [%3d][%3d] exp 0x%02X%02X%02X%02X == has 0x%02X%02X%02X%02X : %b%n", - x, y, components[3], components[2], components[1], components[0], c4, c3, c2, c1, equal ); - Assert.assertEquals(components[0], c1); - Assert.assertEquals(components[1], c2); - Assert.assertEquals(components[2], c3); - Assert.assertEquals(components[3], c4); - } - break; + final int bytesPerPixel = imgComp.bytesPerPixel(); + final int compCount = imgComp.componenCount(); + final int[] compBitCount = imgComp.componentBitCount(); + + final int srcPixOffset = y * image.getStride()+x*bytesPerPixel; + final int bbPos = bb.position(); + bb.position(bbPos+srcPixOffset); + + final long srcPix64 = PixelFormatUtil.getShiftedI64(imgComp.bytesPerPixel(), bb, true); + final int[] srcComponents = new int[compCount]; + final long expPix64 = PixelFormatUtil.getShiftedI64(imgComp.bytesPerPixel(), expData, 0); + final int[] expComponents = new int[compCount]; + boolean equal = true; + for(int i=0; i<compCount; i++) { + srcComponents[i] = imgComp.decodeSingleI64(srcPix64, i); + expComponents[i] = imgComp.decodeSingleI64(expPix64, i); + equal = equal && equals(srcComponents[i], expComponents[i], maxDelta); } + System.err.printf("Test [%3d][%3d] exp ", x, y); + for(int i=0; i<compCount; i++) { System.err.printf("%s ", Bitstream.toHexBinString(true, expComponents[i], compBitCount[i])); } + System.err.printf("==%nTest [%3d][%3d] has ", x, y); + for(int i=0; i<compCount; i++) { System.err.printf("%s ", Bitstream.toHexBinString(true, srcComponents[i], compBitCount[i])); } + System.err.printf(": equal %b%n%n", equal); + for(int i=0; i<compCount; i++) { + assertEquals(srcComponents[i], expComponents[i], maxDelta); + } + + bb.position(bbPos); } public static void main(final String args[]) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java index eba920032..618797e66 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java @@ -31,15 +31,16 @@ import java.io.IOException; import java.net.MalformedURLException; import java.net.URLConnection; -import javax.media.nativewindow.util.PixelFormat; -import javax.media.nativewindow.util.PixelFormatUtil; -import javax.media.nativewindow.util.PixelRectangle; +import com.jogamp.nativewindow.util.PixelFormat; +import com.jogamp.nativewindow.util.PixelFormatUtil; +import com.jogamp.nativewindow.util.PixelRectangle; import org.junit.Assert; import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; +import com.jogamp.common.util.Bitstream; import com.jogamp.common.util.IOUtil; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.PNGPixelRect; @@ -86,15 +87,21 @@ public class TestPixelFormatUtil01NEWT extends UITestCase { final PNGPixelRect image1 = PNGPixelRect.read(urlConn.getInputStream(), srcFmt, false /* directBuffer */, destMinStrideInBytes, false /* isGLOriented */); System.err.println("PNGPixelRect - Orig: "+image1); + System.err.printf("Image Data: %s%n", Bitstream.toHexBinString(true, image1.getPixels(), 0, image1.getPixelformat().comp.bytesPerPixel())); + TestPixelFormatUtil00NEWT.dumpComponents(image1, 0, 0, 3, 3); final PixelFormat[] formats = new PixelFormat[] { PixelFormat.RGBA8888, PixelFormat.ABGR8888, PixelFormat.BGRA8888, PixelFormat.ARGB8888 }; for(int i=0; i<formats.length; i++) { final PixelFormat destFmt = formats[i]; System.err.println("CONVERT["+i+"]: "+srcFmt+" -> "+destFmt); - final PixelRectangle imageConv1 = PixelFormatUtil.convert32(image1, destFmt, destMinStrideInBytes, destIsGLOriented, false /* nio */); + final PixelRectangle imageConv1 = PixelFormatUtil.convert(image1, destFmt, destMinStrideInBytes, destIsGLOriented, false /* nio */); System.err.println("PNGPixelRect - Conv1: "+imageConv1); - final PixelRectangle imageConv2 = PixelFormatUtil.convert32(imageConv1, image1.getPixelformat(), image1.getStride(), image1.isGLOriented(), false /* nio */); + System.err.printf("Conv1 Data: %s%n", Bitstream.toHexBinString(true, imageConv1.getPixels(), 0, imageConv1.getPixelformat().comp.bytesPerPixel())); + TestPixelFormatUtil00NEWT.dumpComponents(imageConv1, 0, 0, 3, 3); + final PixelRectangle imageConv2 = PixelFormatUtil.convert(imageConv1, image1.getPixelformat(), image1.getStride(), image1.isGLOriented(), false /* nio */); System.err.println("PNGPixelRect - Conv2: "+imageConv2); + System.err.printf("Conv2 Data: %s%n", Bitstream.toHexBinString(true, imageConv2.getPixels(), 0, imageConv2.getPixelformat().comp.bytesPerPixel())); + TestPixelFormatUtil00NEWT.dumpComponents(imageConv2, 0, 0, 3, 3); Assert.assertEquals(image1.getPixels(), imageConv2.getPixels()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java index ed8339b68..6e0af17da 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java @@ -32,10 +32,10 @@ import java.io.IOException; import java.io.InputStream; import java.net.URLConnection; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.After; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture01AWT.java index 5a51473b4..4966bf181 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture01AWT.java @@ -34,11 +34,11 @@ import com.jogamp.opengl.test.junit.jogl.demos.gl2.TextureDraw01GL2Listener; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.ImageIcon; import javax.swing.JLabel; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture02AWT.java index c54b9b3e7..eb510fdeb 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture02AWT.java @@ -33,11 +33,11 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.awt.GLCanvas; import javax.swing.ImageIcon; import javax.swing.JLabel; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java index 5a294eee9..2c46e6797 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java @@ -3,11 +3,11 @@ package com.jogamp.opengl.test.junit.jogl.util.texture; import java.awt.Frame; import java.io.IOException; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import org.junit.Assert; import org.junit.Assume; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java index 47b594e9d..e744504c0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java @@ -2,10 +2,10 @@ package com.jogamp.opengl.test.junit.jogl.util.texture; import java.io.IOException; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java index 9ab81ef82..a5cd38909 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java @@ -27,11 +27,11 @@ */ package com.jogamp.opengl.test.junit.newt; -import javax.media.nativewindow.WindowClosingProtocol; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.WindowClosingProtocol; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.event.WindowAdapter; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java index f9216f082..a93aaca79 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java @@ -38,10 +38,10 @@ import java.lang.reflect.InvocationTargetException; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.util.Point; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.util.Point; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.newt.Window; import com.jogamp.newt.awt.NewtCanvasAWT; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java index c3345708f..587412ddd 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java @@ -34,7 +34,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.newt.*; import com.jogamp.newt.event.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java index 17a66691a..4426a087b 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java @@ -34,8 +34,8 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.opengl.*; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.opengl.*; import com.jogamp.newt.*; import com.jogamp.newt.event.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java b/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java index eaafd190f..85325f328 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java @@ -36,8 +36,8 @@ import org.junit.runners.MethodSorters; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java index 546b35503..709bad2a0 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java @@ -2,11 +2,11 @@ package com.jogamp.opengl.test.junit.newt; import java.io.IOException; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java index 04a27dcc9..ec121f601 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java @@ -3,12 +3,12 @@ package com.jogamp.opengl.test.junit.newt; import java.io.IOException; import java.util.Random; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java index bd84341b8..9dd96acdd 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java @@ -34,7 +34,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.newt.*; import com.jogamp.newt.opengl.*; @@ -43,7 +43,7 @@ import java.io.IOException; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import javax.media.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.AbstractGraphicsDevice; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestGLWindows00NEWT extends UITestCase { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java index ea3e96a47..ab8304504 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java @@ -34,7 +34,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.newt.*; import com.jogamp.newt.event.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java index 4969c3b77..48700ab13 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java @@ -35,9 +35,9 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.opengl.*; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; import com.jogamp.newt.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java index f7a45c1b0..8f5a33b35 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java @@ -31,10 +31,10 @@ package com.jogamp.opengl.test.junit.newt; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java index 588e3cc0f..17d53f25f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java @@ -36,7 +36,7 @@ import org.junit.runners.MethodSorters; import java.awt.Frame; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; import com.jogamp.newt.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestMultipleNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestMultipleNewtCanvasAWT.java index 0e11ff1e8..2220fbcd9 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestMultipleNewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestMultipleNewtCanvasAWT.java @@ -32,9 +32,9 @@ import java.awt.Component; import java.awt.Dimension; import java.io.IOException; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JFrame; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java index 4d662c47f..e4438893f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java @@ -34,7 +34,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; @@ -45,8 +45,8 @@ import java.io.IOException; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestRemoteGLWindows01NEWT extends UITestCase { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteWindow01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteWindow01NEWT.java index 06e55a5eb..ecc68f3c9 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteWindow01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteWindow01NEWT.java @@ -36,7 +36,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; import com.jogamp.newt.*; import java.io.IOException; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java index 75e63f7a7..0ef554ec2 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java @@ -31,8 +31,8 @@ package com.jogamp.opengl.test.junit.newt; import java.io.IOException; import java.util.Properties; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLCapabilities; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GLCapabilities; import org.junit.AfterClass; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java index 40b60ac69..57f87ab97 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java @@ -39,10 +39,10 @@ import java.awt.Frame; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; -import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; +import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java index ab57065b9..8b639d5da 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java @@ -35,10 +35,10 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; import org.junit.Assert; -import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; +import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.newt.opengl.GLWindow; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java index e458862d0..1859a8f87 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java @@ -41,9 +41,9 @@ import java.lang.reflect.InvocationTargetException; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; -import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java index 153da2666..edc0f57ad 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java @@ -34,7 +34,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.nativewindow.*; +import com.jogamp.nativewindow.*; import com.jogamp.newt.*; import java.io.IOException; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java index a2fd7b08c..39c6c9f4d 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java @@ -32,7 +32,7 @@ import java.io.PrintStream ; import java.util.ArrayList ; import java.util.concurrent.atomic.AtomicInteger; -import javax.media.opengl.GLProfile ; +import com.jogamp.opengl.GLProfile ; import org.junit.Assert ; import org.junit.BeforeClass ; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java index 194edbcb5..8cc266147 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java @@ -28,7 +28,7 @@ package com.jogamp.opengl.test.junit.newt.event; -import javax.media.opengl.awt.GLCanvas ; +import com.jogamp.opengl.awt.GLCanvas ; import javax.swing.JFrame ; import javax.swing.SwingUtilities ; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java index d34c36072..3db61b37b 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java @@ -28,8 +28,8 @@ package com.jogamp.opengl.test.junit.newt.event; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.AfterClass ; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java index c916ddc4d..1d19f527f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.newt.event ; import java.awt.BorderLayout ; -import javax.media.opengl.GLCapabilities ; -import javax.media.opengl.GLProfile ; +import com.jogamp.opengl.GLCapabilities ; +import com.jogamp.opengl.GLProfile ; import javax.swing.JFrame ; import javax.swing.SwingUtilities ; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java index 3e4029cf5..4d1cbdae2 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java @@ -34,8 +34,8 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display ; import org.eclipse.swt.widgets.Shell ; -import javax.media.opengl.GLCapabilities ; -import javax.media.opengl.GLProfile ; +import com.jogamp.opengl.GLCapabilities ; +import com.jogamp.opengl.GLProfile ; import org.junit.AfterClass ; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java index eebbe5469..0b96f92b9 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java @@ -41,8 +41,8 @@ import java.lang.reflect.InvocationTargetException; import java.util.EventObject; import java.util.List; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; import javax.swing.JFrame; import java.io.IOException; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java index eecc35e4e..60ea0e570 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java @@ -42,8 +42,8 @@ import java.util.ArrayList; import java.util.EventObject; import java.util.List; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; import javax.swing.JFrame; import java.io.IOException; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java index 5e78d908f..112a7453d 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java @@ -42,8 +42,8 @@ import java.util.Arrays; import java.util.EventObject; import java.util.List; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; import javax.swing.JFrame; import java.io.IOException; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java index 3f86c186c..e3fa18ae4 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java @@ -39,8 +39,8 @@ import java.awt.BorderLayout; import java.awt.Robot; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; import javax.swing.JFrame; import java.io.IOException; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java index faf239910..e951ba2ee 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java @@ -39,8 +39,8 @@ import java.awt.BorderLayout; import java.awt.Robot; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; import javax.swing.JFrame; import java.io.IOException; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java index 586c380bf..d5ce78ce5 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java @@ -39,8 +39,8 @@ import java.awt.Container; import java.awt.Robot; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; import javax.swing.JFrame; import java.util.ArrayList; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java index 584344ef5..f9ae91fc8 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java @@ -50,7 +50,7 @@ import javax.swing.WindowConstants; import java.util.ArrayList; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; import com.jogamp.newt.opengl.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java index ace039688..cade05478 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java @@ -48,7 +48,7 @@ import java.awt.Frame; import java.awt.KeyboardFocusManager; import java.awt.Robot; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; import com.jogamp.newt.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/ManualScreenMode03aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/ManualScreenMode03aNEWT.java index 2133f25c2..47f6511e4 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/ManualScreenMode03aNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/ManualScreenMode03aNEWT.java @@ -29,8 +29,8 @@ package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; @@ -44,7 +44,7 @@ import com.jogamp.newt.util.MonitorModeUtil; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.UITestCase; import java.util.List; -import javax.media.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.Dimension; /** * Manual testing the ScreenImpl shutdown hook, diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java index 860560658..be15e3b7e 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java @@ -30,7 +30,7 @@ package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; -import javax.media.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.NativeWindowFactory; import org.junit.Assert; import org.junit.BeforeClass; @@ -50,12 +50,12 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import java.util.Iterator; import java.util.List; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; -import javax.media.nativewindow.util.SurfaceSize; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.SurfaceSize; +import com.jogamp.opengl.GLProfile; import jogamp.newt.MonitorDeviceImpl; import jogamp.newt.MonitorModeProps; @@ -112,12 +112,12 @@ public class TestScreenMode00aNEWT extends UITestCase { final Rectangle viewport = new Rectangle(0, 0, 1920, 1080); final ArrayHashSet<MonitorMode> supportedModes = new ArrayHashSet<MonitorMode>(); supportedModes.add(modeOut); - final MonitorDevice monOut = new MonitorDeviceImpl(null, -1, sizeMM, viewport, viewport, modeOut, supportedModes); + final MonitorDevice monOut = new MonitorDeviceImpl(null, -1, sizeMM, modeOut, null, viewport, viewport, supportedModes); System.err.println("01 out : "+monOut); cache.monitorDevices.add(monOut); { final int[] props = MonitorModeProps.streamOutMonitorDevice(monOut); - final MonitorDevice monIn = MonitorModeProps.streamInMonitorDevice(null, cache, null, props, 0); + final MonitorDevice monIn = MonitorModeProps.streamInMonitorDevice(cache, null, null, props, 0, null); System.err.println("01 in : "+monIn); Assert.assertEquals(monOut.getCurrentMode(), monOut.getOriginalMode()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java index 518dbb8db..ac8d28427 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java @@ -29,7 +29,7 @@ package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; -import javax.media.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.NativeWindowFactory; import org.junit.Assert; import org.junit.BeforeClass; @@ -50,8 +50,8 @@ import com.jogamp.opengl.util.Animator; import java.util.Iterator; import java.util.List; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; /** * Queries the current MonitorMode 50 times, diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java index 37440457a..deab32e03 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.AfterClass; import org.junit.Assert; @@ -55,10 +55,10 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import java.util.List; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Rectangle; /** * Tests X11 XRandR MonitorMode reset via {@link UITestCase#resetXRandRIfX11()}. diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java index 6ddea555c..353856fe5 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.AfterClass; import org.junit.Assert; @@ -55,9 +55,9 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import java.util.List; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Rectangle; /** * <p> diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java index bba663a10..29068afca 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.AfterClass; import org.junit.Assert; @@ -56,10 +56,10 @@ import com.jogamp.opengl.util.Animator; import java.util.List; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; /** * Mode change on separate monitors .. diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java index 377c35ade..b70b5ce7d 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java @@ -30,8 +30,8 @@ package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.AfterClass; import org.junit.Assert; @@ -56,10 +56,10 @@ import com.jogamp.opengl.util.Animator; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Rectangle; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.DimensionImmutable; +import com.jogamp.nativewindow.util.Rectangle; +import com.jogamp.nativewindow.util.RectangleImmutable; /** * Fullscreen on separate monitors, incl. spanning across multiple monitors. diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java index 4d109a99f..3247b87ac 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java @@ -29,8 +29,8 @@ package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; @@ -54,8 +54,8 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil; import com.jogamp.opengl.test.junit.util.UITestCase; import java.util.List; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.RectangleImmutable; +import com.jogamp.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.RectangleImmutable; /** * Demonstrates fullscreen without MonitorMode change diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java index c2d769a2e..d319341ef 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java @@ -29,8 +29,8 @@ package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; @@ -53,7 +53,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; import com.jogamp.opengl.test.junit.util.UITestCase; import java.util.List; -import javax.media.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.Dimension; /** * Tests MonitorMode change w/ changed rotation, diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java index 47fd53e05..11e863217 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java @@ -29,8 +29,8 @@ package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLProfile; import org.junit.AfterClass; import org.junit.Assert; @@ -54,7 +54,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; import java.util.List; -import javax.media.nativewindow.util.Dimension; +import com.jogamp.nativewindow.util.Dimension; /** * Tests MonitorMode change w/ changed rotation and fullscreen. diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java index 18f2b9b4a..eca1f89c1 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java @@ -28,7 +28,7 @@ package com.jogamp.opengl.test.junit.newt.parenting; -import javax.media.opengl.*; +import com.jogamp.opengl.*; public class GLRunnableDummy implements GLRunnable { float r=0.0f; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java index 75037b60c..0bdd51407 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java @@ -30,7 +30,7 @@ package com.jogamp.opengl.test.junit.newt.parenting; import java.awt.Frame; import java.net.URLConnection; -import javax.media.nativewindow.util.InsetsImmutable; +import com.jogamp.nativewindow.util.InsetsImmutable; import com.jogamp.common.util.IOUtil; import com.jogamp.newt.Display; @@ -62,8 +62,8 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter { return; } if( e.getKeySymbol() == KeyEvent.VK_L ) { - final javax.media.nativewindow.util.Point p0 = newtCanvasAWT.getNativeWindow().getLocationOnScreen(null); - final javax.media.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null); + final com.jogamp.nativewindow.util.Point p0 = newtCanvasAWT.getNativeWindow().getLocationOnScreen(null); + final com.jogamp.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null); System.err.println("NewtCanvasAWT position: "+p0+", "+p1); } else if( e.getKeySymbol() == KeyEvent.VK_D ) { glWindow.setUndecorated(!glWindow.isUndecorated()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java index d6658d809..591ce5f4e 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java @@ -35,7 +35,7 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; import com.jogamp.newt.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java index 6f39985f4..3878e8ba5 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java @@ -39,7 +39,7 @@ import java.awt.BorderLayout; import java.awt.Container; import java.awt.Frame; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import javax.swing.SwingUtilities; import com.jogamp.opengl.util.Animator; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aSWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aSWT.java index 770b7ce4d..283caeb59 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aSWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aSWT.java @@ -31,8 +31,8 @@ package com.jogamp.opengl.test.junit.newt.parenting; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java index 49e74ddc0..41506aa2d 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java @@ -38,7 +38,7 @@ import java.awt.Button; import java.awt.BorderLayout; import java.awt.Frame; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import javax.swing.SwingUtilities; import com.jogamp.opengl.util.Animator; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java index 30be67ab3..74c147a84 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java @@ -39,7 +39,7 @@ import java.awt.BorderLayout; import java.awt.Container; import java.awt.Frame; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import javax.swing.SwingUtilities; import com.jogamp.newt.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java index 3726870e3..b53da38d7 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java @@ -44,7 +44,7 @@ import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; import com.jogamp.newt.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java index ad8a6f50e..e23b36f07 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java @@ -39,7 +39,7 @@ import java.awt.BorderLayout; import java.awt.Container; import java.awt.Frame; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import javax.swing.SwingUtilities; import com.jogamp.newt.Window; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java index ed5c2f8a1..e4b109d43 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java @@ -38,7 +38,7 @@ import java.awt.Button; import java.awt.BorderLayout; import java.awt.Frame; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.newt.*; import com.jogamp.newt.event.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java index c9a96868f..6a7066820 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java @@ -35,8 +35,8 @@ import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; -import javax.media.opengl.*; -import javax.media.nativewindow.*; +import com.jogamp.opengl.*; +import com.jogamp.nativewindow.*; import com.jogamp.newt.*; import com.jogamp.newt.event.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java index fde366dd2..723b84081 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java @@ -42,7 +42,7 @@ import java.awt.Container; import java.awt.Dimension; import java.awt.Frame; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; import com.jogamp.newt.*; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java index 3ff4ecdaa..92ea93850 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java @@ -34,8 +34,8 @@ import java.awt.Frame; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; import javax.swing.SwingUtilities; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java index 631d2309a..5e59d55d0 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java @@ -31,8 +31,8 @@ package com.jogamp.opengl.test.junit.newt.parenting; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java index c9390f124..d24a95ffa 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java @@ -2,11 +2,11 @@ package com.jogamp.opengl.test.junit.newt.parenting; import java.io.IOException; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.NativeWindow; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLProfile; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java index 3eb0c1325..4a9a2dc19 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java @@ -42,9 +42,9 @@ import java.awt.image.ColorModel; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java index 31d6b887d..d9e9fc0cb 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java @@ -38,14 +38,15 @@ import java.awt.AWTException; import java.awt.EventQueue; import java.awt.Robot; -import javax.media.nativewindow.NativeWindow; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; +import com.jogamp.nativewindow.NativeWindow; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; import org.junit.Assert; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.awt.AWTEDTExecutor; import com.jogamp.newt.event.WindowEvent; @@ -135,9 +136,9 @@ public class AWTRobotUtil { private static int[] getCenterLocationNEWT(final com.jogamp.newt.Window win, final boolean onTitleBarIfWindow) throws InterruptedException, InvocationTargetException { - final javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null); + final com.jogamp.nativewindow.util.Point p0 = win.getLocationOnScreen(null); if( onTitleBarIfWindow ) { - final javax.media.nativewindow.util.InsetsImmutable insets = win.getInsets(); + final com.jogamp.nativewindow.util.InsetsImmutable insets = win.getInsets(); p0.translate(win.getWidth()/2, insets.getTopHeight()/2); } else { p0.translate(win.getWidth()/2, win.getHeight()/2); @@ -172,7 +173,7 @@ public class AWTRobotUtil { } private static int[] getClientLocationNEWT(final com.jogamp.newt.Window win, final int x, final int y) throws InterruptedException, InvocationTargetException { - final javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null); + final com.jogamp.nativewindow.util.Point p0 = win.getLocationOnScreen(null); return new int[] { p0.getX(), p0.getY() }; } private static int[] getClientLocationAWT(final java.awt.Component comp, final int x, final int y) @@ -229,7 +230,7 @@ public class AWTRobotUtil { System.err.println("*** AWTRobotUtil.toFrontAndRequestFocus() UI failure"); System.err.println("*** window: "+window); System.err.println("*** window.hasFocus(): "+window.hasFocus()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return success; } @@ -442,7 +443,7 @@ public class AWTRobotUtil { } System.err.println("*** gain: "+gain); System.err.println("*** lost: "+lost); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } Assert.assertTrue("Did not gain focus", hasFocus); } diff --git a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java index ec8276dee..a2887112f 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java +++ b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java @@ -29,7 +29,7 @@ package com.jogamp.opengl.test.junit.util; -import javax.media.opengl.*; +import com.jogamp.opengl.*; import com.jogamp.opengl.JoglVersion; diff --git a/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java b/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java index 981c5c17c..19399a1e9 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java @@ -27,8 +27,8 @@ */ package com.jogamp.opengl.test.junit.util; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; public class GLEventListenerCounter implements GLEventListener { public int initCount = 0; diff --git a/src/test/com/jogamp/opengl/test/junit/util/GLSLSimpleProgram.java b/src/test/com/jogamp/opengl/test/junit/util/GLSLSimpleProgram.java index 5c2b2c56f..a05f3755f 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/GLSLSimpleProgram.java +++ b/src/test/com/jogamp/opengl/test/junit/util/GLSLSimpleProgram.java @@ -31,8 +31,8 @@ package com.jogamp.opengl.test.junit.util; import com.jogamp.opengl.util.glsl.ShaderUtil; import java.io.ByteArrayOutputStream; import java.io.PrintStream; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; import org.junit.Assert; public class GLSLSimpleProgram { diff --git a/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java b/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java index 943a99dcf..60f2f962c 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java +++ b/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java @@ -39,7 +39,7 @@ import java.nio.FloatBuffer; import java.util.Iterator; import java.util.List; -import javax.media.opengl.GLContext; +import com.jogamp.opengl.GLContext; import com.jogamp.common.os.Platform; diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java index d897a51a1..361a6c230 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java +++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java @@ -32,10 +32,10 @@ import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Screen; import com.jogamp.newt.Window; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLDrawableFactory; import org.junit.Assert; diff --git a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java index 98d288496..2b1bb7062 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java +++ b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java @@ -39,12 +39,12 @@ import java.util.List; import java.util.StringTokenizer; import java.util.concurrent.atomic.AtomicInteger; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLEventListener; +import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLDrawable; +import com.jogamp.opengl.GLEventListener; import com.jogamp.junit.util.SingletonJunitCase; import com.jogamp.opengl.util.GLReadBufferUtil; diff --git a/src/test/com/jogamp/opengl/test/junit/util/ValidateLockListener.java b/src/test/com/jogamp/opengl/test/junit/util/ValidateLockListener.java index ceb171529..8057e869a 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/ValidateLockListener.java +++ b/src/test/com/jogamp/opengl/test/junit/util/ValidateLockListener.java @@ -29,9 +29,9 @@ package com.jogamp.opengl.test.junit.util; -import javax.media.nativewindow.NativeSurface; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; +import com.jogamp.nativewindow.NativeSurface; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLEventListener; public class ValidateLockListener implements GLEventListener { |